feat(home): Fish shell & neo

This commit is contained in:
punkfairie 2024-11-16 11:27:44 -08:00
parent a3979f544a
commit 6f456ceef8
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
4 changed files with 167 additions and 125 deletions

View file

@ -11,6 +11,10 @@ in
gtk = enabled;
qt = enabled;
};
programs = {
fish = enabled;
neo = enabled;
};
xorg = {
xsession = enabled;
};

View file

@ -0,0 +1,131 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule enabled;
cfg = config.${namespace}.programs.fish;
inherit (config.${namespace}) theme;
in
{
options.programs = mkEnableModule "fish";
config = mkIf cfg.enable {
home.packages = with pkgs; [
# general
babelfish
# for extract()
gnutar
bzip2
bzip3
gzip
unzip
pax
unrar-free
];
programs.fish = {
enable = true;
${theme.colors.name} = enabled;
preferAbbrs = true;
plugins = with pkgs.fishPlugins; [
{
name = "z";
src = z;
}
{
name = "Puffer Fish";
src = puffer;
}
{
name = "Sponge";
src = sponge;
}
{
name = "autopair.fish";
src = autopair;
}
];
shellInit = # fish
''
set -g fish_key_bindings fish_vi_key_bindings
'';
shellAbbrs = {
cp = "cp -iv";
mkdir = "mkdir -pv";
mv = "mv -iv";
rm = "rm -r";
grep = "grep --color=auto";
};
functions = {
extract = {
argumentNames = "file";
body = # fish
''
set --erase argv[1]
if test -f "$file"
switch "$file"
case "*.tar.bz2"
tar -jxvf $argv $file
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
case "*"
echo "'$file' cannot be extracted via extract()."
end
else
echo "'$file' is not a valid file."
end
'';
};
};
};
};
}

View file

@ -0,0 +1,32 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule;
cfg = config.${namespace}.programs.neo;
in
{
options.programs = mkEnableModule "neo";
config = mkIf cfg.enable {
home.packages = with pkgs; [
neo
];
programs.fish.functions = mkIf config.programs.fish.enable {
neo = {
wraps = "neo";
body = # fish
''
command neo --charset=ascii $argv
'';
};
};
};
}

View file

@ -1,125 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
# general
babelfish
# for extract()
gnutar
bzip2
bzip3
gzip
unzip
pax
unrar-free
# shell goodies
neo
];
programs.fish = {
enable = true;
rose-pine.enable = true;
preferAbbrs = true;
plugins = with pkgs.fishPlugins; [
{
name = "z";
src = z;
}
{
name = "Puffer Fish";
src = puffer;
}
{
name = "Sponge";
src = sponge;
}
{
name = "autopair.fish";
src = autopair;
}
];
shellInit = # fish
''
set -g fish_key_bindings fish_vi_key_bindings
'';
shellAbbrs = {
cp = "cp -iv";
mkdir = "mkdir -pv";
mv = "mv -iv";
rm = "rm -r";
grep = "grep --color=auto";
};
functions = {
extract = {
argumentNames = "file";
body = # fish
''
set --erase argv[1]
if test -f "$file"
switch "$file"
case "*.tar.bz2"
tar -jxvf $argv $file
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
case "*"
echo "'$file' cannot be extracted via extract()."
end
else
echo "'$file' is not a valid file."
end
'';
};
neo = {
wraps = "neo";
body = # fish
''
command neo --charset=ascii $argv
'';
};
};
};
}