all repos — dotfiles @ ebe1d05703120654b3e2fbdfc7e1bcb05d03dbfb

my *nix dotfiles

programs/fish.nix (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
{ config
, pkgs
, ...
}:

{
  programs.fish = {
    enable = true;
    interactiveShellInit = ''
      set fish_greeting # Disable greeting
    '';
    functions = {
      fish_prompt = ''
        printf '\n\001\002▲\001\002 '
      '';
      ggp = ''
        if test "$argv[1]" = "-f"
            git push (git remote show) -f (git branch --show-current)
        else
            git push (git remote show) (git branch --show-current)
        end
      '';

      gpl = ''
        if test -n "$argv[1]"
            set branch $argv[1]
        else
            set branch (git branch --show-current)
        end
        git pull -r (git remote show) $branch
      '';

      gco = ''
        if test -z "$argv[1]"
            return 1
        end

        git rev-parse --verify $argv[1] > /dev/null 2>&1
        if test $status -eq 0
            git checkout $argv[1]
        else
            git checkout -b $argv[1]
        end
      '';
    };
    shellAbbrs = {
      gc = "git commit -v -S";
      gst = "git status --short";
      ga = "git add";
      gd = "git diff --minimal";
      gl = "git log --oneline --decorate --graph";
      k = "kubectl";
    };
    shellAliases = {
      n = "z";
      "..." = "cd ../..";
    };
  };
}