feat(jujutsu): enable jujutsu shell autocompletion
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user