Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added possibility for shell key binding remapping. #2874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions shell/key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
# - $FZF_CTRL_T_BINDING
# - $FZF_CTRL_R_BINDING
# - $FZF_ALT_C_BINDING

# Key bindings
# ------------
Expand Down Expand Up @@ -66,9 +69,9 @@ fzf-file-widget() {
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
bindkey -M emacs ${FZF_CTRL_T_BINDING:-'^T'} fzf-file-widget
bindkey -M vicmd ${FZF_CTRL_T_BINDING:-'^T'} fzf-file-widget
bindkey -M viins ${FZF_CTRL_T_BINDING:-'^T'} fzf-file-widget

# ALT-C - cd into the selected directory
fzf-cd-widget() {
Expand All @@ -89,9 +92,9 @@ fzf-cd-widget() {
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
bindkey -M emacs ${FZF_ALT_C_BINDING:-'\ec'} fzf-cd-widget
bindkey -M vicmd ${FZF_ALT_C_BINDING:-'\ec'} fzf-cd-widget
bindkey -M viins ${FZF_ALT_C_BINDING:-'\ec'} fzf-cd-widget

# CTRL-R - Paste the selected command from history into the command line
fzf-history-widget() {
Expand All @@ -110,9 +113,9 @@ fzf-history-widget() {
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
bindkey -M emacs ${FZF_CTRL_R_BINDING:-'^R'} fzf-history-widget
bindkey -M vicmd ${FZF_CTRL_R_BINDING:-'^R'} fzf-history-widget
bindkey -M viins ${FZF_CTRL_R_BINDING:-'^R'} fzf-history-widget

} always {
eval $__fzf_key_bindings_options
Expand Down