6

I get the following interactive prompt (navigatable using Up Down)when I press Ctrl+R using bash. What is this plugin/configuration? I'd like to install this on my other servers. Tried to search on google to no avail.

enter image description here

3
  • Best place to check for this sort of thing is in the typical profile locations stackoverflow.com/questions/11629304/… though that left out /etc/profile.d
    – bxm
    Sep 13 at 7:02
  • You are correct, got some new hints in ~/.bash_profile
    – Sida Zhou
    Sep 13 at 7:18
  • Turns out none of the hints helped
    – Sida Zhou
    Sep 13 at 7:55

1 Answer 1

7

That behavior is part of the command fzf. You can follow this guide: fzf - command line fuzzy finder to install it on your operating system. In my case (once installed) I had to source these files:

source /usr/share/bash-completion/completions/fzf
source /usr/share/bash-completion/completions/fzf-key-bindings

In other cases might source the files from a different path:

source /usr/share/doc/fzf/examples/completion.bash
source /usr/share/doc/fzf/examples/key-bindings.bash

If you want to avoid typing each time those commands you can add those lines to your ~/.bashrc or ~/.bash_profile:

echo -e 'source /usr/share/bash-completion/completions/fzf\nsource /usr/share/bash-completion/completions/fzf-key-bindings' >> ~/.bashrc

echo -e 'source /usr/share/bash-completion/completions/fzf\nsource /usr/share/bash-completion/completions/fzf-key-bindings' >> ~/.bash_profile
4
  • I found it here as well: ~/.bashrc | grep fzf. It's easy once you know what you are looking for... I was trying to bind -p | grep "\C-r", but apparently fzf bound the key in a way that bind -p doesnt show it.
    – Sida Zhou
    Sep 13 at 8:48
  • Maybe it's different for binding with \C-r. If you see the file /usr/share/bash-completion/completions/fzf-key-bindings you will see something like this: bind -m emacs-standard -x '"\C-r": __fzf_history__' ... I commented that line and reset my shell and the interactive history was not working. Sep 13 at 17:00
  • I did the exact same thing, the line bind -m emacs-standard -x '"\C-r": __fzf_history__' is the magic line. But there is nothing related to fzf in /usr/share/bash-completion/completions for me.
    – Sida Zhou
    Sep 14 at 6:37
  • @SidaZhou maybe your fzf files are under /usr/share/doc/. You can try: sudo find /usr/share -iname '*fzf*' for getting the paths which might have the fzf files. Sep 14 at 21:56

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.