zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
Cc: zsh-users@zsh.org
Subject: Re: Safety guards for typos
Date: Mon, 24 Jan 2022 05:57:58 +0000	[thread overview]
Message-ID: <20220124055758.GB31935@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <Ye3wIGuWrDpsIT2I@fullerene.field.pennock-tech.net>

Phil Pennock wrote on Sun, Jan 23, 2022 at 19:17:36 -0500:
> Instead of:
> 
>     mv *(.) old-2022-01-23/
> 
> I typed:
> 
>     mv *() old-2021-01-24/

A syntax highlighting plugin <disclaimer>which I co-maintain</disclaimer>
would highlight the two cases differently:

[[[
% tests/generate.zsh 'mv *(.) foo/' main users-27486a
⋮
BUFFER=$'mv *(.) foo/'

expected_region_highlight=(
  '1 2 command' # mv
  '4 7 default' # *(.)
  '4 4 globbing' # *
  '9 12 default' # foo/
)
% tests/generate.zsh 'mv *() bar/' main users-27486b
⋮
BUFFER=$'mv *() bar/'

expected_region_highlight=(
  '1 2 command' # mv
  '4 4 default' # *
  '4 4 globbing' # *
  '5 6 reserved-word' # ()
  '8 11 unknown-token' # bar/
)
% 
]]]

So, in the second case you'd see the «()» in yellow and the directory
name in red (or, if AUTO_CD is set, green).

https://github.com/zsh-users/zsh-syntax-highlighting/

Cheers,

Daniel


      parent reply	other threads:[~2022-01-24  5:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24  0:17 Phil Pennock
2022-01-24  1:46 ` Mikael Magnusson
2022-01-24  2:01   ` Phil Pennock
2022-01-24  2:11   ` Phil Pennock
2022-01-24  2:51     ` Bart Schaefer
2022-01-24  5:57 ` Daniel Shahaf [this message]

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=20220124055758.GB31935@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-users@zsh.org \
    --cc=zsh-workers+phil.pennock@spodhuis.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).