diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-15 18:20:19 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-15 18:20:19 +0000 |
commit | 04a89199d02a3ee6c4b3d89a6c782bdb0a4f1bc8 (patch) | |
tree | 2215f99f95d55660fc939a029bf965c454d080b5 /Completion/Builtins/_cd | |
parent | 7a0415cfd70a02b2280d27556c6c54cef1c86e1a (diff) | |
download | zsh-04a89199d02a3ee6c4b3d89a6c782bdb0a4f1bc8.tar.gz zsh-04a89199d02a3ee6c4b3d89a6c782bdb0a4f1bc8.tar.xz zsh-04a89199d02a3ee6c4b3d89a6c782bdb0a4f1bc8.zip |
zsh-3.1.5-pws-12 zsh-3.1.5-pws-12
Diffstat (limited to 'Completion/Builtins/_cd')
-rw-r--r-- | Completion/Builtins/_cd | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Completion/Builtins/_cd b/Completion/Builtins/_cd index 65ce7f293..9a58effe0 100644 --- a/Completion/Builtins/_cd +++ b/Completion/Builtins/_cd @@ -24,7 +24,7 @@ if [[ -position 3 ]]; then rep=(${~PWD/$words[2]/*}~$PWD(-/N)) # Now remove all the common parts of $PWD and the completions from this rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}}) - (( $#rep )) && compadd $rep + (( ! $#rep )) || compadd $rep elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then # pushd: just complete the numbers, but show the full directory list with # numbers. @@ -34,7 +34,8 @@ elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then # lazy to type pushd. IPREFIX=$PREFIX[1] PREFIX=$PREFIX[2,-1] - local list lines + local list lines ret=1 + # get the list of directories with their canonical number lines="$(dirs -v)" # turn the lines into an array, removing the current directory @@ -52,9 +53,11 @@ elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then lines="${(F)list}" # get the array of numbers only list=(${list%%[ ]*}) - compgen -y '$lines' -Q -k list - [[ -z $compstate[list] ]] && compstate[list]=list - [[ -n $compstate[insert] ]] && compstat[insert]=menu + compgen -y '$lines' -Q -k list && ret=0 + [[ -z $compstate[list] ]] && compstate[list]=list && ret=0 + [[ -n $compstate[insert] ]] && compstat[insert]=menu && ret=0 + + return ret elif [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then _path_files -W cdpath -/ else |