mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 09:48:09 +02:00
Shell integration now aliases sudo to make the kitty terminfo db available in the sudo environment
This should make terminfo completely transparent for most users on the local machine and on remote machines that are connected to with the ssh kitten.
This commit is contained in:
@@ -84,7 +84,7 @@ precmd_functions+=(_ksi_deferred_init)
|
||||
_ksi_deferred_init() {
|
||||
builtin emulate -L zsh -o no_warn_create_global -o no_aliases
|
||||
|
||||
# Recognized options: no-cursor, no-title, no-prompt-mark, no-complete, no-cwd.
|
||||
# Recognized options: no-cursor, no-title, no-prompt-mark, no-complete, no-cwd, no-sudo.
|
||||
builtin local -a opt
|
||||
opt=(${(s: :)KITTY_SHELL_INTEGRATION})
|
||||
builtin unset KITTY_SHELL_INTEGRATION
|
||||
@@ -388,6 +388,11 @@ _ksi_deferred_init() {
|
||||
|
||||
builtin alias edit-in-kitty="kitten edit-in-kitty"
|
||||
|
||||
if (( ! opt[(Ie)no-sudo] )); then
|
||||
# Ensure terminfo is available in sudo
|
||||
[[ -n "$TERMINFO" ]] && builtin alias sudo="sudo TERMINFO=\"$TERMINFO\""
|
||||
fi
|
||||
|
||||
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
|
||||
# of answering questions about it.
|
||||
[[ $(builtin bindkey "^[[1;3C") == *" undefined-key" ]] && builtin bindkey "^[[1;3C" "forward-word"
|
||||
|
||||
Reference in New Issue
Block a user