Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Add CORRECT_NOCOMPSYS option



Richard Hartmann <richih.mailinglist@xxxxxxxxx>:
> On Wed, May 27, 2009 at 21:12, Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> 
> > But in the same vein, what I really want is a way to configure the
> > behavior for functions, variables, etc. beginning with "_" to be like
> > filenames beginning with ".": completion should work if I have
> > explicitly typed the leading "_", but even substring matching should
> > not *generate* a leading "_".
> 
> I think this is a good explanation of what, imo, the final goal should
> be.

The final goal for what?
For completion (without looking at it in detail), I think what Greg
wants could be done with the _ignore completer. At least I got
something similar for a set of commands:

zstyle ':completion:*:complete:-command-::commands' \
    ignored-patterns 'aptitude-*'

Because I never want to complete the commands named
aptitude-create-state-bundle or aptitude-run-state-bundle.

With the above style 'apti<tab>' always completes to 'aptitude'.
But 'aptitude-<tab>' offers the two commands mentioned earlier, too,
in case I really really want one of them.

My completer style looks like this:
zstyle ':completion:*' completer _expand _complete _ignored _approximate

Where _ignore is the important bit.


That's completion. Correction is a whole other deal. And
CORRECT_IGNORE is just for that. So you don't get completion functions
as _suggestions_ for _correction_. (E.g. you don't have vim installed
but you try to execute it, chances are that correction will ask you
'zsh: correct 'vim' to '_vim'? (YNEA)' - which is utterly useless and
annoying).

So, when you're talking about a final goal, IMHO, CORRECT_IGNORE is
quite a reasonable solution. And it *only* works on words in command
position (aka. the stuff 'setopt correct' does - words corrected by
'setopt correct_all' are not touched at all).

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



Messages sorted by: Reverse Date, Date, Thread, Author