Skip to content
This repository has been archived by the owner on Jan 6, 2018. It is now read-only.

zle widget in the example is broken #12

Open
a-sk opened this issue Oct 27, 2012 · 3 comments
Open

zle widget in the example is broken #12

a-sk opened this issue Oct 27, 2012 · 3 comments

Comments

@a-sk
Copy link

a-sk commented Oct 27, 2012

Please look at the similar issue - https://github.com/clvv/fasd/issues/6

I got the same error invalid widget 'menu-select'

Please, consider changing zsh widget example to something like:

zle -C matcher-complete complete-word _generic
zstyle ':completion:matcher-complete:*' completer _matcher_complete
zstyle ':completion:matcher-complete:*' menu-select
@cstrahan
Copy link

@a-sk / @burke: The snippet above gets me half way there. However, the completions are listed in alphabetical order, as opposed to the order that matcher writes out to stdout.

Any idea how to fix the order?

@cstrahan
Copy link

I looked around for other completion funcs that sort, and I wound up with something like this:

_matcher_complete() {
  integer i=1
  (git ls-files 2>/dev/null || find .) | /usr/local/bin/matcher -l20 ${words[CURRENT]} | while read line; do
    compadd -U -2 -V $i -- "$line"
    i=$((i+1))
  done
  compstate[insert]=menu
}

I'm a ZSH noob, so I could quite possible be doing plenty of stupid things in the above code. man zshcompwid has some notes on the compadd flags.

@fw42
Copy link

fw42 commented May 31, 2013

Not sure if this is the same behaviour as before, but it kind of works for me:

_matcher() {
  (git ls-files 2>/dev/null || locate .) | /Users/flo/.vim/matcher/matcher -l20 ${words[CURRENT]} | while read line; do
    compadd -U "$line"
  done
  compstate[insert]=menu # no expand
}

zle -C matcher complete-word _generic
zstyle ':completion:matcher:*' completer _matcher
zstyle ':completion:matcher:*' menu-select

# C-t to find matches for the search under the cursor
bindkey '^T' matcher

(ping @burke)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants