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

Re: Directory stack completion system



On Jul 19,  1:26pm, rooom wrote:
}
} I like "dirs" behaviour more, i.e. abbreviated form of directory
} names (with tilde), so how can I set up completion system for "cd -"
} to show "~"?

There's no zstyle for this, so the _directory_stack function has to be
edited.

The question is whether a style should be added, or whether the patch
below should simply become the default behavior.

One approach would be to change "verbose" from a boolean to a ternary 
value where the third value means "yes" and also chooses whether to
apply the (D) flag.  E.g.,

zstyle ':completion:*:directory-stack' verbose long

We could also add a keyword for whether to apply the :A modifier to
resolve symbolic links.

Other suggested approaches?


diff --git a/Completion/Zsh/Type/_directory_stack b/Completion/Zsh/Type/_directory_stack
index 8a4cf67..5162a1d 100644
--- a/Completion/Zsh/Type/_directory_stack
+++ b/Completion/Zsh/Type/_directory_stack
@@ -19,7 +19,7 @@ zstyle -s ":completion:${curcontext}:directory-stack" list-separator sep || sep=
 if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then
   # get the list of directories with their canonical number
   # and turn the lines into an array, removing the current directory
-  lines=("${dirstack[@]}")
+  lines=("${(D)dirstack[@]}")
 
   if [[ ( $PREFIX[1] = - && ! -o pushdminus ) ||
         ( $PREFIX[1] = + && -o pushdminus ) ]]; then



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