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 = { sessionVariables = {
LESS = "-R --use-color"; LESS = "-R --use-color";
LESSHISTFILE = "-"; 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 let
plugins = "${pkgs.nu_scripts}/share/nu_scripts"; plugins = "${pkgs.nu_scripts}/share/nu_scripts";
shellAliases = lib.concatStringsSep "\n" (
lib.mapAttrsToList (k: v: "alias ${k} = ${v}") config.home.shellAliases
);
mkCompletions = mkCompletions =
completions: completions:
lib.concatStringsSep "\n" ( lib.concatStringsSep "\n" (
@ -49,6 +58,7 @@ in
'' ''
source ${plugins}/aliases/git/git-aliases.nu source ${plugins}/aliases/git/git-aliases.nu
'' ''
+ shellAliases
+ mkCompletions completions; + mkCompletions completions;
}; };

View file

@ -88,6 +88,9 @@ in
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh"; file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
} }
]; ];
sessionVariables = {
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
};
shellAliases = { shellAliases = {
cat = "bat"; cat = "bat";
@ -101,13 +104,6 @@ in
cp = "cp -i"; cp = "cp -i";
mv = "mv -i"; mv = "mv -i";
rm = "rm -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"; history.path = "${config.xdg.configHome}/zsh/history";
}; };