From 4b6fcdaaedd86789e8212ca2af378f8ab1d27317 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Oct 2019 00:19:35 +0200 Subject: Add shell aliases for common development and administration tasks --- user/modules/zsh.nix | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'user/modules/zsh.nix') 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; }; } -- cgit 1.4.1