From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28682 invoked by alias); 28 Feb 2015 06:27:24 -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: 19934 Received: (qmail 28234 invoked from network); 28 Feb 2015 06:27:22 -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:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=bo2PngnHKwJ8wuUU02Dc9aQxdVuaLtrqYYWk8eAEbDg=; b=CLP12XohaIct+De28BnyeBZct+ZyqC28254Eba5QjYzkZBRDxMgDuOkVLJhakoHuaX oNnYX11q/MHJcsUtkCQLBlFLTbr2dqes9o4IEEzIgto+iC6sb1zWoaSW6xLxFIu2LItp LWGzKRwpkUj8le/NxpyGg4/cLVhn+ohPvZs2+lP0Q59KY3zyoeyJNfZy9t0Ni6EAmubS gpwBzY59TJLtgNAMMC8Sam4xsRU1Uw3w+r5fRdvlmJJKkPKMzJ6dTFBD99mMRudXntKU NjswC0/ZGGE4CpF1gEDUONrLqTzQmUI7xPeuwKTeU9nJGDQ4NNnd+Qv1GtaQ7MXSh2Z5 Dz0Q== X-Gm-Message-State: ALoCoQkOfQESK4Mkm94xLMJDN8sfA0tBsjJR8RFX4BvCVMHxgLxbGLeWhoviMj3uDcF6PccpfBrs X-Received: by 10.202.175.132 with SMTP id y126mr11834719oie.121.1425104839436; Fri, 27 Feb 2015 22:27:19 -0800 (PST) From: Bart Schaefer Message-Id: <150227222716.ZM20870@torch.brasslantern.com> Date: Fri, 27 Feb 2015 22:27:16 -0800 In-Reply-To: <20150227220258.GA22603@panix.com> Comments: In reply to rj "Re: Is it possible to get a 4-char year in WATCHFMT" (Feb 27, 5:02pm) References: <20150227213906.GA25112@panix.com> <20150227220258.GA22603@panix.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Is it possible to get a 4-char year in WATCHFMT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 27, 5:02pm, rj wrote: } } On Fri 27 at 04:39 PM -0500, rj wrote: } } > "%D" in WATCHFMT prints a 2-char year. Is there a way one can get a } > 4-char year? Does WATCHFMT take strftime sequences? } } Actually, I see on one of my logins I was able to do it this way: } } %D{%A %Y-%m-%d} } } Though I don't remember what "%A" does, and it isn't listed as an available } sequence in the "WATCHFMT" setion in man zshall. Although the doc was never updated to say so, %D in WATCHFMT behaves the same way as %D in PROMPT. So you can follow it with a strftime format enclosed in curly braces. It also supports the zsh format extensions described for prompt escapes. It's been that way for at least 16 years without ever getting doc'd. diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index 273be21..d044f87 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -1548,6 +1548,12 @@ The date in `var(mm)tt(/)var(dd)tt(/)var(yy)' format. item(tt(%D))( The date in `var(yy)tt(-)var(mm)tt(-)var(dd)' format. ) +item(tt(%D{)var(string)tt(}))( +The date formatted as var(string) using the tt(strftime) function, with +zsh extensions as described by +ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\ +ifnzman(noderef(Prompt Expansion)). +) item(tt(%LPAR())var(x)tt(:)var(true-text)tt(:)var(false-text)tt(RPAR()))( Specifies a ternary expression. The character following the var(x) is