/etc/zsh/zshrc: generic file completion, function sll
authorMichael Prokop <mika@grml.org>
Fri, 13 Apr 2007 15:36:19 +0000 (17:36 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 13 Apr 2007 15:36:19 +0000 (17:36 +0200)
debian/changelog
etc/zsh/zshrc

index 853f5bb..3ce6b17 100644 (file)
@@ -1,3 +1,12 @@
+grml-etc-core (0.2.43) unstable; urgency=low
+
+  * /etc/zsh/zshrc:
+    - applied patch by ft for generic file completion (thanks!)
+    - added function sll (list symlinks in more details), thanks
+      for the code base, Manuel Fuhr!
+
+ -- Michael Prokop <mika@grml.org>  Fri, 13 Apr 2007 17:35:15 +0200
+
 grml-etc-core (0.2.42) unstable; urgency=low
 
   * Update and cleanup /etc/apt/sources.list.grml. Thanks for hints,
index a9fe3ce..153f61d 100644 (file)
@@ -810,20 +810,20 @@ grmlcomp() {
     }
 # some people don't like the automatic correction - so run 'NOCOR=1 zsh' to deactivate it
   if [[ -n "$NOCOR" ]] ; then
-    zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete
+    zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _files
     setopt nocorrect # do not try to correct the spelling if possible
   else
-#    zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _correct _approximate
+#    zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _correct _approximate _files
     setopt correct  # try to correct the spelling if possible
     zstyle -e ':completion:*' completer '
         if [[ $_last_try != "$HISTNO$BUFFER$CURSOR" ]]; then
           _last_try="$HISTNO$BUFFER$CURSOR"
-          reply=(_complete _match _prefix)
+          reply=(_complete _match _prefix _files)
         else
           if [[ $words[1] = (rm|mv) ]]; then
-            reply=(_complete)
+            reply=(_complete _files)
           else
-            reply=(_oldlist _expand _force_rehash _complete _correct _approximate)
+            reply=(_oldlist _expand _force_rehash _complete _correct _approximate _files)
           fi
         fi'
   fi
@@ -974,6 +974,20 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
   }
   compdef _functions reload freload
 
+  # list symlinks in detail (more detailed version of 'readlinkg -f')
+  sll() {
+     if [ -z "$1" ] ; then
+        print 'Usage: sll <file>' >&2
+        return 1
+     fi
+     for i in $* ; do
+         ls --color=auto -la "$i"
+         if [ -L "$i" ] ; then
+            sll $(readlink "$i")
+         fi
+     done
+  }
+
   # fast manual access
   if type -p qma &>/dev/null ; then
      manzsh()  { qma zshall "$1" }