nushell: remove redundant abbreviations option

Nushell abbreviations are regular config settings, so users can already express them through programs.nushell.settings.abbreviations. Keep test coverage on that native path instead of maintaining a second option.
This commit is contained in:
Austin Horstman
2026-06-08 13:35:42 -05:00
parent e9cbe69850
commit df39142474
3 changed files with 6 additions and 31 deletions
-21
View File
@@ -191,21 +191,6 @@ in
''; '';
}; };
abbreviations = lib.mkOption {
type = types.attrsOf types.str;
default = { };
example = {
ll = "ls -l";
gs = "git status";
};
description = ''
An attribute set that maps each abbreviation (the top level attribute
names in this option) to its expansion. Unlike aliases, abbreviations
are expanded inline in the line editor when a space or enter is pressed,
so the expanded command is what ends up in the command history.
'';
};
environmentVariables = lib.mkOption { environmentVariables = lib.mkOption {
type = types.attrsOf lib.hm.types.nushellValue; type = types.attrsOf lib.hm.types.nushellValue;
default = { }; default = { };
@@ -247,16 +232,11 @@ in
|| cfg.extraConfig != "" || cfg.extraConfig != ""
|| aliasesStr != "" || aliasesStr != ""
|| cfg.settings != { } || cfg.settings != { }
|| cfg.abbreviations != { }
|| cfg.environmentVariables != { }; || cfg.environmentVariables != { };
aliasesStr = lib.concatLines ( aliasesStr = lib.concatLines (
lib.mapAttrsToList (k: v: "alias ${toNushell { } k} = ${v}") cfg.shellAliases lib.mapAttrsToList (k: v: "alias ${toNushell { } k} = ${v}") cfg.shellAliases
); );
abbreviationsStr =
lib.optionalString (cfg.abbreviations != { })
"$env.config.abbreviations = ${toNushell { } cfg.abbreviations}";
in in
lib.mkIf writeConfig { lib.mkIf writeConfig {
"${cfg.configDir}/config.nu".text = lib.mkMerge [ "${cfg.configDir}/config.nu".text = lib.mkMerge [
@@ -295,7 +275,6 @@ in
(lib.mkIf (cfg.configFile != null) cfg.configFile.text) (lib.mkIf (cfg.configFile != null) cfg.configFile.text)
cfg.extraConfig cfg.extraConfig
aliasesStr aliasesStr
abbreviationsStr
]; ];
} }
) )
@@ -13,6 +13,8 @@ load-env {
"PROMPT_COMMAND": ({|| "> "}) "PROMPT_COMMAND": ({|| "> "})
} }
$env.config.abbreviations.gs = "git status"
$env.config.abbreviations.ll = "ls -l"
$env.config.display_errors.exit_code = false $env.config.display_errors.exit_code = false
$env.config.hooks.pre_execution = [ $env.config.hooks.pre_execution = [
({|| "pre_execution hook"}) ({|| "pre_execution hook"})
@@ -29,8 +31,3 @@ let config = {
alias "ll" = ls -a alias "ll" = ls -a
alias "multi word alias" = cd - alias "multi word alias" = cd -
alias "z" = __zoxide_z alias "z" = __zoxide_z
$env.config.abbreviations = {
"gs": "git status"
"ll": "ls -l"
}
@@ -38,12 +38,11 @@
"z" = "__zoxide_z"; "z" = "__zoxide_z";
}; };
abbreviations = {
"gs" = "git status";
"ll" = "ls -l";
};
settings = { settings = {
abbreviations = {
"gs" = "git status";
"ll" = "ls -l";
};
show_banner = false; show_banner = false;
display_errors.exit_code = false; display_errors.exit_code = false;
hooks.pre_execution = [ (lib.hm.nushell.mkNushellInline ''{|| "pre_execution hook"}'') ]; hooks.pre_execution = [ (lib.hm.nushell.mkNushellInline ''{|| "pre_execution hook"}'') ];