summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-08-21 15:53:00 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-08-21 15:53:00 +0000
commitc0e501d8a53c1bc29f48c1e7cd94d6eb9601bb54 (patch)
tree2a2c0f4c60e62ba7f99508dd2a308a9bc13df7ac /Completion/Unix
parent46c4588a2b52262353a83d0284bcf7160f8cf5cd (diff)
downloadzsh-c0e501d8a53c1bc29f48c1e7cd94d6eb9601bb54.tar.gz
zsh-c0e501d8a53c1bc29f48c1e7cd94d6eb9601bb54.tar.xz
zsh-c0e501d8a53c1bc29f48c1e7cd94d6eb9601bb54.zip
Alexey I. Froloff: 25459: add list-dirs-first style.
Also doc.
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Type/_files17
1 files changed, 17 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index a3545cb54..4615a60e7 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -39,6 +39,23 @@ if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then
       pats=( "$pats[@]" " ${i}:files " )
     fi
   done
+elif zstyle -t ":completion:${curcontext}:" list-dirs-first; then
+  if [[ "$type" = *g* ]]; then
+
+    # add `^-/' after `#q' glob qualifier if not there already
+    if [[ "$glob" = (#b)(*\(\#q)(*\)) ]]; then
+      [[ $match[2] != \^-/* ]] &&
+      glob="${match[1]}^-/,${match[2]}"
+    else
+      glob="$glob(#q^-/)"
+    fi
+
+    pats=( " *(-/):directories:directories ${glob//:/\\:}:globbed-files" )
+  elif [[ "$type" = */* ]] then
+    pats=( '*(-/):directories ' '*:all-files ' )
+  else
+    pats=( '*(-/):directories:directories *(^-/):other-files ' )
+  fi
 else
   if [[ "$type" = *g* ]]; then