mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 05:35:19 +02:00
Add an env var that can be used to eval an expression at startup of shell
This will come in handy to implement serialization as session with running of current foreground command.
This commit is contained in:
@@ -121,6 +121,8 @@ _ksi_main() {
|
||||
fi
|
||||
builtin unset SSH_KITTEN_KITTY_DIR
|
||||
fi
|
||||
builtin local krcs="$KITTY_SI_RUN_COMMAND_AT_STARTUP"
|
||||
builtin unset KITTY_SI_RUN_COMMAND_AT_STARTUP
|
||||
|
||||
_ksi_debug_print() {
|
||||
# print a line to STDERR of parent kitty process
|
||||
@@ -351,6 +353,7 @@ _ksi_main() {
|
||||
fi
|
||||
fi
|
||||
builtin unset KITTY_IS_CLONE_LAUNCH KITTY_CLONE_SOURCE_STRATEGIES
|
||||
if [[ -n "$krcs" ]]; then builtin eval "$krcs"; fi
|
||||
}
|
||||
_ksi_main
|
||||
builtin unset -f _ksi_main
|
||||
|
||||
@@ -37,6 +37,8 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
|
||||
end
|
||||
set --erase SSH_KITTEN_KITTY_DIR
|
||||
end
|
||||
set --local krcs "$KITTY_SI_RUN_COMMAND_AT_STARTUP"
|
||||
set --erase KITTY_SI_RUN_COMMAND_AT_STARTUP
|
||||
|
||||
# Enable cursor shape changes for default mode and vi mode
|
||||
if not contains "no-cursor" $_ksi
|
||||
@@ -201,6 +203,9 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
|
||||
test (count $new_path) -eq (count $PATH)
|
||||
or set --global --export --path PATH $new_path
|
||||
end
|
||||
if test -n "$krcs"
|
||||
eval "$krcs"
|
||||
end
|
||||
end
|
||||
|
||||
function edit-in-kitty --wraps "kitten edit-in-kitty" -d "Edit the specified file in a kitty overlay window with your locally installed editor"
|
||||
|
||||
@@ -88,6 +88,8 @@ _ksi_deferred_init() {
|
||||
builtin local -a opt
|
||||
opt=(${(s: :)KITTY_SHELL_INTEGRATION})
|
||||
builtin unset KITTY_SHELL_INTEGRATION
|
||||
builtin local krcs="$KITTY_SI_RUN_COMMAND_AT_STARTUP"
|
||||
builtin unset KITTY_SI_RUN_COMMAND_AT_STARTUP
|
||||
|
||||
if [[ -n "$SSH_KITTEN_KITTY_DIR" ]]; then
|
||||
if [[ ! "$PATH" =~ (^|:)${SSH_KITTEN_KITTY_DIR}(:|$) ]] && [[ -z "$(builtin command -v kitten)" ]]; then
|
||||
@@ -424,6 +426,9 @@ _ksi_deferred_init() {
|
||||
# kitty-integration though because decent public functions aren't supposed to
|
||||
# to unfunction themselves when invoked. Unfunctioning is done by calling code.
|
||||
builtin unfunction _ksi_deferred_init
|
||||
|
||||
# run startup command
|
||||
if [[ -n "$krcs" ]]; then builtin eval "$krcs"; fi
|
||||
}
|
||||
|
||||
_ksi_transmit_data() {
|
||||
|
||||
Reference in New Issue
Block a user