universe/home/programs/terminal/fish.nix
2025-03-02 17:14:39 +05:00

61 lines
1.3 KiB
Nix

{
pkgs,
config,
...
}: {
programs.fish = {
enable = true;
functions = {
_fetch = ''
bunnyfetch
printf "\n"
'';
filesize = ''
for file in $argv
if [ -f "$file" ]
echo "$file: $(stat -c %s "$file" | numfmt --to=iec)"
else
echo "$file: not found"
end
end
'';
y = ''
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
'';
arm64cc-env = ''
set -gx ARCH arm64
set -gx hardeningDisable all
set -gx CROSS_COMPILE aarch64-linux-gnu-
'';
};
shellAliases = {
ls = "eza";
cat = "bat";
v = "nvim";
V = "sudoedit";
":q" = "exit";
cdt = "cd (mktemp -d)";
};
interactiveShellInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
bind \cl 'clear; _fetch; commandline -f repaint'
bind \cb ${pkgs.btop}/bin/btop
bind \cf 'fzf; commandline -f repaint'
bind \cs 'cdi; commandline -f repaint'
_fetch
'';
};
}