summary refs log tree commit diff
path: root/Completion/Core
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-03 11:32:59 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-03 11:32:59 +0000
commit0956e0339aea01fa309ba590c0b483d5a7d5d4b6 (patch)
tree116cca91e0f62c60cf69fa1274a025bf28ca969a /Completion/Core
parentffaba98e725982bcfce445ec910ad015cee05011 (diff)
downloadzsh-0956e0339aea01fa309ba590c0b483d5a7d5d4b6.tar.gz
zsh-0956e0339aea01fa309ba590c0b483d5a7d5d4b6.tar.xz
zsh-0956e0339aea01fa309ba590c0b483d5a7d5d4b6.zip
Handle directory stack entries
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_path_files17
1 files changed, 17 insertions, 0 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index ac6fcf604..2c5362e17 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -170,6 +170,23 @@ if [[ "$pre[1]" = \~ ]]; then
     realpath="${userdirs[$linepath]%/}/"
   elif (( $+nameddirs[$linepath] )); then
     realpath="${nameddirs[$linepath]%/}/"
+  elif [[ "$linepath" = [-+][0-9]## ]]; then
+    if [[ "$linepath" = -* ]]; then
+      tmp=$(( $#dirstack $linepath ))
+    else
+      tmp=$linepath[2,-1]
+    fi
+    [[ -o pushdminus ]] && tmp=$(( $#dirstack - $tmp ))
+    if (( ! tmp )); then
+      realpath=$PWD/
+    elif [[ tmp -le $#dirstack ]]; then
+      realpath=$dirstack[tmp]/
+    else
+      _message 'not directory stack entries'
+      return 1
+    fi
+  elif [[ "$linepath" = [-+] ]]; then
+    realpath=${~:-\~$linepath}/
   else
     _message "unknown user \`$linepath'"
     return 1