29 Jul 04:44
PATCH: option for completion file-sort to follow symlinks
From: Max Mikhanosha <max <at> openchat.com>
Subject: PATCH: option for completion file-sort to follow symlinks
Newsgroups: gmane.comp.shells.zsh.user
Date: 2008-07-29 02:46:12 GMT
Expires: This article expires on 2008-08-12
Subject: PATCH: option for completion file-sort to follow symlinks
Newsgroups: gmane.comp.shells.zsh.user
Date: 2008-07-29 02:46:12 GMT
Expires: This article expires on 2008-08-12
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=
RSS Feed