From 0e9026b817696baed3ff48be8ecf2b6352586c7b Mon Sep 17 00:00:00 2001 From: Jacobo de Vera Date: Sat, 11 Oct 2025 17:57:31 +0100 Subject: feat: Allow disabling Ctrl-R binding in shell integration (#4535) Close #4417 --- shell/key-bindings.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'shell/key-bindings.zsh') diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index 15fb5ef0..36c03499 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -7,6 +7,7 @@ # - $FZF_TMUX_OPTS # - $FZF_CTRL_T_COMMAND # - $FZF_CTRL_T_OPTS +# - $FZF_CTRL_R_COMMAND # - $FZF_CTRL_R_OPTS # - $FZF_ALT_C_COMMAND # - $FZF_ALT_C_OPTS @@ -150,10 +151,15 @@ fzf-history-widget() { zle reset-prompt return $ret } -zle -N fzf-history-widget -bindkey -M emacs '^R' fzf-history-widget -bindkey -M vicmd '^R' fzf-history-widget -bindkey -M viins '^R' fzf-history-widget +if [[ ${FZF_CTRL_R_COMMAND-x} != "" ]]; then + if [[ -n ${FZF_CTRL_R_COMMAND-} ]]; then + echo "warning: FZF_CTRL_R_COMMAND is set to a custom command, but custom commands are not yet supported for CTRL-R" >&2 + fi + zle -N fzf-history-widget + bindkey -M emacs '^R' fzf-history-widget + bindkey -M vicmd '^R' fzf-history-widget + bindkey -M viins '^R' fzf-history-widget +fi fi } always { -- cgit v1.2.3