~sumner/home-manager-config

ref: f6c031d38449c4633874e129b158e221139f6b2a home-manager-config/modules/zsh/aliases.nix -rw-r--r-- 3.3 KiB
f6c031d3Sumner Evans amixer: use absolute path 6 months ago
                                                                                
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
{ config, pkgs, lib, ... }: with lib; let
  pdfviewer = "zathura --fork";
in
{
  programs.zsh = {
    shellAliases = {
      ##### Command Shortcuts #####
      # Printing
      alpr = "ssh isengard lpr -P bb136-printer -o coallate=true";
      alprd = "ssh isengard lpr -P bb136-printer -o coallate=true -o Duplex=DuplexNoTumble";
      lpr = "lpr -o coallate=true";
      hlpr = "lpr -P HP_ENVY_4500_series";
      hlprd = "hlpr -o Duplex=DuplexNoTumble";

      # Git
      ga = "git add";
      gaa = "git add -A";
      gap = "git add -p";
      gc = "git commit";
      gca = "gc -a";
      gcaa = "gca --amend";
      gcan = "gc --amend --no-edit";
      gcaan = "gcaa --no-edit";
      gch = "git checkout";
      gd = "git diff";
      gdc = "git diff --cached";
      gfetch = "git fetch";
      gl = "git log --pretty=format:'%C(auto)%h %ad %C(green)%s%Creset %C(auto)%d [%an (%G? %GK)]' --graph --date=format:'%Y-%m-%d %H:%M' --all";
      gpull = "git pull";
      gpush = "git push";
      grhh = "git reset --hard HEAD";
      gs = "git status";
      gst = "git stash";

      # Config
      projectlist = "vim ~st/projectlist && projectsync";
      quotesfile = "vim ${config.xdg.configHome}/nixpkgs/modules/email/quotes";
      reload = ". ~/.zshrc && echo 'ZSH Config Reloaded from ~/.zshrc'";
      sshconf = "vim ~/.ssh/config";
      vimrc = "realvim ~/.vim/vimrc";

      # Other aliases
      antioffice = "libreoffice --headless --convert-to pdf";
      feh = "feh -.";
      getquote = "fortune ${config.xdg.dataHome}/fortune/quotes";
      grep = "grep --color -n";
      hostdir = "python -m http.server";
      iftop = "sudo iftop -i any";
      journal = "vim ${config.home.homeDirectory}/Documents/journal/$(date +%Y-%m-%d).rst";
      la = "ls -a";
      ll = "ls -lah";
      ls = mkIf config.isLinux "ls --color -F";
      man = "MANWIDTH=80 man --nh --nj";
      myip = "curl 'https://api.ipify.org?format=text' && echo";
      ohea = "echo 'You need to either wake up or go to bed!'";
      open = if config.isLinux then "(thunar &> /dev/null &)" else "open .";
      pdflatex = "pdflatex -shell-escape";
      pwd = "pwd && pwd -P";
      sbcl = "rlwrap sbcl";
      screen = "screen -DR";
      soviet = "${pkgs.alsa-utils}/bin/amixer set Master on 50% && mpv --quiet -vo caca 'https://www.youtube.com/watch?v=U06jlgpMtQs'";
      tar = "${pkgs.libarchive}/bin/bsdtar";
      tt-beeper = "tt start -c Beeper";
      tt-tea = "tt start -p teaching/aca";
      tt-li = "tt start -t gh -p 'linkedin-matrix' -c Beeper";
      wdir = "watch --color -n .5 'ls -lha --color=always'";
      xelatex = "xelatex -shell-escape";
      zathura = pdfviewer;

      # Use nvim by default if it exists
      realvim = "command vim";
    };

    initExtra = ''
      # File Type Associations
      alias -s cpp=$EDITOR
      alias -s doc=$OFFICE
      alias -s docx=$OFFICE
      alias -s exe=$WINE
      alias -s h=$EDITOR
      alias -s md=$EDITOR
      alias -s mp4=$VIDEOVIEWER
      alias -s mkv=$VIDEOVIEWER
      alias -s ods=$OFFICE
      alias -s odt=$OFFICE
      alias -s pdf=${pdfviewer}
      alias -s ppt=$OFFICE
      alias -s pptx=$OFFICE
      alias -s tex=$EDITOR
      alias -s txt=$EDITOR
      alias -s xls=$OFFICE
      alias -s xlsx=$OFFICE

      # Making GNU fileutils more verbose
      for c in cp mv rm chmod chown rename; do
          alias $c="$c -v"
      done
    '';
  };
}