summary refs log tree commit diff stats
path: root/user/settings/shell.nix
blob: a857e15cdce89f1e1d7c6c45c440a9dfca71d612 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{ config
, lib
, pkgs
, ...
}:
let
  inherit (pkgs) stdenv;
  lsOptions =
    if stdenv.isDarwin
    then "-p"
    else "-v --group-directories-first --hyperlink=auto";
  lsIsoDate =
    if stdenv.isDarwin
    then ""
    else "--time-style=long-iso";
in
{
  home = {
    shellAliases = {
      l = "ls ${lsOptions} -Bp";
      l1 = "ls -1";
      ls = "ls ${lsOptions} -hF";
      la = "ls ${lsOptions} -hA";
      ll = "ls ${lsOptions} ${lsIsoDate} -hl";
      lal = "ll -A";
      lla = "lal";
      llr = "ll -t";

      c = "lk";
      "c," = "cd $(ghq list -p nixfiles)";
      cg = "cd $(git root)";
      cdg = "cd $(git root)";

      cat = "bat --plain";

      fs = "bfs -nohidden";

      http = "xh";
      https = "xh --default-scheme https";
      xhs = "xh --default-scheme https";
      xhh = "xh --print Hh";
      xhhs = "xh --print Hh --default-scheme https";
      xhsh = "xh --print Hh --default-scheme https";

      hist-freq-lines = lib.mkDefault "fc -l -10000 | cut -d' ' -f4- | sort | uniq -c | sort -gr | head -n100 | less";
      hist-freq-commands = lib.mkDefault "fc -l -10000 | cut -d' ' -f4 | sort | uniq -c | sort -gr | head -n100 | less";
      wprop = "xprop | egrep '^WM_(CLASS|NAME|WINDOW_ROLE|TYPE)'";

      # Enable the following commands to support aliases.
      sudo = "sudo ";
      watch = "watch ";

      e = "$EDITOR";
      se = "sudo -e";

      ip = "ip --color=auto";
      ip4 = "ip -4";
      ip6 = "ip -6";

      d = "docker";
      db = "docker build";
      dr = "docker run";
      di = "docker image";
      dj = "docker pull";
      dk = "docker push";

      dc = "docker-compose";
      dcb = "dc build";
      dcd = "dc down";
      dcj = "dc pull";
      dck = "dc push";
      dcl = "dc logs";
      dclf = "dc logs -f";
      dcu = "dc up";
      dcud = "dc up -d";
      dcr = "dc restart";

      ga = "git add";
      gs = "git st";
      gd = "git diff";
      gdc = "git diff --cached";
      gf = "git fetch";
      gk = "git push";
      gkf = "git push --force-with-lease";
      gj = "git pull";
      gl = "git lg";
      gls = "git ls";
      gm = "git merge";
      ge = "git remote";
      ges = "git remote -v show";
      gr = "git rebase";
      gz = "git stash";
      gzl = "git stash list";
      gzp = "git stash pop";
      gdt = "git difftool";
      grl = "git reflog";
      gri = "git rebase --interactive";
      gfa = "git fetch --all";
      grs = "git reset";
      grsh = "git reset --hard";
      gsh = "git show";
      gsm = "git submodule";
      gci = "git commit";
      gx = "git restore";
      gb = "git switch";
      gbr = "git br";
      gbrc = "git checkout -b";
      gbrd = "git branch --delete";
      gbrm = "git branch --move";
      gmup = "git mup";
      grup = "git rup";

      ho = "home-manager";
      hob = "home-manager build";
      hos = "home-manager switch";
      hon = "home-manager news";
      hoh = "home-manager help";
      hop = "home-manager packages";
      hol = "home-manager generations";
      hox = "home-manager expire-generations '-30 days'";

      nish = "nix-shell";
      nf = "nix flake";
      nfa = "nix flake archive";
      nfp = "nix flake prefetch";
      nfu = "nix flake update";
      nfl = "nix flake lock";
      nlg = "nix-env --list-generations";
      snlg = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
      ngc = "nix-collect-garbage --delete-older-than 30d";
      sngc = "sudo nix-collect-garbage --delete-older-than 30d";
    };
  };
  home.packages = with pkgs; [
    fzf
    gh
    ghq
    delta
    git
    gitui
    gitstatus
    up
  ];
}