Fzf: CTRL-r nor working in ZSH

Created on 25 May 2018  Â·  17Comments  Â·  Source: junegunn/fzf

  • Category

    • [x ] fzf binary

    • [ ] fzf-tmux script

    • [ ] Key bindings

    • [ ] Completion

    • [x ] Vim

    • [ ] Neovim

    • [ ] Etc.

  • OS

    • [x ] Linux

    • [ ] Mac OS X

    • [ ] Windows

    • [ ] Windows Subsystem for Linux

    • [ ] Etc.

  • Shell

    • [ ] bash

    • [x ] zsh

    • [ ] fish

Most helpful comment

You could try moving [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh to the end, or just add the binding to different key to see if that works. One of ur plugins might have overwritten fzf bindings for "^R"

All 17 comments

Following upgrade to Ubuntu 18.04 and reinstallation of software inclung FZF.
Ctrl+r does not work for me in zsh, although it does if I switch back to bash. I have reinstalled fzf a couple of times without changing this. Any ideas?

For me FZF does not work on Vagrant ZSH shell.

fzf adds completion files for your shells like ~/.fzf.bash, ~/.fzf.zsh and loads them by configuring corresponding rc file. For example, it will add

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

in ~/.bashrc

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

in ~/.zshrc

I think in ur case, ur missing these lines in ur .zshrc file or the completion files as missing.

u may run the install script again to add the bindings & completions for ur shells

I hope that helps

Thanks Rajesh.

However, this not the answer as the Alt-C and Ctrl-T bindings work
correctly in zsh.

I did reinstall fzf just to make sure, but the Ctrl-R binding (and only
that binding) continues not to work. This suggests to me that something in
the Ctrl-R part of the zsh binding script is not quite right - but I cannot
identfiy any error.

Best wishes

On 2 June 2018 at 14:23, Rajesh Sharma notifications@github.com wrote:

fzf adds completion files for your shells like ~/.fzf.bash, ~/.fzf.zsh
and loads them by configuring corresponding rc file. For example, it will
add

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

in ~/.bashrc

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

in ~/.zshrc

I think in ur case, ur missing these lines in ur .zshrc file or the
completion files as missing.

u may run the install script again to add the bindings & completions for
ur shells

I hope that helps

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/junegunn/fzf/issues/1304#issuecomment-394087351, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYia7mwWL-PrEAHLfKvkJKCncuw_TLTzks5t4pHTgaJpZM4UNur1
.

@dboneham its possible that the key was bound to something else ( for example in ur zshrc or via another plugin ). Can u check like this

bindkey | grep fzf

u should get something like this in result:

"^I" fzf-completion
"^R" fzf-history-widget
"^T" fzf-file-widget
"^[c" fzf-cd-widget

Rajesh

This is what I get.

"^T" fzf-file-widget
"^[c" fzf-cd-widget

I inspected the bindkey results and Ctrl-R is bound to
history-incremental-search-backward.

Ctrl-I is bound to expand-or-complete-with-dots.

No clue as what is bringing about these bindings. I suspect it may be my
zshrc, which I copy below.

#### oh-my-zsh

1 export ZSH=/home/dboneham/.oh-my-zsh
2 HYPHEN_INSENSITIVE="true"
3 export UPDATE_ZSH_DAYS=3
4 ENABLE_CORRECTION="true"
5 COMPLETION_WAITING_DOTS="true"
6 HIST_STAMPS="mm/dd/yyyy"
7 export SSH_KEY_PATH="~/.ssh/rsa_id"
8
9
10 ########## custom zshrc ###########
11 if [[ $(tty) = "/dev/tty1" ]]; then
12 pgrep i3 || startx
13 fi
14
15 export PATH=$HOME/bin:/usr/local/bin:$PATH
16 export BROWSER="google-chrome"
17 export BROWSERCLI="w3m"
18 export IMAGEVIEWER="feh"
19 export PLAYER="mpv"
20 export TERMINAL="urxvt"
21 export PAGER="w3m"
22 export EDITOR="vim"
23 export RANGER_LOAD_DEFAULT_RC="false"
24 export PODPLAYER="mplayer"
25
26 source ~/.aliases
27 . /usr/share/powerline/bindings/zsh/powerline.zsh
28 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
29 source "${HOME}/.zgen/zgen.zsh"
30
31 if ! zgen saved; then
32
33 # specify plugins here
34 zgen oh-my-zsh
35 zgen oh-my-zsh plugins/git
36 zgen oh-my-zsh plugins/sudo
37 zgen oh-my-zsh plugins/command-not-found
38 zgen oh-my-zsh plugins/extract
39 zgen oh-my-zsh plugins/pip
40 zgen oh-my-zsh plugins/web-search
41 zgen oh-my-zsh plugins/z
42 zgen oh-my-zsh themes/agnoster
43 zgen load urbainvaes/fzf-marks
44 zgen load zsh-users/zsh-completions src
45
46 # generate the init script from plugins above
47 echo "Creating a zgen save"
48 zgen save
49 fi
50
51 powerline-daemon -q
52
53 eval "$(fasd --init auto)"
54

On 3 June 2018 at 16:51, Rajesh Sharma notifications@github.com wrote:

@dboneham https://github.com/dboneham its possible that the key was
bound to something else. Can u check like this

bindkey | grep fzf

u should get something like this in result:

"^I" fzf-completion
"^R" fzf-history-widget
"^T" fzf-file-widget
"^[c" fzf-cd-widget

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/junegunn/fzf/issues/1304#issuecomment-394171410, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYia7nGtrj-uL7cqgYuVRJNug5W5szw-ks5t5AYNgaJpZM4UNur1
.

You could try moving [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh to the end, or just add the binding to different key to see if that works. One of ur plugins might have overwritten fzf bindings for "^R"

Thanks.

The solution was indeed just to bind Ctrl-R to fzf-history-widget I noticed
that an alternative binding for history-incremental-search-backwards was
already in existence, so no loss of functionality. Not that I sue that
functio anyway..Inbox

My guess is that the zsh completion plugin overwrite the binding. So I have
just reversed that. I may need to figure out a way of making my binding
permanent if it overwrites again

On 4 June 2018 at 11:18, Rajesh Sharma notifications@github.com wrote:

You could try moving [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh to the end,
or just add the binding to different key to see if that works. One of ur
plugins might have overwritten fzf bindings for "^R"

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/junegunn/fzf/issues/1304#issuecomment-394305636, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYia7g4p1wR76ALpVqp9Cp5_5GyruifQks5t5Ql3gaJpZM4UNur1
.

Fixed it permanently by adding a line to my zshrc at the end binding the
key to the fzf widget.

Thanks again

On 4 June 2018 at 12:03, David Boneham dboneham@boneham.org.uk wrote:

Thanks.

The solution was indeed just to bind Ctrl-R to fzf-history-widget I
noticed that an alternative binding for history-incremental-search-backwards
was already in existence, so no loss of functionality. Not that I sue that
functio anyway..Inbox

My guess is that the zsh completion plugin overwrite the binding. So I
have just reversed that. I may need to figure out a way of making my
binding permanent if it overwrites again

On 4 June 2018 at 11:18, Rajesh Sharma notifications@github.com wrote:

You could try moving [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh to the end,
or just add the binding to different key to see if that works. One of ur
plugins might have overwritten fzf bindings for "^R"

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/junegunn/fzf/issues/1304#issuecomment-394305636, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYia7g4p1wR76ALpVqp9Cp5_5GyruifQks5t5Ql3gaJpZM4UNur1
.

glad it worked out. Can u close this issues. Thanks

Just remove

\C-y\ey part from the bind command in the ~/.fzf/shell/key-bindings.bash:

bind '"\C-r": " \C-e\C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er\e^"'

and it works like a charm.

I found bindkey -e binds "^R" to history-incremental-search-backward. The key binding order matters.

I have a question about this topic too.

I install fzf through Homebrew and I add fzf in zshrc.zsh plugin like this plugins=(fzf)

I saw the suggestion is to put [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh in the end of zshrc.zsh. But I don't have any .fzf repo in my home directory. So this suggestion is not suit for me. I also saw some tutorial is git clone fzf repo in home directory as .fzf

I have 2 questions.

  1. Can I just use oh-my-zsh plugins fzf or the Homebrew installed one?
    Because I don't want to have same fzf repo in everywhere.
  1. If first question is No. Is any way to solve my problem or the only way is clone a repo in home directory?

Thanks for reply

Reply my question. Install fzf using Homebrew like

# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install

It add .fzf.zsh and .fzf.bash in home directory so now it can be sourced

In my case the .fzf.zsh file had the keybinding disabled, I had to enable them:

  # Key bindings
  # ------------
  source "/home/user/.fzf/shell/key-bindings.zsh

then you can try: source ~/.fzf.zsh (or bash)

In my case the .fzf.zsh file had the keybinding disabled, I had to enable them:

  # Key bindings
  # ------------
  source "/home/user/.fzf/shell/key-bindings.zsh

then you can try: source ~/.fzf.zsh (or bash)

In my case too, after a fresh install of ubuntu, I faced the same issue,
at pressing "ctrl+r" was bck-i-search: opening. Luckily it worked.

source "/home/$(whoami)/.fzf/shell/key-bindings.zsh"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
Paste above line in 'vi ~/.zshrc' file and don't forget to run this command afterwards 'source ~/.zshrc'

If you are trying to install for the raspberry pi, key bindings are not installed automatically!

Add this to .zshrc: source /usr/share/doc/fzf/examples/key-bindings.zsh

You can see this yourslf:

 apt-cache show fzf
...
Refer /usr/share/doc/fzf/README.Debian for quick instructions on how to
 add keybindings for Bash, Zsh, Fish to call fzf.

cat  /usr/share/doc/fzf/README.Debian 
...
Zsh
===

Append this line to ~/.zshrc to enable fzf keybindings for Zsh:

   source /usr/share/doc/fzf/examples/key-bindings.zsh
Was this page helpful?
0 / 5 - 0 ratings

Related issues

firedev picture firedev  Â·  3Comments

nordlow picture nordlow  Â·  3Comments

ghost picture ghost  Â·  3Comments

asilvadesigns picture asilvadesigns  Â·  3Comments

leonklingele picture leonklingele  Â·  3Comments