about summary refs log tree commit diff
path: root/configs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2019-03-08T18·17+0000
committerWilliam Carroll <wpcarro@gmail.com>2019-03-08T18·17+0000
commit4d7d937df7b6ea4c9a7a5a14bf16fbd0d138d93c (patch)
tree3172b50a0837e593da9c3511b19098c8e7e82047 /configs
parentd7c443c7d1b56b628c3f1847e0bf611518004a99 (diff)
Reorganize aliases, support misc fns, misc named dirs
Miscellaneous maintenance tasks for my ZSH life.
Diffstat (limited to 'configs')
-rw-r--r--configs/shared/zsh/aliases.zsh92
-rw-r--r--configs/shared/zsh/dumping_grounds.zsh21
-rw-r--r--configs/shared/zsh/functions.zsh4
-rw-r--r--configs/shared/zsh/variables.zsh19
4 files changed, 103 insertions, 33 deletions
diff --git a/configs/shared/zsh/aliases.zsh b/configs/shared/zsh/aliases.zsh
index d4b6615d22..c2788d41e1 100644
--- a/configs/shared/zsh/aliases.zsh
+++ b/configs/shared/zsh/aliases.zsh
@@ -1,4 +1,8 @@
-# These were haphazardly ported from wpcarro/nixify, so some may be broken.
+# Applications
+# dired:  di
+# docker: dk
+
+# Misc
 alias c="xclip -selection clipboard -i"
 alias p="xclip -selection clipboard -o"
 alias md="mkdir_cd"
@@ -7,14 +11,35 @@ alias ll="exa -l"
 alias la="exa -la"
 alias lorem="echo Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
 alias e="emacsclient --no-wait"
-alias d="docker"
-alias dps="docker ps"
-alias dpsa="docker ps -a"
-alias drm="docker rm"
-alias drmi="docker rmi"
-alias drit="docker run -it"
-alias drd="docker run -d"
-alias di="docker images"
+alias cat="bat"
+alias j='fasd_cd -d' # to emulate autojump; my muscle memory is hardened here
+alias vim=nvim # prefer neovim to vim
+alias links='find ~ -maxdepth 1 -type l -exec exa {} \;' # list all of the links in the home directory
+alias di=dired
+alias chrome=google-chrome
+alias btctl=bluetoothctl
+alias rg='rg --ignore-case'
+alias rgh='rg --hidden' # By default, rg skips hidden files
+alias fdh='fd --hidden' # By default, rg skips hidden files
+
+# Gnome
+alias na=nautilus # Gnome's graphical file browser. Useful to click and dragging files into emails
+
+# Chrome
+alias cssh='chrome --app-id=pnhechapfaindjhompbnflcldabbghjo' # Secure Shell
+alias crd='chrome --app-id=gbchcmhmhahfdphkhkmpfmihenigjmpp'  # Chrome Remote Desktop
+
+# Docker
+alias dk="docker"
+alias dkps="docker ps"
+alias dkpsa="docker ps -a"
+alias dkrm="docker rm"
+alias dkrmi="docker rmi"
+alias dkrit="docker run -it"
+alias dkrd="docker run -d"
+alias dki="docker images"
+
+# Elixir
 alias m="mix"
 alias mc="mix compile"
 alias mcf="mix compile --force"
@@ -23,7 +48,8 @@ alias tism="MIX_ENV=test iex -S mix"
 alias mdg="mix deps.get"
 alias mdu="mix deps.update"
 alias mdup="mix docker.up"
-alias cat="bat"
+
+# Git
 alias g="git"
 alias glp='git log --graph --pretty=format:"%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'
 alias git="hub"
@@ -37,12 +63,31 @@ alias gsh="git show"
 alias gbm="git branch --merged"
 alias gwip="git add . && git commit -m wip"
 alias gpr="git pull-request"
+
+# Mercurial
+# The attempt here is to map my well-known, existing `git` aliases to their
+# Mercurial counterparts. Some may map 1:1, others may be like putting a square
+# peg into a round hole. I will try and use my best judgement in these cases
+# while erring on the side of unifying the two APIs.
+alias hgst='hg status'
+alias hglp='hg xl'
+alias hgp='hg uploadchain' # this is like `git push`
+alias hga='hg add'
+alias hgc='hg commit'
+alias hgcan='hg amend' # like `git commit --amend --no-edit'
+alias hgpr='hg mail -r . -m' # this may be similar to `hub pull-request`
+alias hgd='hg diff'
+alias hgsh='hg export'
+alias hgco='hg update'
+
+# Haskell
 alias sb="stack build"
 alias se="stack exec --"
 alias sc="stack clean"
 alias st="stack test"
-# Currently broken
-# alias haddocks=''open "$(stack path --local-doc-root)/index.html"''
+alias haddocks='open "$(stack path --local-doc-root)/index.html"'
+
+# Kubernetes
 alias kc="kubectl"
 alias kpods="kubectl get pods"
 alias knodes="kubectl get nodes"
@@ -50,19 +95,12 @@ alias kdeploys="kubectl get deployments"
 alias kdns="kubectl get ing"
 alias kedit="kubectl edit deployments "
 alias kswitch="gcloud container clusters get-credentials "
+
+# Nix
 alias nq="nix_introspect"
 alias nsh="nix-shell"
 alias nshp="nix-shell --pure"
 alias nr="nix repl"
-alias md=mkdir_cd
-alias j='fasd_cd -d' # to emulate autojump; my muscle memory is hardened here
-alias vim=nvim # prefer neovim to vim
-alias links='find ~ -maxdepth 1 -type l -exec exa {} \;' # list all of the links in the home directory
-alias ra=ranger
-alias chrome=google-chrome
-alias btctl=bluetoothctl
-alias rg='rg --hidden' # By default, rg skips hidden files
-alias fd='fd --hidden' # By default, rg skips hidden files
 
 # couple the e* aliases to the <leader>e* kbds in vim
 alias ev='e ~/.config/nvim/init.vim'
@@ -83,12 +121,14 @@ alias sx='xrdb ~/.Xresources'
 alias si='i3-msg restart'
 
 # Google aliases
-# blaze:    bz
-# borgcfg:  bg (NOTE: `bg` already exists as a shell built-in)
-# piper:    pi
-# pastebin: pb
+# blaze:      bz
+# borgcfg:    br
+# piper:      pi
+# pastebin:   pb
+# codesearch: cs
 alias bzb='blaze build'
-alias bg='borgcfg'
+alias bzt='blaze test --test_output=all'
+alias br='borgcfg'
 alias pils='p4 listclients'
 alias pirm='p4 citc -d'
 alias pb=/google/src/head/depot/eng/tools/pastebin
diff --git a/configs/shared/zsh/dumping_grounds.zsh b/configs/shared/zsh/dumping_grounds.zsh
index ae16bb78bf..e61164fc64 100644
--- a/configs/shared/zsh/dumping_grounds.zsh
+++ b/configs/shared/zsh/dumping_grounds.zsh
@@ -161,6 +161,13 @@ browse() {
   nohup "$BROWSER" $@ &
 }
 
+lh() {
+  # Opens http://localhost:<port> in your $BROWSER.
+  # Usage: `lh 8080`
+  # Here, in case it wasn't obvious, `lh` stands for "localhost".
+  browse "http://localhost:$1"
+}
+
 essids() {
   # Returns a list of all ESSIDs the network card detects
   local interface=${1-wlp4s0}
@@ -358,6 +365,20 @@ tmux_focused_pane() {
   echo 'Not implemented'
 }
 
+# Google3
+g3_root() {
+  # Outputs the root of the CitC client in g3
+  # NOTE: there is probably a function already supported by g4 to cd to the
+  # root, so support for this function may be dropped shortly.
+  echo "${PWD%%/google3/*}/google3"
+}
+
+# i3
+focus() {
+  # Focuses an i3 window by application name.
+  i3-msg "[class=\"$1\"] focus" >/dev/null
+}
+
 # zsh
 fns() {
   # Outputs all available functions.
diff --git a/configs/shared/zsh/functions.zsh b/configs/shared/zsh/functions.zsh
index 36559d2a2d..12825102ae 100644
--- a/configs/shared/zsh/functions.zsh
+++ b/configs/shared/zsh/functions.zsh
@@ -17,7 +17,7 @@ fv() {
   [[ -n "$file" ]] && vim "$file"
 }
 
-tb() {
+tbz() {
   # Toggle between blaze-bin and your source.
   # Useful if you like to cd into the dir where your source lives.
   if [[ $PWD =~ '(.*)/blaze-bin(.*)' ]]; then
@@ -28,7 +28,7 @@ tb() {
 }
 
 tj() {
-  # Toggle between the source dir and test dir.
+  # Toggle between the source dir and test dir in a Java project.
   if [[ $PWD =~ '(.*)/javatests(.*)' ]]; then
     cd "${match[1]}/java${match[2]}"
   else
diff --git a/configs/shared/zsh/variables.zsh b/configs/shared/zsh/variables.zsh
index b241894aaf..53f6f3e84a 100644
--- a/configs/shared/zsh/variables.zsh
+++ b/configs/shared/zsh/variables.zsh
@@ -7,11 +7,20 @@ NIXIFY="$HOME/programming/nixify"
 DATE_FMT=%b-%d-%Y_%T # my preferred date formatting string used for generated filename
 
 # ZSH's static named directories
-hash -d pro="$HOME/programming"
-hash -d dot="$HOME/programming/dotfiles"
-hash -d citc="/google/src/cloud/$USER"
-hash -d doc="$HOME/Documents"
-hash -d d="$HOME/Downloads"
+hash -d pro=~/programming
+hash -d dot=~/programming/dotfiles
+hash -d citc=/google/src/cloud/$USER
+hash -d doc=~/Documents
+hash -d d=~/Downloads
+hash -d ss=~/Pictures/screenshots
+hash -d org=~/Documents/org
+# named directories for commonly used projects
+hash -d korvus_framework=./java/com/google/corp/sales
+hash -d korvus_services=./corp/sales/casesautomation
+hash -d escalations=./corp/gtech/pto/tda/beacons_extension
+hash -d ultra=./ads/doubleclick/systems/crm
+hash -d incentives_fe=./experimental/adservices/jarvis/jarvis_extension/jarvis_staging/js
+hash -d incentives_be=./experimental/adservices/tesseract/handlers/incentives
 
 # commonly used config files
 v="$HOME/.config/nvim/init.vim"