feat(shell): improve shell completion

This commit is contained in:
2026-01-25 16:19:09 +01:00
parent 582460d8f4
commit 5d9efbb651
5 changed files with 24 additions and 2 deletions

View File

@@ -34,8 +34,9 @@ in {
config = { config = {
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
time.timeZone = cfg.timezone;
console.keyMap = cfg.keymap; console.keyMap = cfg.keymap;
time.timeZone = cfg.timezone;
environment.pathsToLink = ["/share/bash-completion" "/share/zsh"];
services = { services = {
orca.enable = false; orca.enable = false;
envfs.enable = true; envfs.enable = true;

View File

@@ -16,6 +16,11 @@ in {
lns = "ln -si"; lns = "ln -si";
}; };
}; };
autocompletion = mkOption {
type = types.bool;
default = config.home.shell.autocompletion;
example = true;
};
eatIntegration = mkEnableOption "Enable Emacs Eat integration"; eatIntegration = mkEnableOption "Enable Emacs Eat integration";
bashrcExtra = mkOption { bashrcExtra = mkOption {
type = types.lines; type = types.lines;
@@ -33,6 +38,7 @@ in {
(strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"'') (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"'')
cfg.bashrcExtra cfg.bashrcExtra
]; ];
enableCompletion = cfg.autocompletion;
shellAliases = cfg.aliases; shellAliases = cfg.aliases;
shellOptions = [ shellOptions = [
"histappend" "histappend"

View File

@@ -88,6 +88,10 @@ in {
default = {}; default = {};
example = {la = "ls -a";}; example = {la = "ls -a";};
}; };
autocompletion = mkOption {
type = types.bool;
default = true;
};
}; };
config.home.shell = { config.home.shell = {
enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable; enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable;

View File

@@ -17,6 +17,11 @@ in {
lns = "ln -si"; lns = "ln -si";
}; };
}; };
autocompletion = mkOption {
type = types.bool;
default = config.home.shell.autocompletion;
example = true;
};
extraShellInit = mkOption { extraShellInit = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
@@ -26,6 +31,7 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.fish = { programs.fish = {
enable = true; enable = true;
generateCompletions = cfg.autocompletion;
shellAbbrs = cfg.abbrs; shellAbbrs = cfg.abbrs;
preferAbbrs = true; preferAbbrs = true;
shellInit = with lib; shellInit = with lib;

View File

@@ -17,6 +17,11 @@ in {
lns = "ln -si"; lns = "ln -si";
}; };
}; };
autocompletion = mkOption {
type = types.bool;
default = config.home.shell.autocompletion;
example = true;
};
eatIntegration = mkEnableOption "Enable Emacs Eat integration"; eatIntegration = mkEnableOption "Enable Emacs Eat integration";
zshrcExtra = lib.mkOption { zshrcExtra = lib.mkOption {
type = types.lines; type = types.lines;
@@ -32,7 +37,7 @@ in {
enable = true; enable = true;
strategy = ["match_prev_cmd" "completion"]; strategy = ["match_prev_cmd" "completion"];
}; };
enableCompletion = true; enableCompletion = cfg.autocompletion;
enableVteIntegration = true; enableVteIntegration = true;
history = { history = {
findNoDups = true; findNoDups = true;