diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-27 14:16:15 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-27 14:16:15 +0000 |
commit | 37d14cab88e2aa09e6279bb96995e9f4521887a5 (patch) | |
tree | 26cc1a59714ff6dbd6c2c560850783922d6a2e99 /Completion/Core/_history | |
parent | a35472cb31cc6747a38b290fd9930c2e2a2b787b (diff) | |
download | zsh-37d14cab88e2aa09e6279bb96995e9f4521887a5.tar.gz zsh-37d14cab88e2aa09e6279bb96995e9f4521887a5.tar.xz zsh-37d14cab88e2aa09e6279bb96995e9f4521887a5.zip |
new _history completer (10979)
Diffstat (limited to 'Completion/Core/_history')
-rw-r--r-- | Completion/Core/_history | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Completion/Core/_history b/Completion/Core/_history new file mode 100644 index 000000000..978a75400 --- /dev/null +++ b/Completion/Core/_history @@ -0,0 +1,36 @@ +#autoload + +# Hm, this *can* sensibly be used as a completer. But it could also be used +# as a utility function, so maybe it should be moved into another directory. +# Or maybe not. Hm. +# +# +# Complete words from the history +# +# Code taken from _history_complete_words. +# +# Available styles: +# +# :history-words:sort -- sort matches lexically (default is to sort by age) +# :history-words:remove-all-dups -- +# remove /all/ duplicate matches rather than just +# consecutives + +local opt expl + +if zstyle -t ":completion:${curcontext}:" remove-all-dups; then + opt=- +else + opt=-1 +fi + +if zstyle -t ":completion:${curcontext}:" sort; then + opt="${opt}J" +else + opt="${opt}V" +fi + +# We skip the first element of historywords so the current word doesn't +# interfere with the completion +_wanted "$opt" history-words expl 'history word' \ + compadd -Q - "${(@)historywords[2,-1]}" |