marleyos/home/programs/fish.nix

126 lines
2.3 KiB
Nix
Raw Normal View History

{ pkgs, ... }:
{
2024-10-28 20:30:12 -07:00
home.packages = with pkgs; [
2024-11-14 19:13:54 -08:00
# general
2024-10-28 20:30:12 -07:00
babelfish
2024-11-14 19:13:54 -08:00
# for extract()
2024-11-05 19:42:31 -08:00
gnutar
bzip2
bzip3
gzip
unzip
pax
unrar-free
2024-11-14 19:13:54 -08:00
# shell goodies
neo
2024-10-28 20:30:12 -07:00
];
programs.fish = {
enable = true;
2024-10-28 20:01:16 -07:00
2024-10-31 18:08:28 -07:00
rose-pine.enable = true;
2024-10-28 20:01:16 -07:00
preferAbbrs = true;
plugins = with pkgs.fishPlugins; [
{
name = "z";
src = z;
}
{
name = "Puffer Fish";
src = puffer;
}
{
name = "Sponge";
src = sponge;
}
{
name = "autopair.fish";
src = autopair;
}
];
2024-11-03 15:00:19 -08:00
shellInit = # fish
''
set -g fish_key_bindings fish_vi_key_bindings
'';
shellAbbrs = {
2024-11-05 19:42:31 -08:00
cp = "cp -iv";
mkdir = "mkdir -pv";
mv = "mv -iv";
rm = "rm -r";
grep = "grep --color=auto";
};
2024-11-03 15:00:19 -08:00
2024-11-05 19:42:31 -08:00
functions = {
extract = {
argumentNames = "file";
body = # fish
''
set --erase argv[1]
2024-11-03 15:00:19 -08:00
2024-11-05 19:42:31 -08:00
if test -f "$file"
switch "$file"
case "*.tar.bz2"
tar -jxvf $argv $file
2024-11-03 15:00:19 -08:00
2024-11-05 19:42:31 -08:00
case "*.tar.gz"
tar -zxvf $argv $file
case "*.bz2"
bunzip2 $argv $file
case "*.bz3"
bunzip3 $argv $file
case "*.gz"
gunzip $argv $file
case "*.tar"
tar -xvf $argv $file
case "*.tbz2"
tar -jxvf $argv $file
case "*.tgz"
tar -zxvf $argv $file
case "*.zip" "*.ZIP"
unzip $argv $file
case "*pax"
cat $file | pax -r $argv
case "*.pax.Z"
uncompress $file --stdout | pax -r $argv
case "*.rar"
unrar-free $file
case "*.Z"
uncompress $argv $file
2024-11-03 15:00:19 -08:00
2024-11-05 19:42:31 -08:00
case "*"
echo "'$file' cannot be extracted via extract()."
end
else
echo "'$file' is not a valid file."
end
'';
2024-11-03 15:00:19 -08:00
};
2024-11-14 19:13:54 -08:00
neo = {
wraps = "neo";
body = # fish
''
command neo --charset=ascii $argv
'';
};
2024-11-03 15:00:19 -08:00
};
};
}