fish: pwd reporting

This commit is contained in:
Mitchell Hashimoto
2023-07-06 16:15:30 -07:00
parent ad62e3ac1b
commit efd7cb35b8

View File

@ -80,12 +80,22 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
echo -en "\e]133;D;$status\a" echo -en "\e]133;D;$status\a"
end end
# Report pwd. This is actually built-in to fish but only for terminals
# that match an allowlist and that isn't us.
function __update_cwd_osc --on-variable PWD -d 'Notify capable terminals when $PWD changes'
if status --is-command-substitution || set -q INSIDE_EMACS
return
end
printf \e\]7\;file://%s%s\a $hostname (string escape --style=url $PWD)
end
# Enable fish to handle reflow because Ghostty clears the prompt on resize. # Enable fish to handle reflow because Ghostty clears the prompt on resize.
set --global fish_handle_reflow 1 set --global fish_handle_reflow 1
# Initial calls for first prompt # Initial calls for first prompt
__ghostty_set_cursor_beam __ghostty_set_cursor_beam
__ghostty_mark_prompt_start __ghostty_mark_prompt_start
__update_cwd_osc
end end
ghostty_exit ghostty_exit