Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: dabbrev like feature for zsh
- X-seq: zsh-workers 21057
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: dabbrev like feature for zsh
- Date: Wed, 23 Mar 2005 12:05:18 +0000
- Cc: Stefan Reichör <stefan@xxxxxxxxx>
- In-reply-to: <m03bumzufa.fsf@xxxxxxxxxxxxxxxxxxxx>Comments: In reply to Stefan Reichör <stefan@xxxxxxxxx> "dabbrev like feature for zsh" (Mar 23, 8:35am)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <m03bumzufa.fsf@xxxxxxxxxxxxxxxxxxxx>
On Mar 23, 8:35am, Stefan Reichör wrote:
} Subject: dabbrev like feature for zsh
}
} By googling I found the following settings:
Don't believe everything you Google.
} zstyle ':completion:*:history-words' stop yes
} zstyle ':completion:*:history-words' list false
Those two are OK (though probably for the wrong reason), but ...
} zstyle ':completion:*:history-words' remove-all-dups yes
} zstyle ':completion:*:history-words' menu yes
... those two are wrong.
} The remove-all-dups should remove the duplicated entries - shouldn't it?
It does, if you use the right context.
The reason this is so odd is because the first two styles are for the
_history_complete_word widget itself; if written out more fully, they
would be:
zstyle ':completion:history-words:*:history-words' stop yes
zstyle ':completion:history-words:*:history-words' list false
Thus, "when completing history words using the special widget that only
completes history words, don't cycle the history and don't list."
However, you have to read the style right-to-left and the sentence left-
to-right. "When completing history words" is the :history-words on the
end of the style, and "using the special widget" is in the middle. I'm
not sure why the _history_complete_word widget bothers to append that
extra qualifier to the end of the context -- what else might it be
completing, if not history words? -- but it does.
The other two styles are not defined by the widget, they're defined by
the _history completer which can be used in other places in completion
Those styles don't have the extra :history-words on the end, which is
perhaps something that should be changed in _history, but thus it is.
zstyle ':completion:history-words:*' remove-all-dups yes
zstyle ':completion:history-words:*' menu yes
"When completing anything using the using the special widget that only
completes history words, remove all duplicate history words and use
menu completion."
There, the "duplicate history words" (rather than duplicates in general)
is implicit, because the only completer that recognizes remove-all-dups
is the one that generates history words as possible matches.
This is contrasted with:
zstyle ':completion:*' remove-all-dups yes
"When completing anything for any reason, remove all duplicate history
words."
By using ":completion:history-words:*" you would choose to have duplicate
history words removed when using M-/ but NOT removed when using TAB, if
you ever added _history to your completer zstyle.
Confused enough yet?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author