From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11738 invoked by alias); 1 Jun 2018 15:03:29 -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: 42914 Received: (qmail 25021 invoked by uid 1010); 1 Jun 2018 15:03:29 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi0-f54.google.com 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(209.85.218.54):SA:0(-1.9/5.0):. Processed in 1.118424 secs); 01 Jun 2018 15:03:29 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=nDls2kfKezCZTEkdxpJRyRNxGkTqb0qiiC0vNZ4RaYU=; b=Cgjf2j17DC2ld6yAovnlJszEuep7ModfpdSqwCIMLZ++CrgeFHRR0kpQWz1p9kAIwN uncswh1T7yKFbJ1lZ/SVASDcKkYFL1AQerq3ygpAAzT7h5CHRosxzX3Ctyx7+HXWVE2q qMxxwkpsbkdouCboscv78iyySgzCyxGNVOb0MHAhMbg8UxB/ICIOh8SNqd+zRFI0upb4 ZYw7Otv/KNUaGG0GBm2UcZcKQ4fzL0ti5xRGBMrALHwW6i8yKPvHHRPB0lL4WgQ0c+68 SgomsM1t43S25ppuYxcsImaBOxfdMrzftrjM/iQS/KM08fdxtsvbRFT08u5LXygU3uFu z3Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=nDls2kfKezCZTEkdxpJRyRNxGkTqb0qiiC0vNZ4RaYU=; b=MPernWW0emxxhp9E70E/OGGH2uN3N8vEwPzaKvOjGOjxlMjPci3sHY8O8FJOUpSTQ1 l4wqa6dv2S4muIPXXWzO5kPwLd9xG1zp3Q52s1dShoj1+gkcVDvMPpUwCNydoSYRgj8Q VcasgpqFIRtH9KiGlLzlvt+OQPmVOMx12nhlyZHIRXInlGXhrqnWaMlQ/lhs0VA6sBpm ljhStqjYGW8wUImGypf+GbfmkgSWFKbp5h2q4daup6O1sqglsyGqDBSgCJWiNOzyuWrx Z3o+u2WxA4ReXitGyDBjSQqkIrgxGACtFpWvTrYuzwwfybKQZwACAmSUA3rax9VwRvhW bDqQ== X-Gm-Message-State: APt69E2t36X3vDuy7W6zKMO2/xaLJ/gcT1oYlZKzlAABCfa/9C0theJq IIw+B9uee3jm1Y4/AMTsrK4XbV9vusWAVyVCdVQeMQ== X-Google-Smtp-Source: ADUXVKI3NnEByL9l22Sw8Yl5DfOzFqwrCczjOciH+FoclJd9z7DQiXpg8qCsCW/nqfW7HKolUrD8ho+y/9iQphGIhUg= X-Received: by 2002:aca:5bc5:: with SMTP id p188-v6mr6056638oib.295.1527865405065; Fri, 01 Jun 2018 08:03:25 -0700 (PDT) MIME-Version: 1.0 From: Sebastian Gniazdowski Date: Fri, 1 Jun 2018 17:03:04 +0200 Message-ID: Subject: Feature request: (z)-like flags needed for syntax-highlighting To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, (z) doesn't parse interiors of $(...) command substitution. Also, it doesn't separate $() from preceding word, e.g. $var$(echo test) will be returned as single token. Fast-syntax-highlighting does highlight $(), however with a faulty glob. This makes all this very much reality-driven, and it leads to a conclusion: a flag that will extract $( ) is needed, so that syntax-highlighting code can call itself recursively on it. ~ buf=3D'echo $(ls -1) str $(ls -a)' ~ local -a inputs=3D( "${(Z+x+)buf}" ) ~ print -rl -- $inputs 8:ls -1 21:ls -a Above presents how the new flag should work. It should return offset where $() body begins, and the body. This allows to call syntax-highlighting recursively like this (FSH code): for el in $inputs; do -fast-process $PREBUFFER "${el#*:}" $(( ${el%%:*} - 1 )) done This is a nice piece of code, which starts syntax-highlighting from given place =E2=80=93 ${el%%:*} - 1, on a short buffer ${el#*:}, causing to= an overlay of highlighting to be generated for the whole $buf. FSH does this currently but with faulty glob =E2=80=93 no way to properly handle \\\= ) and other quoting of closing ")". The reality-driven aspect is important, it would be hard to come up with this by doing abstract thinking. I think ZSH should be interested in making a beautiful, correct syntax highlighting. Check out how it looks like when $() is colorized with different theme than the rest of code: http://psprint.blinkenshell.org/cmdsubst2.png --=20 Best regards, Sebastian Gniazdowski