mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 22:27:41 +00:00
[zsh] Do not change LBUFFER on empty selection (CTRL-R)
This commit is contained in:
parent
6ed9de9051
commit
36924d0b1c
@ -38,13 +38,15 @@ fzf-history-widget() {
|
|||||||
local selected restore_no_bang_hist
|
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
|
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')
|
num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g')
|
||||||
LBUFFER=!$num
|
if [ -n "$num" ]; then
|
||||||
if setopt | grep nobanghist > /dev/null; then
|
LBUFFER=!$num
|
||||||
restore_no_bang_hist=1
|
if setopt | grep nobanghist > /dev/null; then
|
||||||
unsetopt no_bang_hist
|
restore_no_bang_hist=1
|
||||||
|
unsetopt no_bang_hist
|
||||||
|
fi
|
||||||
|
zle expand-history
|
||||||
|
[ -n "$restore_no_bang_hist" ] && setopt no_bang_hist
|
||||||
fi
|
fi
|
||||||
zle expand-history
|
|
||||||
[ -n "$restore_no_bang_hist" ] && setopt no_bang_hist
|
|
||||||
fi
|
fi
|
||||||
zle redisplay
|
zle redisplay
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user