91b6a6b5a496d7e7f3702040401cd99fd609514d

Author
Thomas Hipp <thomashipp@gmail.com>
Committer
Thomas Hipp <thomashipp@gmail.com>
Date

Message

jump plugin: fix autocompletion with single mark

Autocompletion fails if there's only one mark, since the ls command
will not display the parent directory with the trailing colon.
Handling the single mark case separately and validating the symlink
explicitly, resolves the issue.

Diff

 1diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
 2index a3c5cf8c35a340159515fbc5cefa02e322a85ea2..5096879d8dde01cf0f389bb368a15a5108e79dbe 100644
 3--- a/plugins/jump/jump.plugin.zsh
 4+++ b/plugins/jump/jump.plugin.zsh
 5@@ -38,7 +38,13 @@ marks() {
 6 }
 7 
 8 _completemarks() {
 9-	reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g'))
10+	if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then
11+		reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g'))
12+	else
13+		if readlink -e "${MARKPATH}"/* &>/dev/null; then
14+			reply=($(ls "${MARKPATH}"))
15+		fi
16+	fi
17 }
18 compctl -K _completemarks jump
19 compctl -K _completemarks unmark