junegunn / fzf

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

Fuzzy completion example from wiki is not working #1119

Open jan-warchol opened 7 years ago

jan-warchol commented 7 years ago

I'm trying to define custom shell completion using example from wiki, and it doesn't work from me. I've put the definition of _fzf_complete_doge and complete -F _fzf_complete_doge -o default -o bashdefault doge in a script and sourced it. But when I try doge <TAB> (or doge **<TAB>) I get default bash path completion. This is GNU bash, version 4.3.48(1)-release.

diegoholiveira commented 7 years ago

I'm having the same issue.

I use brew to install fzf and I do follow each instruction of the /usr/local/opt/fzf/install.

The ** trigger just doesn't work. I'm using the 4.4.12 bash version and the iterm2.

joeminicucci commented 5 years ago

I'm having the same issue only Im using ZSH w/ various terminal emulators

xulongwu4 commented 5 years ago

I had the same problem by installing with a package manager. Then I solved the problem by explicitly sourcing the completion shell file in my shell-rc file.

msdrigg commented 3 years ago

My issue was package manager installation. If you run apt-cache show fzf or equivalent, there is instructions in the description for how to setup auto-completions and keyboard shortcuts.

bjacques commented 1 year ago

Fuzzy completion like cd /** wasn't working for me. I didn't see a file named completion.bash that I could source (although there is a file for .zsh) and it's not clear whether my version of fzf is supposed to have the auto-completion working by default or not

$ sudo apt install fzf

$ fzf --version
0.29 (devel)

$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

$ ll /usr/share/doc/fzf/examples/
-rw-r--r-- 1 root root 10770 Dec 25  2021 completion.zsh
-rw-r--r-- 1 root root 30960 Dec 25  2021 fzf.vim
-rw-r--r-- 1 root root  3767 Dec 25  2021 key-bindings.bash
-rw-r--r-- 1 root root  5727 Dec 25  2021 key-bindings.fish
-rw-r--r-- 1 root root  3590 Dec 25  2021 key-bindings.zsh
drwxr-xr-x 2 root root  4096 Jan  4 19:30 plugin/

$ cat /usr/share/doc/fzf/README.Debian
...
Note, since fzf 0.29.0-1, the bash completion is installed for bash
by default. Feel free to ignore the following instruction for fzf >= 0.29.0-1.
Append this line to ~/.bashrc to enable fuzzy auto-completion for Bash:

   source /usr/share/doc/fzf/examples/completion.bash

I was able to solve my auto-completion issue by manually downloading this source file completion.bash and adding it as described. I added the following lines to my .bashrc file

# fzf
source /usr/share/doc/fzf/examples/key-bindings.bash
source /usr/share/doc/fzf/examples/completion.bash
junegunn commented 1 year ago

@bjacques See https://github.com/junegunn/fzf/issues/2790

praxder commented 1 year ago

I ran into this issue because I was using FZF in combination with iTerm2 and Oh-My-Zsh. I had placed the [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh above the source of oh-my-zsh in my .zshrc file and that messed up FZF. When I placed the FZF source below the oh-my-zsh source, FZF started working (and oh-my-zsh still works too).