Closed MrZhang123 closed 5 years ago
Please follow the instruction in https://github.com/junegunn/fzf#installation. Install script will update your shell configuration file to load scripts in https://github.com/junegunn/fzf/tree/master/shell
I have been using fzf for a long time, but I forgot about ** a long time ago. I have just realised that it is not working and when I reran the installer script it didn't change anything regarding this. How can I test why it is not working with my dotfiles?
I had this problem also, the way it worked for me on Ubuntu 22 was to install by git cloning instead of using apt and running the installed from the cloned folder by cd
into it rather then running ~/.fzf/install
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
cd ~/.fzf
./install
# Yes to all the options
That appends a source of ~/.fzf.bash
in your .bashrc
, and that sourced file will source the auto-completions from ~/.fzf/shell/completions.bash
.
@JREAM What I currently do to install/update fzf (on Linux x86_64) is this:
#!/bin/bash
nameregex='^fzf-\d[\d.]+?\d?-linux_amd64\.tar\.gz$'
wget -q "$(curl -s https://api.github.com/repos/junegunn/fzf/releases/latest | jq -r '.assets[] | select(.name|test($name)).browser_download_url' --arg name "${nameregex}")"
tar --wildcards -C /usr/local/bin -xf fzf-*-linux_amd64.tar.gz
rm fzf-*-linux_amd64.tar.gz
wget https://github.com/junegunn/fzf/raw/master/man/man1/fzf.1 -O /usr/local/share/man/man1/fzf.1
gzip -f /usr/local/share/man/man1/fzf.1
wget https://github.com/junegunn/fzf/raw/master/man/man1/fzf-tmux.1 -O /usr/local/share/man/man1/fzf-tmux.1
gzip -f /usr/local/share/man/man1/fzf-tmux.1
wget https://github.com/junegunn/fzf/raw/master/bin/fzf-tmux -O /usr/local/bin/fzf-tmux
chmod +x /usr/local/bin/fzf-tmux
wget https://github.com/junegunn/fzf/raw/master/shell/completion.bash -O /etc/bash_completion.d/fzf-completions.bash
wget https://github.com/junegunn/fzf/raw/master/shell/key-bindings.bash -O /etc/bash_completion.d/fzf-keybindings.bash
This updates the fzf binary, the fzf-tmux script, man files, bash completion file and keybindings files and it avoids needing its own directory in your $HOME
. A lot neater I think.
Just something I learnt quite recently which is sort of relevant to this conversation, so I'll mention that bash completion files that are placed anywhere other than /etc/bash_completion.d/
are lazy-loaded, so they only load when called upon explicitly, so files placed in there need to be named the same as the command (eg. fzf
or fzf.bash
).
But as we have two files, and they do not seem to work when concatenated, they either need to be placed in /etc/bash_completion.d/
or (I think) ~/.local/bash_completion
, or specifically sourced from .bashrc
.
I installed fzf using the official package manager in Arch Linux. However in order to get fzf completion work I have to source /usr/share/fzf/completion.zsh
in my .zshrc
.
Not sure if this is related to your issue but I had the same problem until I figured out that I was setting my terminal to vi mode:
set -o vi
After my fzf
config, which killed the '**' completions (keybindings still worked).
Solution: Just moved the vi mode setting above the fzf settings.
I'm not good at any of this but I had an issue where this was conflicting with the zsh-vi-mode
plugin.
I needed to add the ZVM_INIT_MODE
:
ZVM_INIT_MODE=sourcing
source $(brew --prefix)/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
without it ** would always list all the directories, I also moved the fzf config afterwards as well. I hope this helps anyone else as well
Use fzf completion in zsh and bash, but it not work, enter
vim **<Tab>
orcd **<Tab>
, they all show this folders all files like this :fzf config in zsh:
How to set to use completion ?