junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
65.44k stars 2.41k forks source link

[Discuss] How to have completion under multiple arguments/sub-command? #1772

Open tmpm697 opened 4 years ago

tmpm697 commented 4 years ago

Info

Problem / Steps to reproduce

I've notices this line in zsh autocompletion https://github.com/junegunn/fzf/blob/85644aa3fb9da6fbe1807b793f085130932594ce/shell/completion.zsh#L169

What if I have a command that has sub-command follow it, how to pass it to zsh completion, for e.g: if [ $cmd = j get nodes ${LBUFFER[-1]} = ' ' ]; then that j get nodes is a sub-command of j. Completion won't work with this command, it only works if I specify j only.

How to have it work with sub-commands j get nodes?

junegunn commented 4 years ago

You might want to take a look at some examples in https://github.com/junegunn/fzf/wiki/Examples-(completion)#examples

tmpm697 commented 4 years ago

@junegunn : thanks for quick reply, does that $cmd same for @ARGS, I'm not quite certain.

tmpm697 commented 4 years ago

@junegunn I followed the examples and did some tweaks, I can set j get nodes <tab> to get completion list but it will not be in a fuzzy list to search and select.

I want a fuzzy after _fzf_complete "--reverse -n 1 --height=80%" "$@" < <(, howto?