summaryrefslogtreecommitdiffstats
path: root/shell/key-bindings.bash
diff options
context:
space:
mode:
authorEli Barzilay <eli@barzilay.org>2024-03-17 03:06:48 -0400
committerGitHub <noreply@github.com>2024-03-17 16:06:48 +0900
commit88f4c16755d8fb53e55adec84d60d4aeaf1e7d91 (patch)
tree2b33afcecdf048d90969091d7830014a89825b53 /shell/key-bindings.bash
parentc7ee071efa0f988ba9613166798afc4b300ce761 (diff)
Make it possible to disable `Ctrl+T` / `Alt+C` / completions (#3678)
This makes it possible to skip one of the above key bindings or completions by setting a variable to an empty string. For example, FZF_CTRL_T_COMMAND= FZF_ALT_C_COMMAND= \ eval "$(fzf --zsh)" Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
Diffstat (limited to 'shell/key-bindings.bash')
-rw-r--r--shell/key-bindings.bash24
1 files changed, 15 insertions, 9 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index f6cd48f1..a290e4ca 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -102,9 +102,11 @@ bind -m emacs-standard '"\C-z": vi-editing-mode'
if (( BASH_VERSINFO[0] < 4 )); then
# CTRL-T - Paste the selected file path into the command line
- bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
- bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
- bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
+ if [[ "${FZF_CTRL_T_COMMAND-x}" != "" ]]; then
+ bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
+ bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
+ bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
+ 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"'
@@ -112,9 +114,11 @@ if (( BASH_VERSINFO[0] < 4 )); then
bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
else
# CTRL-T - Paste the selected file path into the command line
- bind -m emacs-standard -x '"\C-t": fzf-file-widget'
- bind -m vi-command -x '"\C-t": fzf-file-widget'
- bind -m vi-insert -x '"\C-t": fzf-file-widget'
+ if [[ "${FZF_CTRL_T_COMMAND-x}" != "" ]]; then
+ bind -m emacs-standard -x '"\C-t": fzf-file-widget'
+ bind -m vi-command -x '"\C-t": fzf-file-widget'
+ bind -m vi-insert -x '"\C-t": fzf-file-widget'
+ fi
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard -x '"\C-r": __fzf_history__'
@@ -123,6 +127,8 @@ else
fi
# ALT-C - cd into the selected directory
-bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
-bind -m vi-command '"\ec": "\C-z\ec\C-z"'
-bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
+if [[ "${FZF_ALT_C_COMMAND-x}" != "" ]]; then
+ bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
+ bind -m vi-command '"\ec": "\C-z\ec\C-z"'
+ bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
+fi