From ceb7c440a19acc4459f87882309e876070997d16 Mon Sep 17 00:00:00 2001 From: pagedown Date: Sat, 15 Jan 2022 00:16:26 +0800 Subject: [PATCH] Shell integration: Only override default fish_title --- .../kitty-shell-integration.fish | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish b/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish index 1eb993ce9..ca994f97f 100644 --- a/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish +++ b/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish @@ -55,13 +55,21 @@ function _ksi_main end if not contains "no-title" $_ksi - function fish_title - if set -q argv[1] - echo $argv[1] - else - prompt_pwd + function _ksi_function_is_not_overridden -d "Check if the specified function is not overridden" + string match -q -- "$__fish_data_dir/functions/*" (functions --details $argv[1]) + end + + if _ksi_function_is_not_overridden fish_title + function fish_title + if set -q argv[1] + echo $argv[1] + else + prompt_pwd + end end end + + functions --erase _ksi_function_is_not_overridden end if not contains "no-prompt-mark" $_ksi @@ -131,6 +139,8 @@ function _ksi_main # with prompt marking kitty clears the current prompt on resize so we need # fish to redraw it set --global fish_handle_reflow 1 + + functions --erase _ksi_function_is_not_empty end functions --erase _ksi_main _ksi_schedule end