Repository: junegunn/fzf (language: go)

Issue:
Use `builtin cd` in fzf Alt+C Key Bindings for Fish Shell
### Checklist

- [X] I have read through the manual page (`man fzf`)
- [X] I have searched through the existing issues
- [X] For bug reports, I have checked if the bug is reproducible in the latest version of fzf

### Output of `fzf --version`

0.52.0 (bcda25a5)

### OS

- [X] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.

### Shell

- [ ] bash
- [ ] zsh
- [X] fish

### Problem / Steps to reproduce

I'm encountering an issue with the `Alt+C` key binding in the Fish shell when using zoxide, which overrides the cd command. When I activate the Alt+C shortcut, it is not calling the builtin cd because of the alias setup by zoxide, leading to a failure in switching directories.

I think changing [this line](https://github.com/junegunn/fzf/blob/124cd70710cb7c94ef2282773494bb0d727598d8/shell/key-bindings.fish#L96) to `builtin cd -- $result` is sufficient to solve this problem.

This modification is aligned with the implementation in the [Bash script](https://github.com/junegunn/fzf/blob/124cd70710cb7c94ef2282773494bb0d727598d8/shell/key-bindings.bash#L54), where builtin cd is explicitly used to avoid similar conflicts.


Discussion / hints:

Fix patch:
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index 444279cc709..d1db09bc185 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -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 ""


Test patch: