Remove unnecessary function checks

This commit is contained in:
pagedown 2022-02-27 00:08:36 +08:00
parent ef32488890
commit 121778e5c6
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB

View File

@ -32,18 +32,14 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
# Enable cursor shape changes for default mode and vi mode # Enable cursor shape changes for default mode and vi mode
if not contains "no-cursor" $_ksi if not contains "no-cursor" $_ksi
and not functions -q __ksi_set_cursor
function __ksi_block_cursor --on-event fish_preexec -d "Set cursor shape to blinking default shape before executing command"
echo -en "\e[0 q"
end
function __ksi_set_cursor --on-variable fish_key_bindings -d "Set the cursor shape for different modes when switching key bindings" function __ksi_set_cursor --on-variable fish_key_bindings -d "Set the cursor shape for different modes when switching key bindings"
if test "$fish_key_bindings" = fish_default_key_bindings if test "$fish_key_bindings" = fish_default_key_bindings
not functions -q __ksi_bar_cursor || return
function __ksi_bar_cursor --on-event fish_prompt -d "Set cursor shape to blinking bar on prompt" function __ksi_bar_cursor --on-event fish_prompt -d "Set cursor shape to blinking bar on prompt"
echo -en "\e[5 q" echo -en "\e[5 q"
end end
# Change the cursor shape on first run
set -q argv[1]
and __ksi_bar_cursor
else else
functions --erase __ksi_bar_cursor functions --erase __ksi_bar_cursor
contains "$fish_key_bindings" fish_vi_key_bindings fish_hybrid_key_bindings contains "$fish_key_bindings" fish_vi_key_bindings fish_hybrid_key_bindings
@ -66,9 +62,11 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
test "$fish_bind_mode" = "insert" && echo -en "\e[5 q" || echo -en "\e[1 q" test "$fish_bind_mode" = "insert" && echo -en "\e[5 q" || echo -en "\e[1 q"
end end
__ksi_set_cursor function __ksi_default_cursor --on-event fish_preexec -d "Set cursor shape to blinking default shape before executing command"
functions -q __ksi_bar_cursor echo -en "\e[0 q"
and __ksi_bar_cursor end
__ksi_set_cursor init
end end
# Enable prompt marking with OSC 133 # Enable prompt marking with OSC 133