diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-04-23 22:31:23 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-04-23 22:31:23 +0900 |
| commit | 6ed9de9051660dff636a14d86ad31cc25973a04c (patch) | |
| tree | b8e91567aecb8386750052086c0126aa6c0f6712 /shell | |
| parent | 857619995ef54d66141fc4de882481fc6c44d186 (diff) | |
| download | fzf-6ed9de9051660dff636a14d86ad31cc25973a04c.tar.gz | |
[zsh] Temporarily unset no_bang_hist for CTRL-R
Close #214
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/key-bindings.zsh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index f8cbb715..451e418e 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -35,11 +35,16 @@ bindkey '\ec' fzf-cd-widget # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { - local selected + local selected restore_no_bang_hist if selected=$(fc -l 1 | $(__fzfcmd) +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r -q "$LBUFFER"); then num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g') LBUFFER=!$num + if setopt | grep nobanghist > /dev/null; then + restore_no_bang_hist=1 + unsetopt no_bang_hist + fi zle expand-history + [ -n "$restore_no_bang_hist" ] && setopt no_bang_hist fi zle redisplay } |
