From a58ef3f816c19f212f24172ff2075be17bd7c29a Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 15 Jan 2025 22:53:03 +0100 Subject: common/fish: configure some abbrs, functions, keybinds --- common/commandline/fish.fish | 16 ++++++++++++ common/commandline/fish.nix | 62 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 common/commandline/fish.fish diff --git a/common/commandline/fish.fish b/common/commandline/fish.fish new file mode 100644 index 0000000..294849c --- /dev/null +++ b/common/commandline/fish.fish @@ -0,0 +1,16 @@ +# Disable greeting +set fish_greeting +set -g fish_key_bindings fish_vi_key_bindings + +bind -M insert ctrl-Z 'fg ; commandline -f repaint' + +function ssht + ssh -t "$argv" "tmux new-session -A -s 'ssh-$HOST'" +end + +function cdt + builtin cd (mktemp -d) + builtin pwd +end + +# TODO: sll diff --git a/common/commandline/fish.nix b/common/commandline/fish.nix index a371a1d..6e67865 100644 --- a/common/commandline/fish.nix +++ b/common/commandline/fish.nix @@ -1,9 +1,71 @@ +{ pkgs, ... }: { programs.fish = { enable = true; useBabelfish = true; + + interactiveShellInit = builtins.readFile ./fish.fish; + + shellAbbrs = { + o = "xdg-open"; + cpr = "rsync -ah --inplace --info=progress2"; + + # Git + # === + + g = "git"; + gc = "git commit"; + gca = "git commit --all"; + + gcs = "git show"; + + gco = "git switch"; + + # Fetch (f) + gf = "git fetch"; + gfc = "git clone"; + gfm = "git pull"; + + # Index (i) + gia = "git add"; + gid = "git diff --cached"; + + # Log (l) + gl = "git log --topo-order"; + glc = "git shortlog --summary --numbered"; + glg = "git log --topo-order --graph --oneline --all"; + glo = "git log --topo-order --oneline"; + + # Merge (m) + gm = "git merge"; + gmt = "git mergetool"; + + # Push (p) + gp = "git push"; + gpf = "git push --force-with-lease"; + gpt = "git push --tags"; + + # Rebase (r) + gr = "git rebase"; + + # Stash (s) + gs = "git stash"; + + # Working Copy (w) + gws = "git status"; + gwd = "git diff"; + gwdt = "GIT_EXTERNAL_DIFF=difft git diff"; + gwD = "git diff --word-diff"; + }; }; + environment.systemPackages = [ + pkgs.fishPlugins.fish-bd + pkgs.fishPlugins.grc + pkgs.fishPlugins.puffer + pkgs.grc + ]; + home-manager.sharedModules = [ { programs.fish.enable = true; -- cgit v1.2.3