Commit 9674a96b authored by Frank Louwers's avatar Frank Louwers
Browse files

[pj-plugin] delete ugly ls -l | awk print $9 thing to use something not...

[pj-plugin] delete ugly ls -l | awk print $9 thing to use something not depending on date format + add support for projects with spaces in them
parent fce68bbb
...@@ -18,8 +18,11 @@ function pj() { ...@@ -18,8 +18,11 @@ function pj() {
file=$1 file=$1
if [[ "open" == "$file" ]] then if [[ "open" == "$file" ]] then
file=$2 shift
file=$*
cmd=(${(s: :)EDITOR}) cmd=(${(s: :)EDITOR})
else
file=$*
fi fi
for project in $PROJECT_PATHS; do for project in $PROJECT_PATHS; do
...@@ -36,7 +39,14 @@ function pj() { ...@@ -36,7 +39,14 @@ function pj() {
alias pjo="pj open" alias pjo="pj open"
function _pj () { 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
foreach i ($PROJECT_PATHS/*)
do
projects+=`basename $i`
done
_arguments '*:file:($projects)'
} }
compdef _pj pj compdef _pj pj
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment