Dotfiles for my tiling window manager + terminal workflow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

424 lines
10 KiB

5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
  1. # system {{{ #
  2. # # vim mode {{{ #
  3. # bindkey -v
  4. # function zle-line-init zle-keymap-select {
  5. # VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
  6. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  7. # zle reset-prompt
  8. # }
  9. # zle -N zle-line-init
  10. # zle -N zle-keymap-select
  11. # export KEYTIMEOUT=1
  12. # # }}} vim mode #
  13. # command line related {{{ #
  14. # search history
  15. bindkey '\e[A' history-beginning-search-backward
  16. bindkey '\e[B' history-beginning-search-forward
  17. alias cs='printf "\033c"'
  18. alias hst="history"
  19. alias nf="cs && neofetch | lolcat"
  20. # nf
  21. alias ru="xrdb ~/.Xresources"
  22. # list file sizes in megabytes with depth 1
  23. alias dum="sudo du -d 1 -B M"
  24. alias vgb="sni /etc/default/grub"
  25. alias mkgb="sudo grub-mkconfig -o /boot/grub/grub.cfg"
  26. function cld() { colordiff -y --suppress-common-lines $1 $2 ; }
  27. alias grep='grep --color=auto'
  28. function gpdf() {
  29. pdfgrep -n -e $1 $2
  30. }
  31. # for finding files by name
  32. export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'
  33. # find text inside files
  34. function rg() { grep -nr $1 ; }
  35. function cpd() { cp -avr $1 $2 ; }
  36. alias pk="pkill -f"
  37. # extract tar archive
  38. function utar() { tar -xzvf $1 && rm $1; }
  39. function rzip() { unzip $1 && rm $1; }
  40. function lzip() { unzip -l $1 | less; }
  41. alias mkpk="makepkg -sri"
  42. alias mkex="chmod 777"
  43. alias ctl="systemctl"
  44. alias ctle="systemctl enable"
  45. alias ctld="systemctl disable"
  46. alias ctls="systemctl start"
  47. alias wm="sudo wifi-menu"
  48. # mounting {{{ #
  49. alias udm="udisksctl mount -b"
  50. alias udmb="udisksctl mount -b /dev/sdc2"
  51. alias udu="udisksctl unmount -b"
  52. alias udub="udisksctl unmount -b /dev/sdc2"
  53. # }}} mounting #
  54. alias tc="touch"
  55. shrm() {
  56. for file in "$@"; do
  57. shred "$file" && rm "$file"
  58. done
  59. }
  60. # }}} command line related #
  61. # directory-related {{{ #
  62. alias l='ls -a'
  63. alias ll='ls -alFh'
  64. alias smv="sudo mv"
  65. alias f="cd"
  66. alias fz="fzf"
  67. alias fnd="find . -type f -name"
  68. f `cat /home/kevin/.oh-my-zsh/cache/last-working-dir`
  69. # alias w="cd $(cat /home/kevin/.oh-my-zsh/cache/last-working-dir)"
  70. alias rmr="rm -rf"
  71. alias mdp="mkdir -p"
  72. alias rsy="rsync -Pr"
  73. alias "f."="f .."
  74. alias "f.."="f ..."
  75. function mvd() { mv $1 ~/Downloads ; }
  76. alias lhd="sudo fdisk -l"
  77. alias ds="df -h | tee >(head -n 1) >(grep sd) >/dev/null"
  78. alias chownw="sudo chown -R kevin:wheel"
  79. alias chwnm="sudo chown -R kevin:wheel /run/media/kevin"
  80. alias nbu="f /run/media/kevin/pc-backup/backups/nzxt && ll | grep gz"
  81. # }}} directory-related #
  82. # power options {{{ #
  83. alias s="systemctl suspend"
  84. alias sd="sudo shutdown 0"
  85. alias reb="sudo shutdown -r 0"
  86. alias lo="i3-msg exit"
  87. alias x="xmodmap ~/.Xmodmap && xset r rate 200 60"
  88. # }}} power options #
  89. # rotate monitor {{{ #
  90. function rt() {
  91. output="HDMI-0"
  92. if [ "$1" = "s" ]
  93. # if [ "${1:0:1}" = "s" ]
  94. then
  95. output="DVI-I-1"
  96. fi
  97. dir="normal"
  98. if [ "$2" = "r" ]
  99. # if [ "${1:1:2}" = "r" ]
  100. then
  101. dir="right"
  102. fi
  103. if [ "$2" = "l" ]
  104. then
  105. dir="left"
  106. fi
  107. # echo "xrandr --output \"$output\" --rotate \"$dir\""
  108. xrandr --output "$output" --rotate "$dir"
  109. }
  110. # }}} rotate monitor #
  111. # sound
  112. alias vlm="alsamixer -c 0"
  113. alias vlh="alsamixer -c 2"
  114. # apt
  115. # function apti() { sudo apt install $1 ; }
  116. # function aptr() { sudo apt remove $1 ; }
  117. # alias aptu="sudo apt upgrade"
  118. alias pc="sudo pacman -S"
  119. alias pcr="sudo pacman -Rs"
  120. alias pcu="sudo pacman -Sy"
  121. alias xpc="pacman -Qqe > ~/linux-config/txt/nzxt-pkgs.txt"
  122. # alias tri="trizen -S --noconfirm"
  123. alias tri="trizen -S"
  124. # internet
  125. alias pg="ping -c 3 8.8.8.8"
  126. alias dh="sudo dhcpcd"
  127. alias rdh="sudo killall dhcpcd && sudo dhcpcd"
  128. alias id="identify"
  129. # }}} system #
  130. # config files {{{ #
  131. function gz() { grep $1 ~/linux-config/aliases/zsh_aliases ; }
  132. alias rz="source ~/linux-config/aliases/zsh_aliases"
  133. alias lca="f ~/linux-config/aliases"
  134. # i3
  135. alias i3b="f ~/i3blocks"
  136. alias pipes="pipes.sh -t 3"
  137. # UltiSnips {{{ #
  138. urnp_dir="~/.vim/plugged/vim-snippets/UltiSnips"
  139. function vsnp() { nvim ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; }
  140. # }}} #
  141. # }}} config files #
  142. # applications {{{ #
  143. silent="> /dev/null 2>&1& "
  144. alias h="htop -s PERCENT_MEM"
  145. alias hc="htop -s PERCENT_CPU"
  146. alias r="ranger"
  147. alias mr="man ranger"
  148. alias clc="cloc ."
  149. function z() { nohup zathura $1 > /dev/null 2>&1& ; }
  150. function ev() { nohup evince $1 > /dev/null 2>&1& ; }
  151. function chr() { google-chrome $1 ; }
  152. alias n="nvim"
  153. alias sni="sudo nvim"
  154. alias fh="feh"
  155. alias sx="sxiv"
  156. function mrk() { pandoc -o ${1%.*}.html $1 ; }
  157. alias wp="grep wallpaper ~/.cache/wal/colors.sh"
  158. # auto-clicker {{{ #
  159. function auc() { xdotool click --repeat 1000000 --delay $1 1 ; }
  160. # alias auc1="xdotool click --repeat 1000000 --delay 1 1"
  161. # alias auc3="xdotool click --repeat 1000000 --delay 300 1"
  162. # alias auc5="xdotool click --repeat 1000000 --delay 500 1"
  163. # alias kauc="pkill -f xdotool"
  164. # }}} auto-clicker #
  165. # alias rsl="java -jar ~/Downloads/RuneLite.jar"
  166. alias swex="sudo nohup ~/Downloads/swex.appimage $silent"
  167. alias vbn="cvlc --loop --alsa-gain 1 ~/Music/brown-noise.mp3"
  168. alias cv="cava"
  169. alias rmsw="rm .sw*"
  170. function rs(){ redshift -P -O $(echo "scale=2;$1*1000" | bc) ; }
  171. alias rx="redshift -x"
  172. alias gpe="gpg --encrypt --recipient"
  173. alias gpd="gpg --decrypt"
  174. # pass {{{ #
  175. alias ps="pass"
  176. alias psc="pass -c"
  177. alias pse="pass edit"
  178. alias psi="pass insert -m"
  179. alias psg="pass generate -c"
  180. alias xclip="xclip -selection clipboard"
  181. alias yh="echo 'kevin.mok@live.ca' | xclip -selection clipboard"
  182. alias yg="xclip -selection clipboard ~/.password-store/social/gmail"
  183. alias yt="xclip -selection clipboard ~/.password-store/social/trapbot"
  184. alias yu="echo 'kevin.mok@mail.utoronto.ca' | xclip -selection clipboard"
  185. # }}} pass #
  186. function grpy() { grep $1 *.py ; }
  187. alias p3="python3"
  188. alias py="python"
  189. # watson
  190. alias wt="watson"
  191. alias wta="watson start"
  192. alias wte="watson edit"
  193. alias wtl="watson log"
  194. alias wts="watson stop"
  195. alias wtt="watson status"
  196. # }}} applications #
  197. # git {{{ #
  198. # aliases {{{
  199. alias gstr="git config credential.helper store"
  200. alias g="git"
  201. # add {{{ #
  202. alias ga="git add -A . && gs"
  203. alias gac="git add -A . && git commit -S"
  204. alias gacu="git add -A . && git commit"
  205. # }}} add #
  206. # diff/log {{{ #
  207. alias gd="git diff -w"
  208. function gde() { git diff --cached -- ':(exclude)'$1 ; }
  209. alias gdc="git diff --cached"
  210. alias gds="git diff --stat"
  211. alias gdt="git difftool --tool=vimdiff"
  212. alias gl="git log"
  213. alias gsl="git shortlog"
  214. # }}} diff/log #
  215. # update {{{ #
  216. alias gs="git status -u"
  217. alias gchom="git checkout master"
  218. alias gchnw="git checkout -b wip"
  219. alias gchw="git checkout wip"
  220. alias gheadm1="git reset --hard HEAD~1"
  221. alias gls="git ls-tree -r HEAD --name-only"
  222. # push {{{ #
  223. alias gst="git stash"
  224. alias gstp="git stash pop"
  225. alias gc="git commit -S"
  226. alias gcu="git commit"
  227. alias gcam="ga && git commit --amend --no-edit -S"
  228. alias gcamp="ga && git commit --amend --no-edit -S && gpsf"
  229. # todo: fix
  230. function gcm(){ echo git commit -m \""$1"\" ; }
  231. function psgi() {
  232. git add .
  233. git commit -m '.' -S
  234. git push
  235. }
  236. alias gps="git push"
  237. alias gpsi="git push --set-upstream origin master"
  238. alias gpsf="git push --force"
  239. alias gclear="git stash clear"
  240. # }}} push #
  241. # pull {{{ #
  242. alias gpl="git pull --rebase"
  243. alias grbc="git rebase --continue"
  244. # }}} pull #
  245. # }}} update #
  246. # edit {{{ #
  247. alias vre="ni README.md"
  248. alias crm="mrk README.md"
  249. # }}} edit #
  250. # aliases }}}
  251. # functions {{{
  252. alias gcho="git checkout"
  253. alias gchon="git checkout -b"
  254. function gchof() { git checkout $1 $2 ; }
  255. alias gcln="git clone"
  256. alias gchp="git cherry-pick"
  257. alias gchpc="git cherry-pick --continue"
  258. # add multiple push repos
  259. function gremotes() {
  260. git remote set-url --add --push origin $1
  261. git remote set-url --add --push origin $2
  262. git remote -v
  263. }
  264. # gmrgr: merge repos {{{ #
  265. function gmrgr() {
  266. # 1 = remote name, 2 = remote path
  267. git remote add $1 $2
  268. git fetch $1
  269. # whichever branch you want to merge
  270. git merge --allow-unrelated-histories $1/master
  271. git remote remove $1
  272. }
  273. # }}} merge repos #
  274. # assume file unchanged
  275. alias gunc="git update-index --assume-unchanged"
  276. # delete branch locally and on server
  277. function grmb() { git push origin --delete $1 && git branch -D $1 ; }
  278. # functions }}}
  279. # }}} git #
  280. # coding projs {{{ #
  281. coding_dir="~/coding"
  282. alias cdn="$cd_coding_dir"
  283. alias gx="ni ~/Documents/csgo-config/autoexec.cfg"
  284. # trapbot {{{ #
  285. alias tb="$cd_coding_dir/trapbot"
  286. alias vtb="$cd_coding_dir/trapbot && ni scan_reddit.py"
  287. alias ptb="python scan_reddit.py"
  288. alias rtb="$cd_coding_dir/trapbot && python scan_reddit.py"
  289. # }}} trapbot #
  290. # spotify-lib-vis {{{ #
  291. spv_dir="$coding_dir""/spotify-lib-vis"
  292. alias svl="f $spv_dir/src/login"
  293. alias sva="f $spv_dir/src/api"
  294. alias svg="f $spv_dir/src/graphs"
  295. alias svscs="f $spv_dir/src/static/scss"
  296. alias svcss="f $spv_dir/src/spotifyvis/static/scss"
  297. source /home/kevin/coding/spotify-lib-vis/src/api-keys.sh
  298. function ssv() {
  299. source ../bin/activate
  300. python manage.py runserver
  301. }
  302. alias sssv="sv && ssv"
  303. alias spvdb="psql -d spotifyvis -U django"
  304. function mig() {
  305. python manage.py makemigrations
  306. python manage.py migrate --run-syncdb
  307. ssv
  308. }
  309. alias cldb="python manage.py flush --no-input && ssv"
  310. alias djs="python manage.py shell"
  311. alias upip="pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U"
  312. alias ureq="pip freeze > requirements.txt"
  313. # scan history
  314. alias hlg="cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1"
  315. alias crnl="grep \"(kevin) CMD\" /var/log/syslog | tail -n 1 && hlg"
  316. alias hs="$spv_dir/src/update-history.sh && hlg"
  317. # removes all but newest file
  318. # alias rmol="ls -t | tail -n +2 | xargs rm -- && l"
  319. # }}} spotify-lib-vis #
  320. # # Stardew Valley {{{
  321. # sdv_save_dir=~/Documents/sdv-save
  322. # alias sdv="f $sdv_save_dir"
  323. # alias smp="~/Downloads/sdv/smapi/install\ on\ Linux.sh"
  324. # # alias imc="sdv && source import-save.sh coop"
  325. # function ucf() { f ~/Documents/StardewMods/UncaughtFish ; }
  326. # function svmd() { f ~/.local/share/Steam/steamapps/common/Stardew\ Valley/Mods ; }
  327. # function svm() { mv $1 ~/.local/share/Steam/steamapps/common/Stardew\ Valley/Mods ; }
  328. # # }}}
  329. alias sc="shellcheck"
  330. alias pdl="pdflatex"
  331. alias tcl="tex-clean"
  332. alias mfs="nvim /home/kevin/coding/best-mf-site-personal/index.html"
  333. # }}} coding projs #
  334. # school {{{ #
  335. # 369
  336. alias vm6="VBoxHeadless --startvm 369-a1"
  337. alias sa="ssh k@192.168.0.17"
  338. alias cpi="scp interceptor.c kevin@192.168.0.17:/home/kevin/a1"
  339. alias cpti="gcc -m32 -o test_intercept test_intercept.c && scp test_intercept k@192.168.0.17:/home/k/a1"
  340. alias ma="make"
  341. alias mc="make clean"
  342. # }}} school #