From 1ccd8f6a647a31f8cb1d683d25d9f21ab28b11cc Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Sun, 23 Feb 2020 07:24:50 -0700 Subject: [PATCH] [bash] Restore insertion point pre Bash 4 (#1881) Make C-t more consistent pre and post Bash 4. It already kills the command line separately before and after the insertion point. Add set-mark and exchange-point-and-mark to restore the insertion point after yanking back and apply the same behavior to M-c. * CTRL-T should put extra space after pasted items Co-authored-by: Junegunn Choi --- shell/key-bindings.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index 5ac327e..d41f0be 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -73,16 +73,16 @@ bind -m emacs-standard '"\e^": history-expand-line' if [ $BASH_VERSINFO -gt 3 ]; then bind -m emacs-standard -x '"\C-t": "fzf-file-widget"' elif __fzf_use_tmux__; then - bind -m emacs-standard '"\C-t": " \C-u \C-a\C-k`__fzf_select_tmux__`\e\C-e\C-y\C-a\C-d\C-y\ey\C-h"' + bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select_tmux__`\e\C-e\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"' else - bind -m emacs-standard '"\C-t": " \C-u \C-a\C-k`__fzf_select__`\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er \C-h"' + 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"' 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\e^"' +bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er\e^"' # ALT-C - cd into the selected directory -bind -m emacs-standard '"\ec": " \C-e\C-u`__fzf_cd__`\e\C-e\er\C-m"' +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 '"\C-z": emacs-editing-mode' bind -m vi-insert '"\C-z": emacs-editing-mode'