Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: option for completion file-sort to follow symlinks



I have all my dotfiles under version control in a separate directory,
and ~/.zshrc ~/.zalias etc are symlinks to the version controlled
directory.

So even when I have: "zstyle ':completion:*:*:*:*' file-sort date"
doing vi ~/.z<Tab> sorts the files based on symlink modtime and not
the file that its pointing to.

The one line patch included into the end of this email adds one
additional option `follow' to the file-sort, which makes it follow
symlinks.

# follow symlinks when sorting
zstyle ':completion:*:*:*:*' file-sort date follow

Regards,
  Max


Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.25
diff -u -r1.25 _path_files
--- Completion/Unix/Type/_path_files	7 Mar 2006 12:52:27 -0000	1.25
+++ Completion/Unix/Type/_path_files	29 Jul 2008 02:43:12 -0000
@@ -113,6 +113,7 @@
   *)                  sort=on;;
   esac
   [[ "$tmp1" = *rev* ]] && sort[1]=O
+  [[ "$tmp1" = *follow* ]] && sort="-$sort"
 
   if [[ "$sort" = on ]]; then
     sort=



Messages sorted by: Reverse Date, Date, Thread, Author