From d3515c0964b46450d079282c64f58ac0edfccf56 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Wed, 1 May 2024 20:02:36 +0200 Subject: [PATCH] Slightly simplify the ls aliases --- modules/home/shell/enhancement.nix | 35 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/modules/home/shell/enhancement.nix b/modules/home/shell/enhancement.nix index 3f902e9..68fd4c7 100644 --- a/modules/home/shell/enhancement.nix +++ b/modules/home/shell/enhancement.nix @@ -17,28 +17,25 @@ home.shellAliases = let lsAliases = let list = "${lib.getExe pkgs.eza} --header --group --time-style=long-iso --group-directories-first --sort=name --icons=auto --git --git-repos-no-status --binary"; + + getFlag = alias: + { + a = "--all"; + d = "--only-dirs"; + f = "--only-files"; + } + .${alias}; + convertAliasesToFlags = str: "${lib.concatStringsSep " " (lib.forEach (lib.stringToCharacters str) getFlag)}"; flagCombos = lib.crossLists (a: b: "${a}${b}") [["" "a"] ["" "d" "f"]]; - getFlags = str: - lib.concatStringsSep " " (lib.forEach (lib.stringToCharacters str) (x: - { - a = "--all"; - d = "--only-dirs"; - f = "--only-files"; - } - .${x})); + flaggedAliases = lib.concatMapAttrs (name: value: { - "l${name}" = "l ${value}"; - "ll${name}" = "ll ${value}"; - "lt${name}" = "lt ${value}"; - }) (lib.genAttrs flagCombos (str: "${getFlags str}")); + "l${name}" = "${list} --oneline --dereference ${value}"; + "ll${name}" = "${list} --long ${value}"; + "lt${name}" = "${list} --tree ${value}"; + }) + (lib.genAttrs flagCombos convertAliasesToFlags); in - flaggedAliases - // { - ls = "l"; - l = "${list} --oneline --dereference"; - ll = "${list} --long"; - lt = "${list} --tree"; - }; + flaggedAliases // {ls = "l";}; catAlias = let theme =