Skip to content
Myr

[fish] Optimize history formatting without perl (#4171)

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

authored by bitraid · committed by GitHub · parent 5460517 · Browse files · 1 file+4 added−5 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+4 added−5 removed

  • other:+4 added−5 removed

1 file+4 added−5 removed

modified:shell/key-bindings.fish+4 added-5 removed
71 unmodified lines
72 if type -q perl73 builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result74 and commandline -- $result75 else76 set -l line 077 for i in (builtin history -z --reverse | string split0)78 set line (math $line + 1)79 string escape -n -- $line\t(string replace -a -- \n \n\t $i | string collect)80 end | string join0 | string unescape -n | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result76 set -l h (builtin history -z | string split0)77 for i in (seq (count $h) -1 1)78 string join0 -- $i\t(string replace -a -- \n \n\t $h[$i] | string collect)79 end | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result80 and commandline -- $result81 end82 else83 builtin history | eval (__fzfcmd) -q '(commandline)' | read -l result
122 unmodified lines