dotfiles/homes/modules/fish.nix

70 lines
1.7 KiB
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}: {
options = {
morphBashToFish = lib.mkEnableOption "morphBashToFish";
};
2025-08-02 22:45:40 +10:00
# TODO: make the greeting controllable (ie so my VPS can be different)
config = {
programs.fish = {
enable = true;
generateCompletions = true;
2025-08-12 21:11:38 +10:00
# vendor = {
# config.enable = true;
# functions.enable = true;
# completions.enable = true;
# };
interactiveShellInit = ''
# add dotnet completions if it exists (ie we're in a virtual environment)
if type -q dotnet
complete -f -c dotnet -a "(dotnet complete (commandline -cp))"
end
function rand_greet
set weary "Welcome weary traveller to my shop"
2025-07-27 23:33:16 +10:00
set alone "It's dangerous to go alone! Take this."
set sad "Do butterflies cry when they're sad?"
2025-07-27 23:33:16 +10:00
set alice "I think Alice is lost..."
set greetings "$weary" "$alone" "$sad" "$alice"
echo -n $greetings[(random 1 (count $greetings))]
end
function gitignore -a type
curl -sL "https://www.gitignore.io/api/$type"
end
# ripgrep on files
function rgf
rg --files | rg $args
end
set -g fish_greeting (rand_greet)
2025-08-31 15:05:32 +10:00
'';
2025-08-31 15:05:32 +10:00
shellAliases = {
brip = "batgrep"; # bat + ripgrep
man = "batman"; # bat + man
ls = "eza --color=auto";
l = "eza -Alh --color=auto --icons=auto";
ll = "eza -lh --color=auto --icons=auto";
li = "eza --color=auto --git-ignore";
};
plugins = [
{
name = "grc";
src = pkgs.fishPlugins.grc.src;
}
];
};
};
}