4

I'd like to change this behavior:

❯ les file.txt zsh: correct 'les' to 'ls' [nyae]? 

To this:

❯ les file.txt zsh: correct 'les' to 'less' [nyae]? 

What's the simplest way to do this? I'm looking to retain the autocorrection but revise it a bit, so alias les=less is not the kind of solution I seek.

3
  • You will likely have to write your own function to achieve this... I doubt that the "ROI" for writing such a function is worth the effort. Commented Dec 30, 2023 at 12:01
  • I think your question has a typo in the second block: do you mean that you want zsh to correct 'les' to 'less'? Both blocks read the same at present. Commented Dec 30, 2023 at 22:09
  • Yup, corrected. Thanks! Commented Dec 31, 2023 at 17:28

1 Answer 1

2

You can set

CORRECT_IGNORE=ls 

And then, auto-correct will never offer ls as a correction (even for sl for instance).

I find that if I do that, it now offers lex as a correction for les. Then I need CORRECT_IGNORE='(ls|lex)' in order to be offered less when entering les.

Other than that (and disabling it altogether with set +o correct), I'm not aware of any other way to tune the auto-corrector.

If you find yourself typing les in place of less often, you can always add a alias les=less.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.