2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-16 12:12:48 +00:00

[fish] Better multi-line support for CTRL-R

Prepend each entry with an index number so that multi-line entries can
be clearly distinguished.
This commit is contained in:
Junegunn Choi 2024-05-29 20:14:56 +09:00
parent ed53ef7cee
commit b4f2cde5ac
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -69,8 +69,13 @@ function fzf_key_bindings
# history's -z flag was added in fish 2.4.0, so don't use it for versions # history's -z flag was added in fish 2.4.0, so don't use it for versions
# before 2.4.0. # before 2.4.0.
if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ]; if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];
history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result if type -q perl
and commandline -- $result history -z --reverse | perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | sed 's/^[0-9]*\t//' | read -lz result
and commandline -- $result
else
history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result
and commandline -- $result
end
else else
history | eval (__fzfcmd) -q '(commandline)' | read -l result history | eval (__fzfcmd) -q '(commandline)' | read -l result
and commandline -- $result and commandline -- $result