mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
Move zoxide into the shell-alias module
This commit is contained in:
parent
f649437b2f
commit
c245e9422a
2 changed files with 50 additions and 48 deletions
|
|
@ -8,51 +8,58 @@
|
||||||
options.custom.programs.shell.aliases.enable = lib.mkEnableOption "";
|
options.custom.programs.shell.aliases.enable = lib.mkEnableOption "";
|
||||||
|
|
||||||
config = lib.mkIf config.custom.programs.shell.aliases.enable {
|
config = lib.mkIf config.custom.programs.shell.aliases.enable {
|
||||||
home.packages = [
|
programs.zoxide = {
|
||||||
pkgs.eza
|
enable = true;
|
||||||
pkgs.bat
|
options = [ "--cmd cd" ];
|
||||||
];
|
};
|
||||||
|
|
||||||
home.shellAliases =
|
home = {
|
||||||
let
|
packages = [
|
||||||
lsAliases =
|
pkgs.eza
|
||||||
let
|
pkgs.bat
|
||||||
eza = [ "eza" "--header" "--group" "--time-style=long-iso" "--group-directories-first" "--sort=name" "--icons=auto" "--git" "--git-repos-no-status" "--binary" ];
|
];
|
||||||
aliasPartsToCommand =
|
|
||||||
aliasParts:
|
shellAliases =
|
||||||
aliasParts
|
let
|
||||||
|> lib.filter (aliasPart: aliasPart != "")
|
lsAliases =
|
||||||
|> lib.map (aliasPart:
|
let
|
||||||
|
eza = [ "eza" "--header" "--group" "--time-style=long-iso" "--group-directories-first" "--sort=name" "--icons=auto" "--git" "--git-repos-no-status" "--binary" ];
|
||||||
|
aliasPartsToCommand =
|
||||||
|
aliasParts:
|
||||||
|
aliasParts
|
||||||
|
|> lib.filter (aliasPart: aliasPart != "")
|
||||||
|
|> lib.map (aliasPart:
|
||||||
|
{
|
||||||
|
"l" = "--oneline --dereference";
|
||||||
|
"ll" = "--long";
|
||||||
|
"lt" = "--tree";
|
||||||
|
"a" = "--all";
|
||||||
|
"d" = "--only-dirs";
|
||||||
|
"f" = "--only-files";
|
||||||
|
}
|
||||||
|
.${aliasPart})
|
||||||
|
|> (flags: eza ++ flags)
|
||||||
|
|> lib.concatStringsSep " ";
|
||||||
|
in
|
||||||
|
{ format = [ "l" "ll" "lt" ]; visibility = [ "" "a" ]; restriction = [ "" "d" "f" ]; }
|
||||||
|
|> lib.mapCartesianProduct ({ format, visibility, restriction, }: [ format visibility restriction ])
|
||||||
|
|> lib.map (aliasParts: lib.nameValuePair (lib.concatStrings aliasParts) (aliasPartsToCommand aliasParts))
|
||||||
|
|> lib.listToAttrs;
|
||||||
|
in
|
||||||
|
lsAliases // {
|
||||||
|
ls = "l";
|
||||||
|
btm = "btm --group_processes";
|
||||||
|
cat =
|
||||||
|
let
|
||||||
|
theme =
|
||||||
{
|
{
|
||||||
"l" = "--oneline --dereference";
|
dark = "";
|
||||||
"ll" = "--long";
|
light = "GitHub";
|
||||||
"lt" = "--tree";
|
|
||||||
"a" = "--all";
|
|
||||||
"d" = "--only-dirs";
|
|
||||||
"f" = "--only-files";
|
|
||||||
}
|
}
|
||||||
.${aliasPart})
|
.${config.custom.theme};
|
||||||
|> (flags: eza ++ flags)
|
in
|
||||||
|> lib.concatStringsSep " ";
|
"bat --plain --theme=${theme}";
|
||||||
in
|
};
|
||||||
{ format = [ "l" "ll" "lt" ]; visibility = [ "" "a" ]; restriction = [ "" "d" "f" ]; }
|
};
|
||||||
|> lib.mapCartesianProduct ({ format, visibility, restriction, }: [ format visibility restriction ])
|
|
||||||
|> lib.map (aliasParts: lib.nameValuePair (lib.concatStrings aliasParts) (aliasPartsToCommand aliasParts))
|
|
||||||
|> lib.listToAttrs;
|
|
||||||
in
|
|
||||||
lsAliases // {
|
|
||||||
ls = "l";
|
|
||||||
btm = "btm --group_processes";
|
|
||||||
cat =
|
|
||||||
let
|
|
||||||
theme =
|
|
||||||
{
|
|
||||||
dark = "";
|
|
||||||
light = "GitHub";
|
|
||||||
}
|
|
||||||
.${config.custom.theme};
|
|
||||||
in
|
|
||||||
"bat --plain --theme=${theme}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,6 @@
|
||||||
|
|
||||||
fzf.enable = true;
|
fzf.enable = true;
|
||||||
|
|
||||||
zoxide = {
|
|
||||||
enable = true;
|
|
||||||
options = [ "--cmd cd" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
direnv = {
|
direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue