{ config, lib, pkgs, ... }: let cfg = config.hm.shell.fish; in { options.hm.shell.fish.enable = lib.mkEnableOption "enables fish shell"; config = lib.mkIf cfg.enable { programs.fish = { enable = true; functions = { rga-fzf = { body = '' set -l RG_PREFIX "rga --files-with-matches --smart-case" set -l file ( FZF_DEFAULT_COMMAND="$RG_PREFIX '$argv[1]'" \ fzf --sort \ --preview='test -n {}; and rga --pretty --context 5 {q} {}' \ --phony -q "$argv[1]" \ --bind "change:reload:$RG_PREFIX {q}" \ --preview-window="70%:wrap" ) if test -n "$file" echo "Opening $file..." xdg-open "$file" end ''; }; }; interactiveShellInit = '' set fish_greeting fastfetch ''; shellAliases = { ns = "nix-search -p"; nd = "nix develop ."; nos = "nh os switch ."; nob = "nh os boot ."; nus = "nh os switch . -u"; nfu = "nix flake update"; md = "mkdir -p"; rmf = "rm -rf"; untar = "tar -xzvf"; tarc = "tar -czvf"; du = "dust -b"; awk = "choose"; dig = "doggo"; ping = "gping"; ps = "procs"; ff = "fastfetch"; cat = "bat"; yt = "yt-dlp"; }; plugins = [ { name = "transient-fish"; src = pkgs.fishPlugins.transient-fish.src; } { name = "fishbang"; src = pkgs.fishPlugins.fishbang.src; } { name = "puffer"; src = pkgs.fishPlugins.puffer.src; } { name = "pisces"; src = pkgs.fishPlugins.pisces.src; } # { # name = "fzf-fish"; # src = pkgs.fishPlugins.fzf-fish.src; # } { name = "fish-you-should-use"; src = pkgs.fishPlugins.fish-you-should-use.src; } { name = "colored-man-pages"; src = pkgs.fishPlugins.colored-man-pages.src; } # { # name = "fifc"; # src = pkgs.fishPlugins.fifc.src; # } ]; }; }; }