Skip to content

Commit

Permalink
Enable alt+c bash binding with version > 4 syntax.
Browse files Browse the repository at this point in the history
This patch introduces the same backwards compatible logic as the other
bash bindings, I believe the logic for alt+c was perhaps just missed in
a previous patch to use the bash > 4 syntax, which is cleaner and
actually resolves an issue with the terminal bash prompt overlapping in
a strange way.

This is mostly a cosmetic fix but also fixes another issue with the fzf
command exiting cleanly when aborted.
  • Loading branch information
lucasteligioridis committed Nov 30, 2021
1 parent 7da287e commit e349c9e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions shell/key-bindings.bash
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ if (( BASH_VERSINFO[0] < 4 )); then
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"'

# 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"'
else
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard -x '"\C-t": fzf-file-widget'
Expand All @@ -86,11 +91,11 @@ else
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

# 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"'
# ALT-C - cd into the selected directory
bind -m emacs-standard -x '"\ec": __fzf_cd__'
bind -m vi-command -x '"\ec": __fzf_cd__'
bind -m vi-insert -x '"\ec": __fzf_cd__'
fi

fi

0 comments on commit e349c9e

Please sign in to comment.