diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2001-04-18 16:02:50 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2001-04-18 16:02:50 +0000 |
commit | 6aa2261d52de6d3ecf2211aa5b3a465b3b1c7c45 (patch) | |
tree | 4059deaaafa0c7f7ca30f3b69022f76d4e815163 /Completion/Unix | |
parent | a924eeba12abf572e28431ae5dc0134e09974b08 (diff) | |
download | zsh-6aa2261d52de6d3ecf2211aa5b3a465b3b1c7c45.tar.gz zsh-6aa2261d52de6d3ecf2211aa5b3a465b3b1c7c45.tar.xz zsh-6aa2261d52de6d3ecf2211aa5b3a465b3b1c7c45.zip |
Tilde-path completion tweak.
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Type/_path_files | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index bc784426c..ffaf0d77f 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -190,7 +190,7 @@ eorig="$orig" # Now let's have a closer look at the string to complete. -if [[ "$pre" = *\$*/* && "$compstate[quote]" != \" ]]; then +if [[ "$pre" = *(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' ]]; then # If there is a parameter expansion in the word from the line, we try # to complete the beast by expanding the prefix and completing anything @@ -207,6 +207,7 @@ if [[ "$pre" = *\$*/* && "$compstate[quote]" != \" ]]; then donepath= prepaths=( '' ) elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then + # It begins with `~', so remember anything before the first slash to be able # to report it to the completion code. Also get an expanded version of it # (in `realpath'), so that we can generate the matches. Then remove that @@ -217,10 +218,6 @@ elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then linepath="${pre[2,-1]%%/*}" if [[ -z "$linepath" ]]; then realpath="${HOME%/}/" - elif (( $+userdirs[$linepath] )); then - realpath="${userdirs[$linepath]%/}/" - elif (( $+nameddirs[$linepath] )); then - realpath="${nameddirs[$linepath]%/}/" elif [[ "$linepath" = ([-+]|)[0-9]## ]]; then if [[ "$linepath" != [-+]* ]]; then if [[ -o pushdminus ]]; then @@ -248,8 +245,11 @@ elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then elif [[ "$linepath" = [-+] ]]; then realpath=${~:-\~$linepath}/ else - _message "unknown user \`$linepath'" - return 1 + eval "realpath=~${linepath}/" 2>/dev/null + if [[ -z "$realpath" ]]; then + _message "unknown user \`$linepath'" + return 1 + fi fi linepath="~${linepath}/" [[ "$realpath" = "$linepath" ]] && return 1 |