summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/key-bindings.bash24
-rw-r--r--shell/key-bindings.fish16
-rw-r--r--shell/key-bindings.zsh20
3 files changed, 39 insertions, 21 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
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index 51ddcc0d..6e62c59c 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -104,14 +104,22 @@ function fzf_key_bindings
end
end
- bind \ct fzf-file-widget
bind \cr fzf-history-widget
- bind \ec fzf-cd-widget
+ if not set -q FZF_CTRL_T_COMMAND; or test -n "$FZF_CTRL_T_COMMAND"
+ bind \ct fzf-file-widget
+ end
+ if not set -q FZF_ALT_C_COMMAND; or test -n "$FZF_ALT_C_COMMAND"
+ bind \ec fzf-cd-widget
+ end
if bind -M insert > /dev/null 2>&1
- bind -M insert \ct fzf-file-widget
bind -M insert \cr fzf-history-widget
- bind -M insert \ec fzf-cd-widget
+ if not set -q FZF_CTRL_T_COMMAND; or test -n "$FZF_CTRL_T_COMMAND"
+ bind -M insert \ct fzf-file-widget
+ end
+ if not set -q FZF_ALT_C_COMMAND; or test -n "$FZF_ALT_C_COMMAND"
+ bind -M insert \ec fzf-cd-widget
+ end
end
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix'
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh
index a3699add..51aa6ea0 100644
--- a/shell/key-bindings.zsh
+++ b/shell/key-bindings.zsh
@@ -62,10 +62,12 @@ fzf-file-widget() {
zle reset-prompt
return $ret
}
-zle -N fzf-file-widget
-bindkey -M emacs '^T' fzf-file-widget
-bindkey -M vicmd '^T' fzf-file-widget
-bindkey -M viins '^T' fzf-file-widget
+if [[ "${FZF_CTRL_T_COMMAND-x}" != "" ]]; then
+ zle -N fzf-file-widget
+ bindkey -M emacs '^T' fzf-file-widget
+ bindkey -M vicmd '^T' fzf-file-widget
+ bindkey -M viins '^T' fzf-file-widget
+fi
# ALT-C - cd into the selected directory
fzf-cd-widget() {
@@ -83,10 +85,12 @@ fzf-cd-widget() {
zle reset-prompt
return $ret
}
-zle -N fzf-cd-widget
-bindkey -M emacs '\ec' fzf-cd-widget
-bindkey -M vicmd '\ec' fzf-cd-widget
-bindkey -M viins '\ec' fzf-cd-widget
+if [[ "${FZF_ALT_C_COMMAND-x}" != "" ]]; then
+ zle -N fzf-cd-widget
+ bindkey -M emacs '\ec' fzf-cd-widget
+ bindkey -M vicmd '\ec' fzf-cd-widget
+ bindkey -M viins '\ec' fzf-cd-widget
+fi
# CTRL-R - Paste the selected command from history into the command line
fzf-history-widget() {