fix: fish shell integration should not update the universal `fish_user_paths` variable (#9273)

`fish_add_path` by default updates the `fish_user_paths` universal
variable which makes the modification persist across shell sessions.

The integration also tries to update the `fish_user_paths` when the
desired path already appears in the `PATH` environment variable but not
in `fish_user_paths`. Because `fish_user_paths` will always be inserted
before the inherited `PATH` env. This makes the added path
unintentionally has a higher priority.

This patch fixes the above issues by adding `--global` and `--path`
options to `fish_user_paths` which limits the modification scope and
ensures that the path won't be added if it already exists in `PATH`.

Ref: https://fishshell.com/docs/current/cmds/fish_add_path.html
pull/9275/head
Mitchell Hashimoto 2025-10-19 08:19:01 -07:00 committed by GitHub
commit 94c5572029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
# Add Ghostty binary to PATH if the path feature is enabled
if contains path $features; and test -n "$GHOSTTY_BIN_DIR"
fish_add_path --append "$GHOSTTY_BIN_DIR"
fish_add_path --global --path --append "$GHOSTTY_BIN_DIR"
end
# When using sudo shell integration feature, ensure $TERMINFO is set