feat(nu): shell aliases

This commit is contained in:
winston 2024-05-16 16:21:04 +02:00
parent f00d86d1a1
commit 8224532f2c
Signed by: winston
GPG key ID: 3786770EDBC2B481
3 changed files with 22 additions and 9 deletions

View file

@ -8,7 +8,14 @@ in
sessionVariables = {
LESS = "-R --use-color";
LESSHISTFILE = "-";
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
};
shellAliases = {
# switch between yubikeys for the same GPG key
switch_yubikeys = ''gpg-connect-agent "scd serialno" "learn --force" "/bye"'';
# podman
docker = "podman";
docker-compose = "podman-compose";
};
};

View file

@ -1,7 +1,16 @@
{ lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
plugins = "${pkgs.nu_scripts}/share/nu_scripts";
shellAliases = lib.concatStringsSep "\n" (
lib.mapAttrsToList (k: v: "alias ${k} = ${v}") config.home.shellAliases
);
mkCompletions =
completions:
lib.concatStringsSep "\n" (
@ -49,6 +58,7 @@ in
''
source ${plugins}/aliases/git/git-aliases.nu
''
+ shellAliases
+ mkCompletions completions;
};

View file

@ -88,6 +88,9 @@ in
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
}
];
sessionVariables = {
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
};
shellAliases = {
cat = "bat";
@ -101,13 +104,6 @@ in
cp = "cp -i";
mv = "mv -i";
rm = "rm -i";
# switch between yubikeys for the same GPG key
switch_yubikeys = ''gpg-connect-agent "scd serialno" "learn --force" "/bye"'';
# podman
docker = "podman";
docker-compose = "podman-compose";
};
history.path = "${config.xdg.configHome}/zsh/history";
};