From f3c554e51dd313a269a34bb05cd61f4dc50c480a Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sat, 21 Sep 2024 01:33:24 +0800 Subject: [PATCH] home/fish: add more shellabbrs --- home/applications/fish/default.nix | 76 +++++++++++++++++++----------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/home/applications/fish/default.nix b/home/applications/fish/default.nix index ba02107..a1ac7ec 100644 --- a/home/applications/fish/default.nix +++ b/home/applications/fish/default.nix @@ -19,36 +19,56 @@ end ''; - plugins = [ - { - name = "autopair"; - inherit (pkgs.fishPlugins.autopair) src; - } - { - name = "done"; - inherit (pkgs.fishPlugins.done) src; - } - { - name = "puffer"; - inherit (pkgs.fishPlugins.puffer) src; - } - ]; + plugins = + lib.map + (f: { + name = f.pname; + inherit (f) src; + }) + ( + with pkgs.fishPlugins; + [ + autopair + done + puffer + ] + ); - shellAbbrs = { - gi = "gitui"; - n = "nvim"; - s = "nh os switch"; + shellAbbrs = + let + cursor = f: { + setCursor = true; + expansion = f; + }; + in + { + gi = "gitui"; + p = "powerprofilesctl"; + s = "nh os switch"; + v = "nvim"; - g = "git"; - ga = "git add"; - gc = "git commit -m"; - gca = "git commit --amend"; - gd = "git diff"; - gds = "git diff --staged"; - gl = "git log"; - gp = "git push"; - gr = "git rebase -i --autosquash"; - }; + # TODO: maybe fishPlugins.fish-git-abbr? + g = "git"; + ga = "git add"; + gac = cursor "git commit -am '%'"; + gc = cursor "git commit -m '%'"; + gca = "git commit --amend"; + gd = "git diff"; + gds = "git diff --staged"; + gl = "git log"; + gp = "git pull"; + gpu = "git push"; + gr = "git rebase -i --autosquash"; + + n = "nix"; + nb = cursor "nix build nixpkgs#%"; + nr = cursor "nix run nixpkgs#%"; + ns = cursor "nix shell nixpkgs#%"; + nbb = "nix-build -A"; + nf = "nix fmt"; + nu = "nix flake update"; + nv = "nix eval"; + }; functions = let