From 3f868fd792eb70edf3530352d50a25ce833c033d Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 16 Feb 2018 21:55:23 +0900 Subject: [PATCH] [bash] Fix CTRL-R to preserve the latest yank Close #1216 1. Append a single space so that step 3 won't fail 2. CTRL-E to move to the end of the line 3. CTRL-U to delete the whole line before the cursor 4. CTRL-Y to paste the deleted line 5. ESC+Y to rotate the kill ring and bring back the previous yank before step 3 6. CTRL-U to delete the whole line again 7. Paste `__fzf_history__` 8. ESC+CTRL-E to expand the command substitution 9. ESC+R to redraw the line 10. ESC+^ to expand the history entry (!NUMBER) --- shell/key-bindings.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index 91ef1ec..29c5c96 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -80,7 +80,7 @@ if [[ ! -o vi ]]; then fi # CTRL-R - Paste the selected command from history into the command line - bind '"\C-r": " \C-e\C-u`__fzf_history__`\e\C-e\er\e^"' + bind '"\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 '"\ec": " \C-e\C-u`__fzf_cd__`\e\C-e\er\C-m"'