From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7187 invoked by alias); 18 Nov 2017 18:05:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42029 Received: (qmail 26464 invoked by uid 1010); 18 Nov 2017 18:05:44 -0000 X-Qmail-Scanner-Diagnostics: from aok120.rev.netart.pl by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(85.128.245.120):SA:0(-1.9/5.0):. Processed in 11.583368 secs); 18 Nov 2017 18:05:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: psprint@zdharma.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new using ClamAV (7) Date: Sat, 18 Nov 2017 19:05:25 +0100 From: Sebastian Gniazdowski To: zsh-workers@zsh.org Message-ID: Subject: Feature request =?utf-8?Q?=E2=80=93=C2=A0substitutions_?=similar to +, -, :+, :- X-Mailer: Airmail (442) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello I constantly save lines of code by using +,-,:+,:- substitutions. Example= : there's =22=24theme=5Bbutton-color=5D=22, which can be empty, so no nee= d for =24reset=5Fcolor. Solution:=C2=A0 button=5Ftxt=3D=22=24theme=5Bbutton-color=5DMy Button=24=7Btheme=5Bbutton= -color=5D:+=24reset=5Fcolor=7D=22 Sometimes I was needing similar substitution but checking for concrete va= lue. So, substitute =22abc=22 if value is =22xyz=22, etc. However it's a = hard time to find a place in the substitution where the value could be sp= ecified. However, a step in right direction would be boolean test for 1 o= r 0, or maybe like in zstyle also for true/false, yes/no. So this would be possible: echo =22I'm =24=7B=24=7Btheme=5Buse-name=5D:&Patrick=7D:-a subscriber=7D,= hello.=22 :& would substitute on =221=22, not substitute otherwise, so also not for= =22=22. Analogically :=5E would substitute on =220=22. Those substitutio= ns would definitely often save lines of code. -- =20 Sebastian Gniazdowski psprint /at/ zdharma.org