mirror of
https://github.com/nix-community/home-manager
synced 2024-11-19 01:29:46 +01:00
kitty: always export KITTY_SHELL_INTEGRATION
This ensures that `KITTY_SHELL_INTEGRATION` is manually set to the user's `shellIntegration.mode`. This is necessary because sometimes the variable is not set in subshells or splits. `shellIntegration.mode` is also now ensured to always contain `no-rc`.
This commit is contained in:
parent
1683c507c2
commit
4740f2ccda
2 changed files with 13 additions and 5 deletions
|
@ -29,17 +29,20 @@ let
|
||||||
shellIntegrationInit = {
|
shellIntegrationInit = {
|
||||||
bash = ''
|
bash = ''
|
||||||
if test -n "$KITTY_INSTALLATION_DIR"; then
|
if test -n "$KITTY_INSTALLATION_DIR"; then
|
||||||
|
export KITTY_SHELL_INTEGRATION="${cfg.shellIntegration.mode}"
|
||||||
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
|
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
fish = ''
|
fish = ''
|
||||||
if set -q KITTY_INSTALLATION_DIR
|
if set -q KITTY_INSTALLATION_DIR
|
||||||
|
set --global KITTY_SHELL_INTEGRATION "${cfg.shellIntegration.mode}"
|
||||||
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
|
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
|
||||||
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
|
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
zsh = ''
|
zsh = ''
|
||||||
if test -n "$KITTY_INSTALLATION_DIR"; then
|
if test -n "$KITTY_INSTALLATION_DIR"; then
|
||||||
|
export KITTY_SHELL_INTEGRATION="${cfg.shellIntegration.mode}"
|
||||||
autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration
|
autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration
|
||||||
kitty-integration
|
kitty-integration
|
||||||
unfunction kitty-integration
|
unfunction kitty-integration
|
||||||
|
@ -48,9 +51,9 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
shellIntegrationDefaultOpt = {
|
shellIntegrationDefaultOpt = {
|
||||||
default = cfg.shellIntegration.mode != "disabled";
|
default = !(elem "disabled" (splitString " " cfg.shellIntegration.mode));
|
||||||
defaultText = literalExpression ''
|
defaultText = literalExpression ''
|
||||||
config.programs.kitty.shellIntegration.mode != "disabled"
|
!(elem "disabled" (splitString " " config.programs.kitty.shellIntegration.mode))
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -141,8 +144,13 @@ in {
|
||||||
shellIntegration = {
|
shellIntegration = {
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "enabled";
|
default = "no-rc";
|
||||||
example = "no-cursor";
|
example = "no-cursor";
|
||||||
|
apply = (o:
|
||||||
|
let
|
||||||
|
modes = splitString " " o;
|
||||||
|
filtered = filter (m: m != "no-rc") modes;
|
||||||
|
in concatStringsSep " " (concatLists [ [ "no-rc" ] filtered ]));
|
||||||
description = ''
|
description = ''
|
||||||
Set the mode of the shell integration. This accepts the same options
|
Set the mode of the shell integration. This accepts the same options
|
||||||
as the `shell_integration` option of Kitty. Note that
|
as the `shell_integration` option of Kitty. Note that
|
||||||
|
@ -197,7 +205,7 @@ in {
|
||||||
'')
|
'')
|
||||||
''
|
''
|
||||||
# Shell integration is sourced and configured manually
|
# Shell integration is sourced and configured manually
|
||||||
shell_integration no-rc ${cfg.shellIntegration.mode}
|
shell_integration ${cfg.shellIntegration.mode}
|
||||||
''
|
''
|
||||||
(toKittyConfig cfg.settings)
|
(toKittyConfig cfg.settings)
|
||||||
(toKittyKeybindings cfg.keybindings)
|
(toKittyKeybindings cfg.keybindings)
|
||||||
|
|
|
@ -5,7 +5,7 @@ font_size 8
|
||||||
|
|
||||||
|
|
||||||
# Shell integration is sourced and configured manually
|
# Shell integration is sourced and configured manually
|
||||||
shell_integration no-rc enabled
|
shell_integration no-rc
|
||||||
|
|
||||||
enable_audio_bell no
|
enable_audio_bell no
|
||||||
scrollback_lines 10000
|
scrollback_lines 10000
|
||||||
|
|
Loading…
Reference in a new issue