mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-08 21:25:32 +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:
@@ -75,7 +75,7 @@ fi
|
||||
# which is not available on older bash
|
||||
builtin declare -A _ksi_prompt
|
||||
_ksi_prompt=(
|
||||
[cursor]='y' [title]='y' [mark]='y' [complete]='y' [cwd]='y' [ps0]='' [ps0_suffix]='' [ps1]='' [ps1_suffix]='' [ps2]=''
|
||||
[cursor]='y' [title]='y' [mark]='y' [complete]='y' [cwd]='y' [sudo]='y' [ps0]='' [ps0_suffix]='' [ps1]='' [ps1_suffix]='' [ps2]=''
|
||||
[hostname_prefix]='' [sourced]='y' [last_reported_cwd]=''
|
||||
)
|
||||
|
||||
@@ -89,6 +89,7 @@ _ksi_main() {
|
||||
"no-prompt-mark") _ksi_prompt[mark]='n';;
|
||||
"no-complete") _ksi_prompt[complete]='n';;
|
||||
"no-cwd") _ksi_prompt[cwd]='n';;
|
||||
"no-sudo") _ksi_prompt[sudo]='n';;
|
||||
esac
|
||||
done
|
||||
IFS="$ifs"
|
||||
@@ -211,6 +212,11 @@ _ksi_main() {
|
||||
|
||||
builtin alias edit-in-kitty="kitten edit-in-kitty"
|
||||
|
||||
if [[ "${_ksi_prompt[sudo]}" == "y" ]]; then
|
||||
# Ensure terminfo is available in sudo
|
||||
[[ -n "$TERMINFO" ]] && builtin alias sudo="sudo TERMINFO=\"$TERMINFO\""
|
||||
fi
|
||||
|
||||
if [[ "${_ksi_prompt[complete]}" == "y" ]]; then
|
||||
_ksi_completions() {
|
||||
builtin local src
|
||||
|
||||
Reference in New Issue
Block a user