summaryrefslogtreecommitdiff
path: root/shell/key-bindings.fish
diff options
context:
space:
mode:
authorbitraid <bitraid@protonmail.ch>2025-01-12 03:27:26 +0200
committerGitHub <noreply@github.com>2025-01-12 10:27:26 +0900
commit22b498489cbefe6bd772d5cbdba21bde2166d73e (patch)
tree16df78d2e84d9e31d21a323f87ca3ee87bd639b7 /shell/key-bindings.fish
parent5460517bd2ecf5c3437cfe77821b3cf524bc69d5 (diff)
downloadfzf-22b498489cbefe6bd772d5cbdba21bde2166d73e.tar.gz
[fish] Optimize history formatting without perl (#4171)
Diffstat (limited to 'shell/key-bindings.fish')
-rw-r--r--shell/key-bindings.fish9
1 files changed, 4 insertions, 5 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index e14edfb5..31552357 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -73,11 +73,10 @@ function fzf_key_bindings
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 result
and commandline -- $result
else
- set -l line 0
- for i in (builtin history -z --reverse | string split0)
- set line (math $line + 1)
- string escape -n -- $line\t(string replace -a -- \n \n\t $i | string collect)
- end | string join0 | string unescape -n | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result
+ set -l h (builtin history -z | string split0)
+ for i in (seq (count $h) -1 1)
+ string join0 -- $i\t(string replace -a -- \n \n\t $h[$i] | string collect)
+ end | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | string replace -r '^\d*\t' '' | read -lz result
and commandline -- $result
end
else