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.
This commit is contained in:
Thomas Hipp 2013-09-18 13:37:36 +02:00
parent b51c2a0d0b
commit 91b6a6b5a4

View File

@ -38,7 +38,13 @@ marks() {
} }
_completemarks() { _completemarks() {
if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) 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 jump
compctl -K _completemarks unmark compctl -K _completemarks unmark