mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-09 23:30:56 +00:00
parent
68c5bea3f8
commit
dd6138a655
7
install
7
install
@ -326,7 +326,12 @@ bindkey '\ec' fzf-cd-widget
|
||||
|
||||
# CTRL-R - Paste the selected command from history into the command line
|
||||
fzf-history-widget() {
|
||||
LBUFFER=$(fc -l 1 | fzf +s --tac +m -n2..,.. | sed "s/ *[0-9*]* *//")
|
||||
local selected
|
||||
if selected=$(fc -l 1 | fzf +s --tac +m -n2..,.. -q "$LBUFFER"); then
|
||||
num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g')
|
||||
LBUFFER=!$num
|
||||
zle expand-history
|
||||
fi
|
||||
zle redisplay
|
||||
}
|
||||
zle -N fzf-history-widget
|
||||
|
Loading…
Reference in New Issue
Block a user