From 91b6a6b5a496d7e7f3702040401cd99fd609514d Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 18 Sep 2013 13:37:36 +0200 Subject: [PATCH] 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. --- plugins/jump/jump.plugin.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index a3c5cf8c3..5096879d8 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -38,7 +38,13 @@ marks() { } _completemarks() { - reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then + reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + else + if readlink -e "${MARKPATH}"/* &>/dev/null; then + reply=($(ls "${MARKPATH}")) + fi + fi } compctl -K _completemarks jump compctl -K _completemarks unmark