mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
[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
This commit is contained in:
parent
fce68bbba0
commit
9674a96b5b
1 changed files with 12 additions and 2 deletions
|
@ -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,14 @@ 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
|
||||
foreach i ($PROJECT_PATHS/*)
|
||||
do
|
||||
projects+=`basename $i`
|
||||
done
|
||||
|
||||
_arguments '*:file:($projects)'
|
||||
}
|
||||
|
||||
compdef _pj pj
|
||||
|
|
Loading…
Reference in a new issue