summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/key-bindings.bash23
-rw-r--r--shell/key-bindings.fish10
-rw-r--r--shell/key-bindings.zsh14
3 files changed, 35 insertions, 12 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index b335e6de..30b776a5 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -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
@@ -132,9 +133,14 @@ if ((BASH_VERSINFO[0] < 4)); then
fi
# CTRL-R - Paste the selected command from history into the command line
- bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er"'
- bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
- bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
+ 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
+ bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er"'
+ bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
+ bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
+ fi
else
# CTRL-T - Paste the selected file path into the command line
if [[ ${FZF_CTRL_T_COMMAND-x} != "" ]]; then
@@ -144,9 +150,14 @@ else
fi
# CTRL-R - Paste the selected command from history into the command line
- bind -m emacs-standard -x '"\C-r": __fzf_history__'
- bind -m vi-command -x '"\C-r": __fzf_history__'
- bind -m vi-insert -x '"\C-r": __fzf_history__'
+ 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
+ bind -m emacs-standard -x '"\C-r": __fzf_history__'
+ bind -m vi-command -x '"\C-r": __fzf_history__'
+ bind -m vi-insert -x '"\C-r": __fzf_history__'
+ fi
fi
# ALT-C - cd into the selected directory
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index 1bebaf30..2b44dfd0 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -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
@@ -214,8 +215,13 @@ function fzf_key_bindings
commandline -f repaint
end
- bind \cr fzf-history-widget
- bind -M insert \cr fzf-history-widget
+ if not set -q FZF_CTRL_R_COMMAND; or test -n "$FZF_CTRL_R_COMMAND"
+ if test -n "$FZF_CTRL_R_COMMAND"
+ echo "warning: FZF_CTRL_R_COMMAND is set to a custom command, but custom commands are not yet supported for CTRL-R" >&2
+ end
+ bind \cr fzf-history-widget
+ bind -M insert \cr fzf-history-widget
+ end
if not set -q FZF_CTRL_T_COMMAND; or test -n "$FZF_CTRL_T_COMMAND"
bind \ct fzf-file-widget
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 {