diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index 8b1bc883..1d89af00 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