diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/asdf/asdf.plugin.zsh | 8 | ||||
-rw-r--r-- | plugins/cake/README.md | 15 | ||||
-rw-r--r-- | plugins/git/git.plugin.zsh | 8 | ||||
-rw-r--r-- | plugins/ssh-agent/ssh-agent.plugin.zsh | 22 | ||||
-rw-r--r-- | plugins/transfer/transfer.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/z/z.sh | 6 |
6 files changed, 44 insertions, 19 deletions
diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh index 75395c718..38b225538 100644 --- a/plugins/asdf/asdf.plugin.zsh +++ b/plugins/asdf/asdf.plugin.zsh @@ -1,9 +1,11 @@ # Find where asdf should be installed ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" +ASDF_COMPLETIONS="$ASDF_DIR/completions" # If not found, check for Homebrew package -if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then +if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then ASDF_DIR="$(brew --prefix asdf)" + ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" fi # Load command @@ -11,7 +13,7 @@ if [[ -f "$ASDF_DIR/asdf.sh" ]]; then . "$ASDF_DIR/asdf.sh" # Load completions - if [[ -f "$ASDF_DIR/completions/asdf.bash" ]]; then - . "$ASDF_DIR/completions/asdf.bash" + if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then + . "$ASDF_COMPLETIONS/asdf.bash" fi fi diff --git a/plugins/cake/README.md b/plugins/cake/README.md new file mode 100644 index 000000000..aad92a3ec --- /dev/null +++ b/plugins/cake/README.md @@ -0,0 +1,15 @@ +# Cake + +This plugin provides completion for [CakePHP](https://cakephp.org/). + +To use it add cake to the plugins array in your zshrc file. + +```bash +plugins=(... cake) +``` + +## Note + +This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory. +It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your +`.gitignore` files. diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 45a706173..12400ede4 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -112,8 +112,8 @@ ggf() { git push --force origin "${b:=$1}" } ggfl() { -[[ "$#" != 1 ]] && local b="$(git_current_branch)" -git push --force-with-lease origin "${b:=$1}" + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git push --force-with-lease origin "${b:=$1}" } compdef _git ggf=git-checkout @@ -155,10 +155,10 @@ compdef _git ggu=git-checkout alias ggpur='ggu' compdef _git ggpur=git-checkout -alias ggpull='git pull origin $(git_current_branch)' +alias ggpull='git pull origin "$(git_current_branch)"' compdef _git ggpull=git-checkout -alias ggpush='git push origin $(git_current_branch)' +alias ggpush='git push origin "$(git_current_branch)"' compdef _git ggpush=git-checkout alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 0a204309e..a7a4ee33a 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -13,7 +13,7 @@ function _start_agent() { function _add_identities() { local id line sig - local -a identities loaded not_loaded signatures + local -a identities loaded_sigs loaded_ids not_loaded zstyle -a :omz:plugins:ssh-agent identities identities # check for .ssh folder presence @@ -31,19 +31,19 @@ function _add_identities() { done fi - # get list of loaded identities' signatures - for line in ${(f)"$(ssh-add -l)"}; do loaded+=${${(z)line}[2]}; done - - # get signatures of private keys - for id in $identities; do - signatures+="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}') $id" + # get list of loaded identities' signatures and filenames + for line in ${(f)"$(ssh-add -l)"}; do + loaded_sigs+=${${(z)line}[2]} + loaded_ids+=${${(z)line}[3]} done # add identities if not already loaded - for sig in $signatures; do - id="$(cut -f2 <<< $sig)" - sig="$(cut -f1 <<< $sig)" - [[ ${loaded[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id" + for id in $identities; do + # check for filename match, otherwise try for signature match + if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then + sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')" + [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id" + fi done [[ -n "$not_loaded" ]] && ssh-add ${^not_loaded} diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh index 7a7cd85ec..db744b0cd 100644 --- a/plugins/transfer/transfer.plugin.zsh +++ b/plugins/transfer/transfer.plugin.zsh @@ -61,7 +61,9 @@ transfer() { # cat output link cat $tmpfile + # add newline + echo # cleanup rm -f $tmpfile -}
\ No newline at end of file +} diff --git a/plugins/z/z.sh b/plugins/z/z.sh index 4fc75dc6a..5fe6d5266 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -222,10 +222,16 @@ if type compctl >/dev/null 2>&1; then if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then _z_precmd() { (_z --add "${PWD:a}" &) + # Reference $RANDOM to refresh its value inside the subshell + # Otherwise, multiple runs get the same value + : $RANDOM } else _z_precmd() { (_z --add "${PWD:A}" &) + # Reference $RANDOM to refresh its value inside the subshell + # Otherwise, multiple runs get the same value + : $RANDOM } fi [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || { |