zsh-workers
 help / color / mirror / code / Atom feed
* dabbrev like feature for zsh
@ 2005-03-23  7:35 Stefan Reichör
  2005-03-23 12:05 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Reichör @ 2005-03-23  7:35 UTC (permalink / raw)
  To: zsh-workers

Hi!

I discovered M-/ and M-, to dynamically expand words from the history.

By googling I found the following settings:

zstyle ':completion:*:history-words' stop yes
zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' list false
zstyle ':completion:*:history-words' menu yes

One thing that looks strange is the following. When I enable the
listing like this:
zstyle ':completion:*:history-words' list true

I see, that often used words are displayed multiple times.
Is there a way to display them only once (and use them only once for expansion)?

The remove-all-dups should remove the duplicated entries - shouldn't it?

I use zsh4.0.7, if that matters.


Stefan.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dabbrev like feature for zsh
  2005-03-23  7:35 dabbrev like feature for zsh Stefan Reichör
@ 2005-03-23 12:05 ` Bart Schaefer
  2005-03-24  6:49   ` Stefan Reichör
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2005-03-23 12:05 UTC (permalink / raw)
  To: zsh-workers; +Cc: Stefan Reichör

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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dabbrev like feature for zsh
  2005-03-23 12:05 ` Bart Schaefer
@ 2005-03-24  6:49   ` Stefan Reichör
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Reichör @ 2005-03-24  6:49 UTC (permalink / raw)
  To: zsh-workers

Thanks Bart!

Here are the settings that I use now.
I use F5 and Shift-F5 to call the history complete functions.

## dabbrev for zsh!!
zstyle ':completion:history-words:*:history-words' stop yes
zstyle ':completion:history-words:*:history-words' list no
zstyle ':completion:history-words:*' remove-all-dups yes
zstyle ':completion:history-words:*' menu yes
bindkey '\e[15~' _history-complete-older #F5
bindkey '\e[28~' _history-complete-newer #Shift-F5


Stefan.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-24  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-23  7:35 dabbrev like feature for zsh Stefan Reichör
2005-03-23 12:05 ` Bart Schaefer
2005-03-24  6:49   ` Stefan Reichör

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).