diff options
author | Thomas Hipp <thomashipp@gmail.com> | 2013-09-18 13:37:36 +0200 |
---|---|---|
committer | Thomas Hipp <thomashipp@gmail.com> | 2013-09-18 17:13:12 +0200 |
commit | 91b6a6b5a496d7e7f3702040401cd99fd609514d (patch) | |
tree | 18bd66ba52cdb22480683c7469c411e0f041c64e /plugins/jump | |
parent | b51c2a0d0b0af68d4b2b70b922f7d56a14a23dcc (diff) | |
download | zsh-91b6a6b5a496d7e7f3702040401cd99fd609514d.tar.gz zsh-91b6a6b5a496d7e7f3702040401cd99fd609514d.tar.bz2 zsh-91b6a6b5a496d7e7f3702040401cd99fd609514d.zip |
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.
Diffstat (limited to 'plugins/jump')
-rw-r--r-- | plugins/jump/jump.plugin.zsh | 8 |
1 files changed, 7 insertions, 1 deletions
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 |