13 lines
367 B
Plaintext
13 lines
367 B
Plaintext
__fzfcmd() {
|
|
[ ${FZF_TMUX:-1} -eq 1 ] && echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" || echo "fzf"
|
|
}
|
|
|
|
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=$selected[1]
|
|
if [ -n "$num" ]; then
|
|
zle vi-fetch-history -n $num
|
|
fi
|
|
fi
|
|
zle redisplay
|