-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to turn on fzf help completion at zsh? #3349
Comments
No,
Some tools have it, for example ls -1 $(brew --prefix)/share/zsh/site-functions
# _bat
# _brew
# _brew_services
# _cargo
# _delta
# _exa
# _fd
# _gh
# _git
# _hx
# _ninja
# _parallel
# _revolver
# _rg
# _yt-dlp
# _zoxide Alternatively, you can run # you may have to run those commands as well
autoload -Uz compinit
compinit
# run
# add the line to your '.zshrc' file if it is useful for your case
compdef _gnu_generic fzf demorelated |
git clone --depth 1 https://github.com/lmburns/dotfiles.git lmburns_zsh_completion
# .zshrc
export FPATH="$FPATH:$HOME/lmburns_zsh_completion/.config/zsh/completions"
cd $HOME/my_completion_folder
curl --remote-name https://raw.githubusercontent.com/lmburns/dotfiles/master/.config/zsh/completions/_fzf
# .zshrc
export FPATH="$FPATH:$HOME/my_completion_folder" |
@LangLangBart - how have you founded this example? Used git search engine for files with name _fzf? |
GitHub WebUII posted the search link in my previous comment. Command line# uses 'gh', 'fzf' and 'bat'
gh search code $'#compdef fzf' \
--filename '_fzf' \
--json repository,path \
--jq '.[] | [.repository.nameWithOwner, .path] | @tsv' |
fzf --delimiter '\t' --with-nth 1 \
--preview 'gh api --cache 10m repos/{1}/contents/{2} \
--jq .content | base64 --decode | bat --language zsh --number' \
--preview-window 'nohidden:right:wrap:75%' \
--bind 'ctrl-b:execute-silent:gh browse --repo {1} {2}' |
@LangLangBart whoa, amazing tricks with that utils. Thanks for this cool staff. I had to use a bit other params for bat wanna check your dotfiles to get some usefull tricks, but looks like they are private. |
I missed the
Yes. I use zsh4humans as my setup. Checkout the creator's dotfiles - a true PS: The code snippet from my previous comment was transformed into an extension - gh find-code, utilizing the newest features of |
I second that having completions would be nice. Even incomplete completions would be better than none at all. Maybe @lmburns would be willing to PR their completions? @LangLangBart Thanks for the various tricks you shared in this thread. |
https://github.com/RobSis/zsh-completion-generator is another option here for generating completions for tools which don't provide them. |
Hello, greped a lot in Issues and manual, but can't find how to enable zsh completion for fzf help.
I mean tab complete for fzf options like
--preview
,--multi
, e.t.c.shell/completion.bash has function _fzf_opts_completion with opts
I havn't find something like this for shell/completion.zsh
probably you added some scripts to build help auto?
There are some examples
bat: https://github.com/sharkdp/bat/blob/master/assets/completions/bat.zsh.in
exa: https://github.com/ogham/exa/blob/master/completions/zsh/_exa
ripgrep: https://github.com/BurntSushi/ripgrep/blob/master/complete/_rg
The text was updated successfully, but these errors were encountered: