zsh-users
 help / color / mirror / code / Atom feed
From: Shiyao Ma <i@introo.me>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: How to stop dir expansion in the prompt?
Date: Tue, 4 Nov 2014 14:30:24 +0800	[thread overview]
Message-ID: <CAJQX3DzO+M4E7saUp1dBWGmrUYws3vYRASj=Bq2Euj7vRd6Qkg@mail.gmail.com> (raw)
In-Reply-To: <141103194346.ZM32278@torch.brasslantern.com>

Thanks.
Really a right direction.

I now set :
zstyle ':vcs_info:*' nvcsformats "%d" ""


To replace $HOME with ~, I do this:
PROMPT="%(?.${success_color}.${failure_color})${SSH_TTY:+[%n@%m]}%B%${max_path_chars}<...<"'${${vcs_info_msg_0_%%}/#$HOME/~}'"%<<%(!.${root_char}.${user_char})%b%f
"

But it doesn't work as if the replace never happened.
(Does zsh support nested variable expansion?)

Where am I doing wrong?


Regards

2014-11-04 11:43 GMT+08:00 Bart Schaefer <schaefer@brasslantern.com>:
> On Nov 4, 11:23am, Shiyao Ma wrote:
> }
> } If I cd to a directory like ~/.virtualenvs, the prompt will show as
> } ~WORKON_HOME.
> }
> } I wonder, is there a option to disable the auto expansion?
>
> That expansion is the %~ prompt replacement, so one way to avoid this
> is to change
>
>     zstyle ':vcs_info:*' nvcsformats "%~" ""
>
> to
>
>     zstyle ':vcs_info:*' nvcsformats "%2d" ""
>
> or similar.
>
> If this is unsatisfactory, you should
>
>     unsetopt AUTO_NAME_DIRS
>
> and possibly also
>
>     unsetopt CDABLE_VARS
>
> unless you are actually using those features.  There's no way to disable
> the action of %~ on named directories once a named directory entry is
> created.



-- 

吾輩は猫である。ホームーページはhttp://introo.me。


  reply	other threads:[~2014-11-04  6:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04  3:23 Shiyao Ma
2014-11-04  3:43 ` Bart Schaefer
2014-11-04  6:30   ` Shiyao Ma [this message]
2014-11-04  7:36     ` Bart Schaefer
2014-11-04  9:42       ` Shiyao Ma
2014-11-04 16:43         ` Bart Schaefer
2014-11-05  1:27           ` Shiyao Ma

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='CAJQX3DzO+M4E7saUp1dBWGmrUYws3vYRASj=Bq2Euj7vRd6Qkg@mail.gmail.com' \
    --to=i@introo.me \
    --cc=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).