feat(bash): alias completions
This commit is contained in:
16
modules/home/bash.nix
Normal file
16
modules/home/bash.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let cfg = config.sydnix.bash;
|
||||||
|
in {
|
||||||
|
options.sydnix.bash = {
|
||||||
|
enable = lib.mkEnableOption "Bash";
|
||||||
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./bash/complete-alias.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
programs.bash.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
16
modules/home/bash/complete-alias.nix
Normal file
16
modules/home/bash/complete-alias.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.sydnix.bash.complete-alias;
|
||||||
|
in {
|
||||||
|
options.sydnix.bash.complete-alias = {
|
||||||
|
enable = lib.mkEnableOption "Alias completion";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
programs.bash.initExtra = lib.mkAfter ''
|
||||||
|
. ${lib.getExe pkgs.complete-alias}
|
||||||
|
complete -F _complete_alias "''${!BASH_ALIASES[@]}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,9 +6,10 @@ in {
|
|||||||
options.sydnix.users.msyds.bash.enable =
|
options.sydnix.users.msyds.bash.enable =
|
||||||
lib.mkEnableOption "Bash, à la msyds";
|
lib.mkEnableOption "Bash, à la msyds";
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
programs.bash = {
|
sydnix.bash.enable = true;
|
||||||
enable = true;
|
sydnix.bash.complete-alias.enable = true;
|
||||||
shellOptions = [
|
|
||||||
|
programs.bash.shellOptions = [
|
||||||
# Correct minor typos in cd commands.
|
# Correct minor typos in cd commands.
|
||||||
"cdspell"
|
"cdspell"
|
||||||
# Implicitly prepend `cd` to directory names.
|
# Implicitly prepend `cd` to directory names.
|
||||||
@@ -24,7 +25,6 @@ in {
|
|||||||
# Re-edit failed history substitutions.
|
# Re-edit failed history substitutions.
|
||||||
"histreedit"
|
"histreedit"
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
home.shellAliases = {
|
home.shellAliases = {
|
||||||
nix2json = "nix eval --impure --json --file -";
|
nix2json = "nix eval --impure --json --file -";
|
||||||
|
|||||||
Reference in New Issue
Block a user