From 91dc8e5070d04992f24683a0c20a909424e31848 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sun, 24 May 2026 10:07:24 +0200 Subject: [PATCH] feat(jujutsu): enable jujutsu shell autocompletion --- users/modules/dev/vcs/jujutsu.nix | 6 ++++++ users/modules/shell/bash.nix | 1 + users/modules/shell/default.nix | 6 +++--- users/modules/shell/fish.nix | 1 + users/modules/shell/zsh.nix | 5 +++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/users/modules/dev/vcs/jujutsu.nix b/users/modules/dev/vcs/jujutsu.nix index 3a22dcd..9e8687f 100644 --- a/users/modules/dev/vcs/jujutsu.nix +++ b/users/modules/dev/vcs/jujutsu.nix @@ -40,6 +40,12 @@ in { enable = mkEnableOption "Enables jj-cz"; alias = mkEnableOption "Enable `jj cz` as an alias to `jj-cz`"; }; + # used in my shell .nix files + shellCompletion = mkOption { + description = "Enable Jujutsu shell completion"; + type = types.bool; + default = true; + }; }; config = mkIf cfg.enable { diff --git a/users/modules/shell/bash.nix b/users/modules/shell/bash.nix index f299d42..a5c5289 100644 --- a/users/modules/shell/bash.nix +++ b/users/modules/shell/bash.nix @@ -36,6 +36,7 @@ in { concatLines [ (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"'') + (strings.optionalString config.home.dev.vcs.jj.shellCompletion "source <(jj util completion bash)") cfg.bashrcExtra ]; enableCompletion = cfg.autocompletion; diff --git a/users/modules/shell/default.nix b/users/modules/shell/default.nix index bfaa354..dc1d9ff 100644 --- a/users/modules/shell/default.nix +++ b/users/modules/shell/default.nix @@ -97,15 +97,15 @@ in { config.home.shell = { enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable; bash = { - aliases = cfg.aliases // defaultAliases; + aliases = defaultAliases // cfg.aliases; enable = mkDefault cfg.fullDesktop; }; fish = { - abbrs = cfg.aliases // defaultAliases; + abbrs = defaultAliases // cfg.aliases; enable = mkDefault cfg.fullDesktop; }; zsh = { - abbrs = cfg.aliases // defaultAliases; + abbrs = defaultAliases // cfg.aliases; enable = mkDefault cfg.fullDesktop; }; }; diff --git a/users/modules/shell/fish.nix b/users/modules/shell/fish.nix index ab392ac..394c448 100644 --- a/users/modules/shell/fish.nix +++ b/users/modules/shell/fish.nix @@ -41,6 +41,7 @@ in { __fish_default_command_not_found_handler $argv end '' + (strings.optionalString config.home.dev.vcs.jj.shellCompletion "jj util completion fish | source") cfg.extraShellInit ]; plugins = [ diff --git a/users/modules/shell/zsh.nix b/users/modules/shell/zsh.nix index b098604..ca2997e 100644 --- a/users/modules/shell/zsh.nix +++ b/users/modules/shell/zsh.nix @@ -62,6 +62,11 @@ in { zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath' '' (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'') + (strings.optionalString config.home.dev.vcs.jj.shellCompletion '' + autoload -U compinit + compinit + source <(jj util completion zsh) + '') cfg.zshrcExtra ]; oh-my-zsh = {