561e7169acd02d5e27542a1d93f1f9533ba52fa6

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

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.

Diff

 1diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
 2index a21b7a1818d1ea33ea536ca5cd38c7e0e1d6ca34..c2da1144ec3bf9a84c4b1201504703dc002018af 100644
 3--- a/plugins/jump/jump.plugin.zsh
 4+++ b/plugins/jump/jump.plugin.zsh
 5@@ -30,13 +30,13 @@ unmark() {
 6 
 7 marks() {
 8 	local link max=0
 9-	for link in $MARKPATH/{,.}*(@); do
10+	for link in $MARKPATH/{,.}*(@N); do
11 		if [[ ${#link:t} -gt $max ]]; then
12 			max=${#link:t}
13 		fi
14 	done
15 	local printf_markname_template="$(printf -- "%%%us " "$max")"
16-	for link in $MARKPATH/{,.}*(@); do
17+	for link in $MARKPATH/{,.}*(@N); do
18 		local markname="$fg[cyan]${link:t}$reset_color"
19 		local markpath="$fg[blue]$(readlink $link)$reset_color"
20 		printf -- "$printf_markname_template" "$markname"
21@@ -53,7 +53,7 @@ compctl -K _completemarks unmark
22 _mark_expansion() {
23 	setopt localoptions extendedglob
24 	autoload -U modify-current-argument
25-	modify-current-argument '$(readlink "$MARKPATH/$ARG")'
26+	modify-current-argument '$(readlink "$MARKPATH/$ARG" || echo "$ARG")'
27 }
28 zle -N _mark_expansion
29 bindkey "^g" _mark_expansion