diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index 31552357..3d5c36e9 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -70,13 +70,15 @@ function fzf_key_bindings set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '"\t"↳ ' --highlight-line $FZF_CTRL_R_OPTS +m") set -lx FZF_DEFAULT_OPTS_FILE '' if type -q perl - 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 + set -l fzf_command (__fzfcmd) --tac --read0 --print0 -q (commandline) + builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | $fzf_command | string replace -r '^\d*\t' '' | read -lz result and commandline -- $result else set -l h (builtin history -z | string split0) + set -l fzf_command (__fzfcmd) --read0 --print0 -q (commandline) 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 + end | $fzf_command | string replace -r '^\d*\t' '' | read -lz result and commandline -- $result end else