about summary refs log tree commit diff
path: root/Completion/Base/Completer
diff options
context:
space:
mode:
authorMarlon Richert <marlon.richert@gmail.com>2021-03-21 17:24:49 +0200
committerOliver Kiddle <opk@zsh.org>2021-03-31 01:20:36 +0200
commit07a30613f0b0a5b782d30dbeb46df8382f8a4e2a (patch)
tree3593be740c30bfe909dddffc0be9e842415c796b /Completion/Base/Completer
parent5d0bb152ef1486e1b38326e37e91e98295bc6946 (diff)
downloadzsh-07a30613f0b0a5b782d30dbeb46df8382f8a4e2a.tar.gz
zsh-07a30613f0b0a5b782d30dbeb46df8382f8a4e2a.tar.xz
zsh-07a30613f0b0a5b782d30dbeb46df8382f8a4e2a.zip
48214: add file types to _expand completions, so they can be colored through complist
Diffstat (limited to 'Completion/Base/Completer')
-rw-r--r--Completion/Base/Completer/_expand9
1 files changed, 5 insertions, 4 deletions
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index def522a76..86b4ac6e4 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -11,7 +11,7 @@ setopt localoptions nonomatch
 
 [[ _matcher_num -gt 1 ]] && return 1
 
-local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre
+local exp word sort expr expl subd pref suf=" " force opt asp tmp opre pre epre
 local continue=0
 
 (( $# )) &&
@@ -214,9 +214,10 @@ else
 	normal=( "$normal[@]" "$i" )
       fi
     done
-    (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ -a dir
-    (( $#space ))  && compadd "$expl[@]" -UQ -qS " " -a space
-    (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal
+    pref="${${word:#[~/]*}:+$PWD}/"
+    (( $#dir ))    && compadd "$expl[@]" -fW "$pref" -UQ -qS/ -a dir
+    (( $#space ))  && compadd "$expl[@]" -fW "$pref" -UQ -qS " " -a space
+    (( $#normal )) && compadd "$expl[@]" -fW "$pref" -UQ -qS "" -a normal
   fi
   if _requested all-expansions; then
     local disp dstr