diff options
Diffstat (limited to 'user/modules')
-rw-r--r-- | user/modules/darwin.nix | 5 | ||||
-rw-r--r-- | user/modules/git.nix | 4 | ||||
-rw-r--r-- | user/modules/nixos.nix | 7 | ||||
-rw-r--r-- | user/modules/zsh.nix | 51 |
4 files changed, 65 insertions, 2 deletions
diff --git a/user/modules/darwin.nix b/user/modules/darwin.nix index e12a2ac4..b3c4d7d7 100644 --- a/user/modules/darwin.nix +++ b/user/modules/darwin.nix @@ -39,6 +39,11 @@ darwin-zsh-completions ]; + programs.zsh.shellAliases = { + da = "darwin-rebuild"; + das = "darwin-rebuild switch"; + }; + # Use GPG from GPGTools programs.git.signing.gpgPath = "/usr/local/bin/gpg"; } diff --git a/user/modules/git.nix b/user/modules/git.nix index 3c3f79bf..503b9e3f 100644 --- a/user/modules/git.nix +++ b/user/modules/git.nix @@ -53,7 +53,9 @@ enable = true; }; aliases = { - up = "merge FETCH_HEAD"; + authors = "shortlog -s -n"; + mup = "merge FETCH_HEAD"; + rup = "rebase FETCH_HEAD"; st = "status -sb"; ci = "commit"; br = "branch"; diff --git a/user/modules/nixos.nix b/user/modules/nixos.nix index 0df5817b..64b523b8 100644 --- a/user/modules/nixos.nix +++ b/user/modules/nixos.nix @@ -11,4 +11,11 @@ }; }) ]; + + programs.zsh.shellAliases = { + nor = "nixos-rebuild"; + nors = "nixos-rebuild switch"; + norb = "nixos-rebuild boot"; + norr = "nixos-rebuild switch --rollback"; + }; } 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; }; } |