From 561e7169acd02d5e27542a1d93f1f9533ba52fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 11 Feb 2020 20:12:01 +0100 Subject: [PATCH] jump: fix for `marks' and CTRL+G key binding - marks printed an error when $MARKPATH didn't exist or didn't have any marks in it. - The CTRL+G key binding overwrote an argument when it couldn't match it to an existing mark. --- plugins/jump/jump.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index a21b7a181..c2da1144e 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -30,13 +30,13 @@ unmark() { marks() { local link max=0 - for link in $MARKPATH/{,.}*(@); do + for link in $MARKPATH/{,.}*(@N); do if [[ ${#link:t} -gt $max ]]; then max=${#link:t} fi done local printf_markname_template="$(printf -- "%%%us " "$max")" - for link in $MARKPATH/{,.}*(@); do + for link in $MARKPATH/{,.}*(@N); do local markname="$fg[cyan]${link:t}$reset_color" local markpath="$fg[blue]$(readlink $link)$reset_color" printf -- "$printf_markname_template" "$markname" @@ -53,7 +53,7 @@ compctl -K _completemarks unmark _mark_expansion() { setopt localoptions extendedglob autoload -U modify-current-argument - modify-current-argument '$(readlink "$MARKPATH/$ARG")' + modify-current-argument '$(readlink "$MARKPATH/$ARG" || echo "$ARG")' } zle -N _mark_expansion bindkey "^g" _mark_expansion