mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 05:40:08 +00:00
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.
This commit is contained in:
parent
26bef0942b
commit
c9c11d605f
1 changed files with 7 additions and 4 deletions
|
@ -24,10 +24,13 @@ function pj () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _pj () {
|
function _pj () {
|
||||||
# might be possible to improve this using glob, without the basename trick
|
emulate -L zsh
|
||||||
|
|
||||||
typeset -a projects
|
typeset -a projects
|
||||||
projects=($PROJECT_PATHS/*)
|
for basedir ($PROJECT_PATHS); do
|
||||||
projects=$projects:t
|
projects+=(${basedir}/*(/N))
|
||||||
_arguments "*:file:($projects)"
|
done
|
||||||
|
|
||||||
|
compadd ${projects:t}
|
||||||
}
|
}
|
||||||
compdef _pj pj
|
compdef _pj pj
|
||||||
|
|
Loading…
Reference in a new issue