diff options
author | Robby Russell <robby@planetargon.com> | 2014-11-06 09:13:56 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2014-11-06 09:13:56 -0800 |
commit | ed011228044f8835c71da958839112b617fdd72e (patch) | |
tree | 2cc141bad0f025da825dbd1b8ff53d47dbab1d62 /plugins/pj | |
parent | 548b9c447da5edad36a9a0b9c1174fb29230e018 (diff) | |
parent | bce74975d055529cbd186782e2fd99e6da840460 (diff) | |
download | zsh-ed011228044f8835c71da958839112b617fdd72e.tar.gz zsh-ed011228044f8835c71da958839112b617fdd72e.tar.bz2 zsh-ed011228044f8835c71da958839112b617fdd72e.zip |
Merge pull request #1604 from franklouwers/master
Improve pj-plugin to support projects with spaces in their names + optimise code
Diffstat (limited to 'plugins/pj')
-rw-r--r-- | plugins/pj/pj.plugin.zsh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index ba3765b83..f9cbddf1a 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -18,8 +18,11 @@ function pj() { file=$1 if [[ "open" == "$file" ]] then - file=$2 + shift + file=$* cmd=(${(s: :)EDITOR}) + else + file=$* fi for project in $PROJECT_PATHS; do @@ -36,7 +39,11 @@ function pj() { alias pjo="pj open" function _pj () { - compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'` + # might be possible to improve this using glob, without the basename trick + typeset -a projects + projects=($PROJECT_PATHS/*) + projects=$projects:t + _arguments '*:file:($projects)' } compdef _pj pj |