palette/home-manager/fish.nix
George Kaklamanos 09a595c8db
fish: Add nix shell functions
Signed-off-by: George Kaklamanos <gkaklas@gkaklas.gr>
2025-05-21 15:18:40 +03:00

73 lines
2.3 KiB
Nix

{pkgs, ...}: {
programs.fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting
'';
plugins = [
{
name = "done";
src = pkgs.fishPlugins.done.src;
}
{
name = "fzf-fish";
src = pkgs.fishPlugins.fzf-fish.src;
}
];
shellAliases = {
# My defaults
"ls" = "eza";
"dig" = "dig +noall +answer";
"ffmpeg" = "ffmpeg -hide_banner -loglevel error -stats -threads 10";
"rsync" = "rsync --info=progress2 --progress -rpgo --partial --inplace";
"df" = "df -x tmpfs -x devtmpfs -x efivarfs -h";
# Nix
"nrs" = "sudo nixos-rebuild switch --flake path:/home/gkaklas/nix/nixos/";
"upn" = "sudo nix flake update --flake path:/home/gkaklas/nix/nixos/";
"cln" = "sudo nix profile wipe-history --older-than 7d --profile /nix/var/nix/profiles/system";
"hms" = "home-manager switch --flake path:/home/gkaklas/nix/home-manager/";
"hm" = "home-manager --flake path:/home/gkaklas/nix/home-manager/";
"uph" = "nix flake update --flake path:/home/gkaklas/nix/home-manager/ ";
"clh" = "nix profile wipe-history --older-than 7d && home-manager expire-generations '-7 days'";
"update" = "upn && nrs && cln && uph && hms && clh && nix store gc && nix store optimise && ntfy pub kelly 'Update done!'";
# git
"gc" = "git commit --verbose --gpg-sign --signoff";
"gc!" = "git commit --verbose --gpg-sign --signoff --amend";
"gst" = "git status";
"gd" = "git diff";
"grbi" = "git rebase -i";
"grba" = "git rebase --abort";
"grbc" = "git rebase --continue";
"gdca" = "git diff --cached";
"gapa" = "git add --patched";
"glola" = "git log --graph --pretty=\"%G?-%C(magenta)%h %C(yellow)(%al)%C(cyan): %s\" --color=always";
# zellij + kelly + jelly + it's fun and memorable
"zelly" = "zellij attach -c main";
# TODO: I tried calling $EDITOR but it wouldn't work
"e" = "nvim";
"cdt" = "cd (mktemp -d)";
};
functions = {
ns = "nix shell nixpkgs#$argv[1]";
nss = "nix shell nixpkgs#$argv[1] -c $argv";
};
shellAbbrs = {
"-h" = {
position = "anywhere";
expansion = "--help";
};
"L" = {
position = "anywhere";
setCursor = true;
expansion = "% | less";
};
};
};
}