From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25775 invoked by alias); 5 Nov 2014 01:27:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19346 Received: (qmail 26664 invoked from network); 5 Nov 2014 01:27:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2HVI/S89zWIy8/kolakgMAlH6CLF08zzdyBCmc1MZrA=; b=HJTqz8AH2PFCEnGr49mgwimdj59K0jt0/yBWQgbNqU1Om2pwm9fivgYRcSFcnZUekC 9baMnm16K24/ED2L49jX5Bzqt0YHulQSyWwieLyMCvrU8DR8zVYEFq2/9DdGXvmV/JMU uDbfyNlsB6nIy87fvo/BEZBn+XqXVa1xPHmvILNkQJMoBGblNx1x99gEGNaisb4Sy5BI bINrGTdXuZJm+yJuGuc7JGBJvV4P3Eq2nvx5SsxF703jmluPyF0N7OLGv4iUb/T7miFW MGOgLKemzLX2nCOLdtKbVGaLnZNxS2BkEfLqDrIg3rIyKakIfvVBAmv+tBzbvpg9KBWc MXMA== X-Gm-Message-State: ALoCoQkILjMefwJdKBBpQiR6bOWavHySR7Nxa4uBKa4ves+qaHS0sV+AAcRBH16TyiA9Z6r5MS91 MIME-Version: 1.0 X-Received: by 10.50.83.97 with SMTP id p1mr1784445igy.19.1415150824179; Tue, 04 Nov 2014 17:27:04 -0800 (PST) X-Originating-IP: [143.89.98.47] In-Reply-To: <141104084328.ZM1145@torch.brasslantern.com> References: <141103194346.ZM32278@torch.brasslantern.com> <141103233651.ZM32506@torch.brasslantern.com> <141104084328.ZM1145@torch.brasslantern.com> Date: Wed, 5 Nov 2014 09:27:04 +0800 Message-ID: Subject: Re: How to stop dir expansion in the prompt? From: Shiyao Ma To: Bart Schaefer Cc: zsh-users@zsh.org Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Thanks. Problem solved. 2014-11-05 0:43 GMT+08:00 Bart Schaefer : > On Nov 4, 5:42pm, Shiyao Ma wrote: > } > } When outside a vcs directory, `echo $vcs_info_msg_0_` gives %d, which > } is the same string in zstyle nvcsformat. > > Ah, of course. You want: > > PROMPT="%(?.${success_color}.${failure_color})${SSH_TTY:+[%n@%m]}%B%${max_path_chars}<...<"'${${(%)vcs_info_msg_0_}/#$HOME/~}'"%<<%(!.${root_char}.${user_char})%b%f > " > > The (%) in ${(%)vcs_info_msg_0_} tells it to do prompt expansion right > away, rather than return the format for the prompt to expand later, so > then the /#$HOME/ can do its work. > > } Yup. One minor question. No matter how many % I write, like this > } one:echo ${vcs_info_msg_0_%%%%%}, it's the same as echo > } ${vcs_info_msg_0_}. So what's % here? > > ${NAME%PATTERN} > ${NAME%%PATTERN} > If the PATTERN matches the end of the value of NAME, then > substitute the value of NAME with the matched portion deleted; > otherwise, just substitute the value of NAME. In the first form, > the smallest matching pattern is preferred; in the second form, > the largest matching pattern is preferred. > > So after the first two %%, any more % you add become the pattern, which > is unlikely to match in a directory name. > > I don't know why Julien left %% in there with no pattern after it. -- 吾輩は猫である。ホームーページはhttp://introo.me。