summaryrefslogtreecommitdiff
path: root/plugins/pj/pj.plugin.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2016-08-11 01:35:45 +0200
committerMarc Cornellà <marc.cornella@live.com>2016-08-16 08:32:43 +0200
commitc9c11d605f28c0a93ad34ba2a40120ea6e0f9dc0 (patch)
tree5801dcefcb8ce36b108169ff0bfd8b019de0b876 /plugins/pj/pj.plugin.zsh
parent26bef0942ba8acbe3ad2005500efd8f47e1edc36 (diff)
downloadzsh-c9c11d605f28c0a93ad34ba2a40120ea6e0f9dc0.tar.gz
zsh-c9c11d605f28c0a93ad34ba2a40120ea6e0f9dc0.tar.bz2
zsh-c9c11d605f28c0a93ad34ba2a40120ea6e0f9dc0.zip
Fix _pj completion function
- `$PROJECT_PATHS/*` wasn't working correctly. You have to iterate over its elements in order to use globbing with it. - The `$projects:t` line wasn't necessary if we used `compadd`. - `compadd` better supports destructuring an array with spaces in some of its elements.
Diffstat (limited to 'plugins/pj/pj.plugin.zsh')
-rw-r--r--plugins/pj/pj.plugin.zsh11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
index 8b1bc883f..1d89af00b 100644
--- a/plugins/pj/pj.plugin.zsh
+++ b/plugins/pj/pj.plugin.zsh
@@ -24,10 +24,13 @@ function pj () {
}
function _pj () {
- # might be possible to improve this using glob, without the basename trick
+ emulate -L zsh
+
typeset -a projects
- projects=($PROJECT_PATHS/*)
- projects=$projects:t
- _arguments "*:file:($projects)"
+ for basedir ($PROJECT_PATHS); do
+ projects+=(${basedir}/*(/N))
+ done
+
+ compadd ${projects:t}
}
compdef _pj pj