fzf icon indicating copy to clipboard operation
fzf copied to clipboard

CTRL + R not working

Open sudhanya-jaisingh opened this issue 10 months ago • 10 comments

I am a MAC M1 user and the CTRL+R option was working fine until a few days back when it suddenly stopped working.

My fzf version is 0.60.2 (brew) And shell is interactive and I get the following response upon using 'bindkey | grep fzf'

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

If I use fzf-history-widget alone I get 'widgets can only be called when ZLE is active'. My CTRL+T is working fine but this history thing

sudhanya-jaisingh avatar Feb 27 '25 08:02 sudhanya-jaisingh

How do you set up shell integration? Are you following the instruction in https://github.com/junegunn/fzf?tab=readme-ov-file#setting-up-shell-integration?

junegunn avatar Feb 27 '25 11:02 junegunn

Yeah I have used the source <(fzf --zsh) line in my zshrc file

sudhanya-jaisingh avatar Feb 27 '25 11:02 sudhanya-jaisingh

Can you try to reproduce your bug in a minimal zsh environment?

command env -i "HOME=$HOME" "USER=$USER" "PATH=$PATH" "TERM=$TERM" zsh -f

source <(fzf --zsh)

# press ctrl-r

If you don't see the error, that suggests something in your shell setup is interfering with the correct functioning of the fzf widgets. One way to troubleshoot is to gradually remove parts of your shell setup or make your setup public so we can identify where things go wrong.

LangLangBart avatar Mar 05 '25 00:03 LangLangBart

#1920 #4211

I encountered the same problem and, after extensive testing, I think I found the issue.

When I open a new terminal window and execute bindkey, it initially shows "^R" fzf-history-widget. However, after a few seconds, when I run bindkey again, it shows "^R" history-incremental-search-backward. I suspect this may be related to the loading order of some Zsh plugins. I have tried different installation methods including brew install fzf and git。

I temporarily did this by delaying it to load last, for example, after the year 2000...

zinit ice if"[[ -n '$TMUX' ]] || [[ '$TERM_PROGRAM' != 'WarpTerminal' ]]" wait"6" lucid from="gh-r" as"program" atload"source <(fzf --zsh); bindkey '^R' fzf-history-widget; bindkey '^T' fzf-file-widget"
zinit light junegunn/fzf

hahapigs avatar Mar 07 '25 10:03 hahapigs

Having the same issue as well, here is my current config: https://github.com/wormholecowboy/.dotfiles/blob/main/zsh/.zshrc

Using version 0.60.3 on Ubuntu WSL 2.

Does not show up if I run bindkey: ❯ bindkey | grep fzf "^I" fzf-tab-complete "^T" fzf-file-widget "^X." fzf-tab-debug "^[c" fzf-cd-widget

wormholecowboy avatar Mar 20 '25 22:03 wormholecowboy

@wormholecowboy

can you try this suggestion in the comment below, as I suspect that in your case it might be due to the zsh-vi-mode plugin

https://github.com/junegunn/fzf/issues/4261#issuecomment-2675202530

LangLangBart avatar Mar 20 '25 23:03 LangLangBart

@LangLangBart That didn't fix the issue, however, you are right that the issue is caused by the vi plugin. I'm just going to remove that plugin since I haven't been using it much. Thanks for the help!

wormholecowboy avatar Mar 21 '25 14:03 wormholecowboy

Here is my zshrc file @LangLangBart The behavior was same in minimal environment as well

Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi

Path to your oh-my-zsh installation.

export ZSH="$HOME/.oh-my-zsh" export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin

Set name of the theme to load

ZSH_THEME="robbyrussell"

Plugins

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

source $ZSH/oh-my-zsh.sh

Source fzf

#source /opt/homebrew/Cellar/fzf/0.60.2/shell/key-bindings.zsh

source <(fzf --zsh)

Source zsh-autosuggestions

source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh

Source zsh-syntax-highlighting

source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

User configuration

if [[ $(arch) == "i386" ]]; then eval "$(/usr/local/bin/brew shellenv)"; fi

source ~/powerlevel10k/powerlevel10k.zsh-theme

To customize prompt, run p10k configure or edit ~/.p10k.zsh.

[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

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

sudhanya-jaisingh avatar Mar 27 '25 06:03 sudhanya-jaisingh

Same issue here. MacOS, Zsh, source <(fzf --zsh) in Zsh config files. Keybindings Ctrl-T, Alt-C work, but Ctrl-R history search does not. Tried all proposed solutions I could see (put sourcing into different Zsh config files, put inside function, that's it). This did not solve the issue. fzf version 0.66.1 (MacPorts).

Irratzo avatar Nov 11 '25 14:11 Irratzo

Here is my zshrc file @LangLangBart The behavior was same in minimal environment as well

I was unable to reproduce the issue with the given config file.

Tried all proposed solutions I could see (put sourcing into different Zsh config files, put inside function, that's it).

@Irratzo Can you also reproduce the issue in a minimal zsh environment (not reading your .zsh* config files)? Do you also use the zsh-vi-mode plugin ?

LangLangBart avatar Nov 11 '25 21:11 LangLangBart