Compare commits

..
7 changed files with 163 additions and 41 deletions

No files matched your search

-1
View File
@@ -90,7 +90,6 @@ colorize_less() {
# (e.g. when not scrolled to the bottom) while already the next file will be displayed. # (e.g. when not scrolled to the bottom) while already the next file will be displayed.
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \ local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \ ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
colorize_cat %s 2> /dev/null'" colorize_cat %s 2> /dev/null'"
# LESSCLOSE will be set to prevent any errors by executing a user script # LESSCLOSE will be set to prevent any errors by executing a user script
-14
View File
@@ -80,17 +80,3 @@ zstyle ':omz:plugins:laravel' php 'herd php'
| `paqr` | `php artisan queue:retry` | | `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` | | `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` | | `paqw` | `php artisan queue:work` |
## Modules
Aliases for [nWidart/laravel-modules](https://github.com/nWidart/laravel-modules).
| Alias | Description |
|:-:|:-:|
| `pamol` | `php artisan module:list` |
| `pamomk` | `php artisan module:make` |
| `pamoe` | `php artisan module:enable` |
| `pamod` | `php artisan module:disable` |
| `pamom` | `php artisan module:migrate` |
| `pamomr` | `php artisan module:migrate-rollback` |
| `pamos` | `php artisan module:seed` |
-9
View File
@@ -53,13 +53,4 @@ alias paqr="$_omz_laravel_php artisan queue:retry"
alias paqt="$_omz_laravel_php artisan queue:table" alias paqt="$_omz_laravel_php artisan queue:table"
alias paqw="$_omz_laravel_php artisan queue:work" alias paqw="$_omz_laravel_php artisan queue:work"
# Modules (nWidart/laravel-modules)
alias pamol="$_omz_laravel_php artisan module:list"
alias pamomk="$_omz_laravel_php artisan module:make"
alias pamoe="$_omz_laravel_php artisan module:enable"
alias pamod="$_omz_laravel_php artisan module:disable"
alias pamom="$_omz_laravel_php artisan module:migrate"
alias pamomr="$_omz_laravel_php artisan module:migrate-rollback"
alias pamos="$_omz_laravel_php artisan module:seed"
unset _omz_laravel_php unset _omz_laravel_php
+10
View File
@@ -50,6 +50,16 @@ function _omz_nvm_setup_autoload {
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent" zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
if [[ -n "$nvmrc_path" ]]; then if [[ -n "$nvmrc_path" ]]; then
# Skip version resolution when an exact, unaliased version is already active.
local nvmrc_version="$(<"$nvmrc_path")"
if [[ "$nvmrc_version" == v<->.<->.<-> \
&& ! -e "$NVM_DIR/alias/$nvmrc_version" \
&& "${commands[node]-}" == "$NVM_DIR/versions/node/$nvmrc_version/bin/node" \
&& -x "${commands[node]-}" ]] \
&& (( ! $+functions[node] && ! $+aliases[node] )) \
&& [[ "$nvmrc_version" == "$(command node --version 2>/dev/null)" ]]; then
return
fi
local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]')) local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]'))
if [[ "$nvmrc_node_version" = "N/A" ]]; then if [[ "$nvmrc_node_version" = "N/A" ]]; then
+153
View File
@@ -0,0 +1,153 @@
#!/usr/bin/env zsh
emulate -LR zsh
plugin=${1:-${0:A:h:h}/nvm.plugin.zsh}
plugin=${plugin:A}
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
export NVM_DIR="$test_dir/nvm" NVM_TEST_CALLS="$test_dir/calls"
mkdir -p "$NVM_DIR/alias" "$test_dir/project/nested" "$test_dir/outside" "$test_dir/system"
for version in v1.2.3 v2.0.0; do
mkdir -p "$NVM_DIR/versions/node/$version/bin"
print -r -- "#!/bin/sh
printf '%s\\n' '$version'" > "$NVM_DIR/versions/node/$version/bin/node"
chmod +x "$NVM_DIR/versions/node/$version/bin/node"
done
print -r -- '#!/bin/sh
printf "%s\n" v1.2.3' > "$test_dir/system/node"
chmod +x "$test_dir/system/node"
# Record resolver calls, including those made in command substitutions.
cat > "$NVM_DIR/nvm.sh" <<'EOF'
nvm_find_nvmrc() {
local dir=$PWD
while [[ $dir != / ]]; do
[[ -f $dir/.nvmrc ]] && { print -r -- "$dir/.nvmrc"; return; }
dir=${dir:h}
done
}
nvm() {
print -r -- "$*" >> "$NVM_TEST_CALLS"
local target=${2:-current}
case $1 in
version)
[[ $target == current ]] && { command node --version; return; }
[[ -f $NVM_DIR/alias/$target ]] && target=$(<"$NVM_DIR/alias/$target")
case $target in
default|1|1.2|1.2.3) target=v1.2.3 ;;
esac
[[ -x $NVM_DIR/versions/node/$target/bin/node ]] && print -r -- "$target" || print N/A
;;
use)
if [[ $target == --silent ]]; then
target=$(nvm version "$(<"$(nvm_find_nvmrc)")")
else
target=$(nvm version "$target")
fi
path=("$NVM_DIR/versions/node/$target/bin" ${path:#$NVM_DIR/versions/node/*/bin})
;;
install) return 1 ;;
esac
}
EOF
path=("$NVM_DIR/versions/node/v1.2.3/bin" $path)
builtin cd -q "$test_dir/outside"
compdef() { :; }
zstyle ':omz:plugins:nvm' autoload yes
zstyle ':omz:plugins:nvm' silent-autoload yes
source "$plugin"
typeset -i failures=0 tests=0
check() {
local description=$1
shift
(( tests++ ))
if "$@"; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
(( failures++ ))
fi
}
has_call() { [[ "$(<"$NVM_TEST_CALLS")" == *"$1"* ]]; }
reset_calls() { : > "$NVM_TEST_CALLS"; }
print -r -- v1.2.3 > "$test_dir/project/.nvmrc"
reset_calls
builtin cd "$test_dir/project/nested"
check 'matching exact version in parent skips resolver' test ! -s "$NVM_TEST_CALLS"
check 'matching version stays selected' test "$(command node --version)" = v1.2.3
print -r -- v2.0.0 > "$test_dir/project/.nvmrc"
reset_calls
load-nvmrc
check 'editing version file switches runtime' test "$(command node --version)" = v2.0.0
check 'switch calls nvm use' has_call 'use --silent'
reset_calls
load-nvmrc
check 'newly selected exact version skips resolver on repeat' test ! -s "$NVM_TEST_CALLS"
reset_calls
builtin cd "$test_dir/outside"
check 'leaving project restores default' test "$(command node --version)" = v1.2.3
check 'default restoration uses nvm' has_call 'use default --silent'
builtin cd -q "$test_dir/project"
for requested in default 1 1.2 1.2.3 $'v1.2.3\r'; do
print -r -- "$requested" > .nvmrc
reset_calls
load-nvmrc
check "resolver retained for ${(qqq)requested}" has_call 'version '
done
print -r -- v1.2.3 > .nvmrc
print -r -- v2.0.0 > "$NVM_DIR/alias/v1.2.3"
reset_calls
load-nvmrc
check 'numeric alias overrides apparent exact version' test "$(command node --version)" = v2.0.0
rm "$NVM_DIR/alias/v1.2.3"
nvm use default --silent
path=("$test_dir/system" $path)
reset_calls
load-nvmrc
check 'same-version system executable still uses resolver' has_call 'version v1.2.3'
path=(${path:#$test_dir/system})
node() { command node "$@"; }
reset_calls
load-nvmrc
check 'node function retains resolver' has_call 'version v1.2.3'
unfunction node
alias node='command node'
reset_calls
load-nvmrc
check 'node alias retains resolver' has_call 'version v1.2.3'
unalias node
print -r -- '#!/bin/sh
printf "%s\n" v2.0.0' > "$NVM_DIR/versions/node/v1.2.3/bin/node"
reset_calls
load-nvmrc
check 'executable version mismatch retains resolver' has_call 'version v1.2.3'
print -r -- '#!/bin/sh
printf "%s\n" v1.2.3' > "$NVM_DIR/versions/node/v1.2.3/bin/node"
chmod -x "$NVM_DIR/versions/node/v1.2.3/bin/node"
reset_calls
load-nvmrc
check 'non-executable runtime keeps install path' has_call install
chmod +x "$NVM_DIR/versions/node/v1.2.3/bin/node"
print -r -- v99.0.0 > .nvmrc
reset_calls
load-nvmrc
check 'missing version keeps install path' has_call install
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
-3
View File
@@ -4,9 +4,6 @@ Initializes [zsh-patina](https://github.com/michel-kraemer/zsh-patina), a
"blazingly fast Zsh plugin performing syntax highlighting of your command line "blazingly fast Zsh plugin performing syntax highlighting of your command line
while you type 🌈" while you type 🌈"
The plugin also caches completions for the `zsh-patina` command in
`$ZSH_CACHE_DIR/completions/_zsh-patina`, refreshed each time the plugin loads.
To use it, add `zsh-patina` to the plugins array in your `.zshrc` file: To use it, add `zsh-patina` to the plugins array in your `.zshrc` file:
```zsh ```zsh
-14
View File
@@ -2,20 +2,6 @@ if (( $+ZSH_HIGHLIGHT_VERSION )) || (( ${plugins[(Ie)zsh-syntax-highlighting]} )
echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them' echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them'
elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then
eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)" eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `zsh-patina`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_zsh-patina" ]]; then
typeset -g -A _comps
autoload -Uz _zsh-patina
_comps[zsh-patina]=_zsh-patina
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zsh-patina"
zf_mv -f -- =( "$1" completion ) "$ZSH_CACHE_DIR/completions/_zsh-patina"
} "${ZSH_PATINA_BINARY:-$commands[zsh-patina]}" &|
else else
echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina' echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina'
fi fi