2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-18 09:28:40 +00:00

[fish] Use builtins for cd and history (#3830)

Close #3826
This commit is contained in:
LangLangBart 2024-06-01 04:28:02 +02:00 committed by GitHub
parent e33fb59da1
commit dbe8dc344e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,16 +69,16 @@ function fzf_key_bindings
if type -P perl > /dev/null 2>&1
set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")
set -lx FZF_DEFAULT_OPTS_FILE ''
history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | command perl -pe 's/^\d*\t//' | read -lz result
builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | command perl -pe 's/^\d*\t//' | read -lz result
and commandline -- $result
else
set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "--scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")
set -lx FZF_DEFAULT_OPTS_FILE ''
history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result
builtin history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result
and commandline -- $result
end
else
history | eval (__fzfcmd) -q '(commandline)' | read -l result
builtin history | eval (__fzfcmd) -q '(commandline)' | read -l result
and commandline -- $result
end
end
@ -99,7 +99,7 @@ function fzf_key_bindings
eval (__fzfcmd)' +m --query "'$fzf_query'"' | read -l result
if [ -n "$result" ]
cd -- $result
builtin cd -- $result
# Remove last token from commandline.
commandline -t ""