mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 08:47:47 +02:00
Use the fish built-in function name to report current working directory
If the feature is enabled by fish in the future, it will override the built-in one and there will be no duplicate reporting.
This commit is contained in:
@@ -97,12 +97,13 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
|
||||
|
||||
# Enable CWD reporting
|
||||
if not contains "no-cwd" $_ksi
|
||||
# This is actually builtin to fish but stupidly gated on TERM
|
||||
# https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_config_interactive.fish#L257
|
||||
function __ksi_report_cwd --on-variable PWD --description "Report PWD changes to the terminal"
|
||||
status --is-command-substitution; and return
|
||||
echo -en "\e]7;kitty-shell-cwd://$hostname$PWD\a"
|
||||
# This function name is from fish and will override the builtin one if fish enabled this feature by default.
|
||||
# We provide this to ensure that fish 3.2.0 and above will work.
|
||||
# https://github.com/fish-shell/fish-shell/blob/3.2.0/share/functions/__fish_config_interactive.fish#L275
|
||||
function __update_cwd_osc --on-variable PWD -d "Report PWD changes to kitty"
|
||||
status is-command-substitution
|
||||
or echo -en "\e]7;kitty-shell-cwd://$hostname$PWD\a"
|
||||
end
|
||||
__ksi_report_cwd
|
||||
__update_cwd_osc
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user