3

Is it possible to trigger fzf history search automatically in zsh shell?

In this video, the user clicks "Ctrl+r" to start the history search and then starts typing. Is it possible to start the history search automatically when I start typing anything? Alternatively, is it possible to configure zsh so that a new prompt always starts in the "Ctrl+r" mode?

0

This is described in the original GitHub repository. In case you are using homebrew you'll just need to type $(brew --prefix)/opt/fzf/install and configure it the way you like. The script will create two files and ask you to update your shell configuration files. For all other installation procedures (git clone, linux brew, ...) have a look at https://github.com/junegunn/fzf

$(brew --prefix)/opt/fzf/install                                                                             ─╯
Downloading bin/fzf ...
  - Already exists
  - Checking fzf executable ... 0.18.0
Do you want to enable fuzzy auto-completion? ([y]/n) y
Do you want to enable key bindings? ([y]/n) y

Generate /Users/hans/.fzf.bash ... OK
Generate /Users/hans/.fzf.zsh ... OK

Do you want to update your shell configuration files? ([y]/n) y

Update /Users/hans/.bashrc:
  - [ -f ~/.fzf.bash ] && source ~/.fzf.bash
    + Added

Update /Users/hans/.zshrc:
  - [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
    + Added

Finished. Restart your shell or reload config file.
   source ~/.bashrc  # bash
   source ~/.zshrc   # zsh

Use uninstall script to remove fzf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.