summary refs log tree commit diff stats
path: root/user/modules/zsh.nix
diff options
context:
space:
mode:
Diffstat (limited to 'user/modules/zsh.nix')
-rw-r--r--user/modules/zsh.nix51
1 files changed, 50 insertions, 1 deletions
diff --git a/user/modules/zsh.nix b/user/modules/zsh.nix
index f5aebb88..05a383a6 100644
--- a/user/modules/zsh.nix
+++ b/user/modules/zsh.nix
@@ -77,9 +77,53 @@ in
       tsc = "pnpx tsc";
       tslint = "pnpx tslint";
       tsnode = "pnpx ts-node";
+
+      history = "fc -l $(( $LINES - 2 ))";
+      hist-freq-lines = "fc -l -2000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less";
+      hist-freq-commands = "fc -l -2000 | cut -d' ' -f4 | sort | uniq -c | sort -g | tail -n10 | less";
       wprop = "xprop | egrep '^WM_(CLASS|NAME|WINDOW_ROLE|TYPE)'";
 
-      watch = "watch "; # enable watch with aliases
+      # Enable the following commands to support aliases.
+      sudo = "sudo ";
+      watch = "watch ";
+
+      g = "rg";
+
+      ga = "git add";
+      gi = "git";
+      gs = "git st";
+      gd = "git diff";
+      gf = "git fetch";
+      gk = "git push";
+      gj = "git pull";
+      gl = "git lg";
+      gr = "git remote";
+      gz = "git stash";
+      gzl = "git stash list";
+      gzp = "git stash pop";
+      gdt = "git difftool";
+      grl = "git reflog";
+      gri = "git rebase --interactive";
+      gsh = "git show";
+      gsm = "git submodule";
+      gci = "git commit";
+      gco = "git checkout";
+      gbr = "git br";
+      gbrc = "git checkout -b";
+      gbrd = "git branch --delete";
+      gbrm = "git branch --move";
+      gmup = "git mup";
+      grup = "git rup";
+
+      hos = "home-manager switch";
+      hon = "home-manager news";
+
+      n = "nix-env";
+      ni = "nix-env -iA";
+      nq = "nix-env -q";
+      ne = "nix-env -e";
+      nup = "nix-env -u";
+      ngc = "nix-collect-garbage --delete-older-than 14d";
     };
 
     # move to envExtra after 19.09
@@ -126,6 +170,11 @@ in
 
       typeset -T GHQ_ROOT ghq_root
       export GHQ_ROOT="$HOME/projects:$HOME/go/src:$HOME/quicklisp/local-projects"
+
+      function hist-freq-subcommands () {
+        fc -l -m "$1*" -2000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less
+      }
+
     '' + builtins.readFile ../zsh/.config/zsh/.zshrc;
   };
 }