Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Prepend each entry with an index number so that multi-line entries can be clearly distinguished.

authored by Junegunn Choi · committed by Junegunn Choi · parent ed53ef7 · Browse files · 1 file+7 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:shell/key-bindings.fish+7 added-2 removed
67 unmodified lines
68 # history's -z flag is needed for multi-line support.69 # history's -z flag was added in fish 2.4.0, so don't use it for versions70 # before 2.4.0.71 if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];72 if type -q perl73 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 result74 and commandline -- $result75 else72 history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result73 and commandline -- $result76 history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result77 and commandline -- $result78 end79 else80 history | eval (__fzfcmd) -q '(commandline)' | read -l result81 and commandline -- $result82 end
109 unmodified lines