about summary refs log tree commit diff
path: root/Completion/Core/_path_files
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-02 09:42:05 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-02 09:42:05 +0000
commit586aaeb0861cce12a22af5bb3288c4e84b1c0bb4 (patch)
treed2ba4d41714cee418ceb22a50da63bbca6087cf7 /Completion/Core/_path_files
parentb13200b2a367d513c445dcc35e7d35b71990bcc1 (diff)
downloadzsh-586aaeb0861cce12a22af5bb3288c4e84b1c0bb4.tar.gz
zsh-586aaeb0861cce12a22af5bb3288c4e84b1c0bb4.tar.xz
zsh-586aaeb0861cce12a22af5bb3288c4e84b1c0bb4.zip
zsh-workers/7628
Diffstat (limited to 'Completion/Core/_path_files')
-rw-r--r--Completion/Core/_path_files16
1 files changed, 16 insertions, 0 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 9aebc89d0..b017d78e5 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -173,6 +173,22 @@ if [[ "$pre[1]" = \~ ]]; then
   orig="${orig#*/}"
   donepath=''
   prepaths=( '' )
+elif [[ "$pre" = *\$*/* ]]; 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
+  # after the first slash after the parameter expansion.
+  # This fails for things like `f/$foo/b/<TAB>' where the first `f' is
+  # meant as a partial path.
+
+  linepath="${(M)pre##*\$[^/]##/}"
+  realpath=${(e)~linepath}
+  [[ "$realpath" = "$linepath" ]] && return 1
+  pre="${pre#${linepath}}"
+  i="${#linepath//[^\\/]}"
+  orig="${orig[1,(in:i:)/][1,-2]}"
+  donepath=''
+  prepaths=( '' )
 else
   # If the string does not start with a `~' we don't remove a prefix from the
   # string.