5

I have the following completion:

zstyle ':completion:*' completer _complete _approximate 

As a result if I type something incorrectly and hit TAB I will see a list with corrected propositions (what I like) and at the same time misspelled word will be changed automatically at command line with first proposition (what I do not like). So how to get rid of this in-line automatic correction? I just want list of possible correction but command line should stick with original text.

1
  • Note that you can always undo the correction with Ctrl-_ Commented Aug 18, 2014 at 19:59

2 Answers 2

3

Corrections apply automatically because they are first on a group list, before original. You can change that with

zstyle ':completion:*' group-order original corrections

And the result is

enter image description here

Credit for the final solution goes to Stéphane Chazelas.

0
1

If you have:

zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' original true

Then the original is added as a possible completion (last so you can press Up) and you get a description of what's happening.

For example, pressing Tab after /usr/lco:

enter image description here

After pressing Up:

enter image description here

You can also press Ctrl+_ or Ctrl-XCtrl-U to undo the correction and cancel the completion.

3
  • I do know all of that, but my problem is not how to correct what was already corrected (undo), the real issue is with speed and efficiency. For example say I want to run xemacs so I write misspelled xen and hit <TAB>. I get whole bunch of possible corrections and my command line changes to enable. Now there are several steps which I have to do: 1. My brain need to realize what just happened (nonsensical corrections). 2. Correct back this correction (undo, C-c, whatever). 3. Write xemacs correctly. At the end of the day instead of gain half second I lost 5. Commented Aug 19, 2014 at 7:17
  • 2
    Just an idea: it is possible possible to rearrange completion group order like zstyle ':completion:*:*:-command-:*' group-order reserved-words parameters functions aliases builtins commands. Isn't correction automatically applied because it is first on the group list, before original? If yes than maybe one can swap these groups...
    – jimmij
    Commented Aug 19, 2014 at 13:31
  • 2
    @jimmij, yes, looks like zstyle ':completion:*' group-order original corrections works. Do you want to add your own answer? Commented Aug 19, 2014 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .