zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Directory stack completion system
Date: Sun, 19 Jul 2015 10:16:30 -0700	[thread overview]
Message-ID: <150719101630.ZM12567@torch.brasslantern.com> (raw)
In-Reply-To: <1ba043ce.69e6ad8b.55ab8974.34833@prokonto.pl>

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


  reply	other threads:[~2015-07-19 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-19 11:26 rooom
2015-07-19 17:16 ` Bart Schaefer [this message]
2015-07-19 17:38   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150719101630.ZM12567@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).