Drop support for ZSH

I've been using Fish consistently for about a month now, and I don't see myself
switching back to ZSH. Some of the code from this commit should be published. I
may get around to that one day. Before I did that, I would need to clean it up
and document it, which I won't be doing today.

Thank you, ZSH, for your service.
This commit is contained in:
William Carroll 2020-01-29 12:48:23 +00:00
parent 093b566e71
commit 15110e6de9
7 changed files with 5 additions and 1633 deletions

View file

@ -73,10 +73,9 @@ $ xclip -sel clip <~/.ssh/id_rsa.pub
$ browse github.com # paste ssh public key in settings
```
1. Install Antigen, Vundle, nix-env
1. Install Vundle, nix-env
```bash
$ ln -s ~/Dropbox/antigen.zsh ~/antigen.zsh
$ ln -s ~/Dropbox/Vundle.vim ~/.config/nvim/bundle/Vundle.vim
$ cat ~/Dropbox/install_nix.sh | sh
$ for p in $(cat nix-env.txt); do
@ -112,10 +111,10 @@ $ DOTFILES="$(pwd)" make install
For now, this deserves its own section since it isn't automated.
```zsh
gclone tj/n # clone repo
sudo make install # build from source
n stable # install the stable version of node
```bash
$ gclone tj/n # clone repo
$ sudo make install # build from source
$ n stable # install the stable version of node
```
- TODO: support dependencies like terminal themes

View file

@ -1,12 +0,0 @@
# ZSH seems to avoid sourcing ~/.profile during SSH sessions.
# X (or something else) seems to source ~/.profile with it initializes.
# Putting this here allows my SSH sessions to have the expected configuration.
#
# Putting this here instead of in my .zshrc or .zshenv is advantageous since it
# is only called once when a terminal is created; subshells and nested ZSH
# sessions don't re-source this file.
#
# See this thread for more information: https://groups.google.com/a/google.com/forum/#!topic/zsh-users/VO2lEJRfFzk
source ~/.profile
export PATH="$HOME/.cargo/bin:$PATH"

View file

@ -1,89 +0,0 @@
# Necessary to add this line and keep it at the top of my ~/.zshrc to ensure
# that Tramp works as expected. This was taken from here:
# https://www.emacswiki.org/emacs/TrampMode
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
source ~/antigen.zsh
# Helper functions
# TODO: Find a way to share these functions across zsh files.
defensively_source() {
# Checks if the file exists before sourcing it
if [ -f $1 ]; then
source $1
else
"Cannot source: $1. Aborting..."
fi
}
command_exists() {
# Predicate to check if the command exists
command -v $1 >/dev/null
}
# Load the oh-my-zsh library
antigen use oh-my-zsh
# Bundles from robbyrussell's oh-my-zsh repo.
antigen bundle git
antigen bundle extract # extracts archives polymorphically
antigen bundle zsh-completions # extracts archives polymorphically
# Syntax highlighting
antigen bundle zsh-users/zsh-syntax-highlighting
# Theming
case $(hostname) in
$DESKTOP) antigen theme frisk;;
$LAPTOP) antigen theme refined;;
$CLOUDTOP) antigen theme cloud;;
acer-manjaro) antigen theme frisk;;
esac
# Leave this last
antigen apply
# Configure fzf
if command_exists fzf-share; then
source "$(fzf-share)/key-bindings.zsh"
fzf-locate-widget() {
# Press M-i to search entire locate database with fzf.
local selected
if selected=$(locate / | fzf); then
LBUFFER+=$selected
fi
zle redisplay
}
zle -N fzf-locate-widget
bindkey '\ei' fzf-locate-widget
else
defensively_source "/usr/share/fzf/key-bindings.zsh"
fi
# Configure fasd
eval "$(fasd --init auto)"
# the above line slows tab-completion down dramatically because it attemtps to
# autocomplete for the 600k+ users found in `compgen -u`. Below is a fix which
# also restores the function of `cd ~<tab>` to display only ZSH Named
# Directories.
zstyle ':completion:*' users root $USER
# Avoiding the defensive source because I want to ensure these files are
# available.
source "$DOTFILES/configs/shared/variables.zsh"
source "$DOTFILES/configs/shared/aliases.zsh"
source "$DOTFILES/configs/shared/functions.zsh"
source "$DOTFILES/configs/shared/zle.zsh"
preexec() {
# `preexec` runs before every command is run.
update_x11_forwarding
}
defensively_source ~/.rvm/scripts/rvm # Ruby
defensively_source ~/.opam/opam-init/init.zsh # OCaml
defensively_source ~/.ghcup/env # Haskell
defensively_source /etc/bash_completion.d/g4d # Google's g4d

View file

@ -1,255 +0,0 @@
# Applications
# java: jv
# tmux: t
# $EDITOR: e
# vim: v
# GnuPG: gpg
# blaze: bz
# borgcfg: br
# piper: pi
# pass: ps
# pastebin: pb
# pacman: pm
# codesearch: cs
# git: g
# mercurial: hg
# aptitude: apt
# chrome: c
# elixir: ex
# haskell: hk
# wifi: wf
# piper: pp
# g4: pp
# g4d: pp
# cci: circleci
#
# Supported qualifiers:
# hidden: h
# ignore-case: i
#
# Supported verbs:
# source: s
# install: i
# test: t
# build: b
# list: ls
# shell: sh
# Misc
alias c="xclip -selection clipboard -i"
alias p="xclip -selection clipboard -o"
alias cp=cp_dwim
alias mdd=mkdir_cd
alias mdp='mkdir --parents'
alias ls="exa --sort=type"
alias ll="exa --long --sort=type"
alias la="exa --long --all --sort=type"
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 --create-frame"
alias cat="bat --theme=TwoDark"
alias j='fasd_cd -d' # to emulate autojump; my muscle memory is hardened here
alias vim=nvim # prefer neovim to vim
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
alias define=sdcv # uses stardict to lookup a word
alias intellij='nohup /opt/intellij-ce-stable/bin/idea.sh >/dev/null 2>&1 &'
alias tpr='tput reset'
alias nordvpn='sudo openvpn /etc/openvpn/ovpn_tcp/us3559.nordvpn.com.tcp.ovpn' # connects to the nordvpn servers in USA
alias perms='ls -ld' # list the permissions of a directory
alias please='sudo $(fc -ln -1)'
alias plz=please # for those keystroke-conscience folks
alias rmrf='rm -rf' # sometimes the dash is just too much...
alias open=xdg-open
alias o=open
alias simple_vim='vim -u ~/.config/nvim/simple.vim' # vim without a zero-dependency vimrc
alias stopx='sudo service lightdm stop' # stop X server session
alias next_wallpaper="emacsclient --eval '(wallpaper/next)'" # Cycles forwards one wallpaper.
alias prev_wallpaper="emacsclient --eval '(wallpaper/prev)'" # Cycles backwards one wallpaper.
# filesystem
alias files=laf
alias dirs=lad
alias links=lal
# device / power mgt
alias off='shutdown now' # TODO: Consider using `systemctl poweroff`
alias suspend='systemctl suspend'
alias hibernate='systemctl hibernate'
# pass
alias pscp='pass show --clip'
# nmcli
# NOTE: check out `tldr nmcli` for more information
alias wfls='nmcli device wifi' # list available wifi network
alias wfc='nmcli device wifi connect' # connect to a Wifi network
# Gnome
alias na=nautilus # Gnome's graphical file browser. Useful to click and dragging files into emails
# Tmux
alias tls='tmux list-sessions'
alias ta='tmux attach' # NOTE: `t` works for this as well
alias td='tmux detach' # prefer using the KBD for this (i.e. <leader>d)
# Chrome
alias cssh='chrome --app-id=pnhechapfaindjhompbnflcldabbghjo' # Secure Shell
alias crd='chrome --app-id=gbchcmhmhahfdphkhkmpfmihenigjmpp' # Chrome Remote Desktop
# Dropbox
alias drst='dropbox.py status'
# Docker
alias dk="docker"
alias dkps="docker ps"
alias dkpsa="docker ps -a"
alias dkrm="docker rm"
alias dkrmi="docker rmi"
alias dkrd="docker run -d"
alias dki="docker images"
# Java
alias jvsh='CLASSPATH=$(fd \\.jar$ ~pro/jars | tr \\n :) jshell'
# Elixir
alias m="mix"
alias mc="mix compile"
alias mcf="mix compile --force"
alias ism="iex -S mix"
alias tism="MIX_ENV=test iex -S mix"
alias mdg="mix deps.get"
alias mdu="mix deps.update"
alias mdup="mix docker.up"
alias repl_ex='dkish elixir iex' # depends on the docker aliases
# Clojure
alias repl_clj='dkish clojure lein repl'
# GPG
alias gpged='gpg --edit-key wpcarro@gmail.com'
alias gpge='gpg --encrypt'
alias gpgd='gpg --decrypt'
alias gpgls='gpg --list-keys'
# 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"
alias gprom="git pull --rebase origin master"
alias gca="git commit --amend"
alias gcan="git commit --amend --no-edit"
alias gpf="git push --force"
alias gpff="git push --force --no-verify"
alias gds="git diff --staged"
alias gfx="git commit --fixup"
alias gsh="git show"
alias gbm="git branch --merged"
alias gwip="git add . && git commit -m wip"
alias gpr="git pull-request"
alias gst="git status && hub pr list" # git status and list open hub PRs (if is a GH repository)
# 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='PAGER="" 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'
alias hgls='hg citc --list' # should have different output from `pils`
alias hgrc='hg rebase --continue'
alias hgra='hg rebase --abort'
alias hgconflicts="hg resolve --list 'set:unresolved()'" # much like `gconflicts`
alias hgrm='hg citc -d' # delete a CitC client created with Fig
# Piper
alias ppls='g4 listclients | sed "s/^Client wpcarro://" | sed "s/:[0-9]*:citc.*$//g"'
alias pprm='p4 citc -d -f' # warning this will forcefully delete a CitC client even if contains pending changes
# Haskell
alias sb="stack build"
alias se="stack exec --"
alias sc="stack clean"
# alias st="stack test" # blocks suckless-terminal
alias haddocks='open "$(stack path --local-doc-root)/index.html"'
alias repl_hk='dkish haskell ghci'
# Kubernetes
alias kc="kubectl"
alias kpods="kubectl get pods"
alias knodes="kubectl get nodes"
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 ni='nix-env --install'
alias nrm='nix-env --uninstall'
alias nls='nix-env --query'
alias nrs='sudo nixos-rebuild switch'
# Aptitude (apt)
alias apti='sudo apt-get install --assume-yes'
alias aptrm='sudo apt remove'
# Pacman
alias pmi='sudo pacman -S --noconfirm'
alias pms='pacman -Ss'
alias pmrm='sudo pacman -Rs'
# couple the e* aliases to the <leader>e* kbds in vim
alias ev='e ~/.config/nvim/init.vim'
alias ee='e ~/.emacs.d/init.el'
alias ez='e ~/.zshrc'
alias ea='e ~/aliases.zsh'
alias ef='e ~/functions.zsh'
alias el='e ~/variables.zsh'
alias ex='e ~/.Xresources'
alias em='e ~/.tmux.conf'
# TODO: consider DRYing this up with `e`. Unfortunately, `sudo` won't support
# aliases.
alias en='sudo ALTERNATE_EDITOR=nvim emacsclient --no-wait --create-frame /etc/nixos/configuration.nix'
# couple the s* aliases to the <leader>s* kbds in vim
alias sz='source ~/.zshrc'
alias sa='source ~/aliases.zsh'
alias sf='source ~/functions.zsh'
alias sl='source ~/variables.zsh'
alias sx='xrdb ~/.Xresources'
alias sm='tmux source-file ~/.tmux.conf'
alias sn='sudo nixos-rebuild switch'
# CircleCI
alias cci='circleci local'
alias ccijob='circleci local execute --job'
# Google aliases
alias bzb='blaze build'
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
alias pbc='pb --private --title $(date +${date_fmt})| tee >(c && chrome $(p))' # create a private gPaste from your clipboard's content; open the result in a browser
alias pbcp='p | pb --private --title $(date +${date_fmt})| tee >(c && chrome $(p))' # create a private gPaste from your clipboard's content; open the result in a browser
alias pbls='$BROWSER https://paste.googleplex.com/$(whoami)'
alias flagpick=/google/data/ro/users/sk/skaushik/www/public-tools/flagpick
alias jaze=/google/data/ro/projects/devtools/javascript/jaze
alias aclcheck=/google/data/ro/projects/ganpati/aclcheck
alias g3python=/google/data/ro/projects/g3python/g3python

File diff suppressed because it is too large Load diff

View file

@ -1,66 +0,0 @@
export GPG_TTY=$(tty) # "It is important that this environment variable always reflects the output of the tty command". Source: https://gnupg.org/documentation/manuals/gnupg-devel/Invoking-GPG_002dAGENT.html
date_fmt=%b-%d-%Y_%T # my preferred date formatting string used for generated filename
# ZSH's static named directories
hash -d pro=~/programming
hash -d dot="$DOTFILES"
hash -d wpg=~/.config/wpg/templates
hash -d citc=/google/src/cloud/$USER
hash -d doc=~/Documents
hash -d d=~/Downloads
hash -d ss=~/Pictures/screenshots
hash -d fonts="$DOTFILES/configs/shared/.local/share/fonts"
hash -d sounds="$DOTFILES/configs/shared.local/share/sounds"
hash -d wallpaper="$DOTFILES/configs/shared/.local/share/wallpaper"
hash -d org="$ORG_DIRECTORY"
hash -d x20=/google/data/rw/users/wp/wpcarro # remember: to access x20, you need to run `prodaccess`
hash -d experimental=./experimental/users/wpcarro
# 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
hash -d spewall_fe=./alkali/apps/speakeasydashboard
hash -d spewall_be=./java/com/google/alkali/applications/speakeasydashboard
hash -d spewall_protos=./google/internal/alkali/applications/speakeasydashboard
hash -d spewall_tests=./javatests/com/google/alkali/applications/speakeasydashboard
# 8-bit colors
black='\u001b[30m'
red='\u001b[31m'
green='\u001b[32m'
yellow='\u001b[33m'
blue='\u001b[34m'
magenta='\u001b[35m'
cyan='\u001b[36m'
white='\u001b[37m'
bright_black='\u001b[30;1m'
bright_red='\u001b[31;1m'
bright_green='\u001b[32;1m'
bright_yellow='\u001b[33;1m'
bright_blue='\u001b[34;1m'
bright_magenta='\u001b[35;1m'
bright_cyan='\u001b[36;1m'
bright_white='\u001b[37;1m'
# some of my favorite emojis as unicode
facepalm='\U1F926'
eyeroll='\U1F644'
sheesh='\U1F62C'
see_no_evil='\U1F648'
blush='\U1F60A'
wink='\U1F609'
laugh='\U1F923'
# commonly used config files
v="$HOME/.config/nvim/init.vim"
e="$HOME/.emacs.d/init.el"
z="$HOME/.zshrc"
a="$HOME/aliases.zsh"
f="$HOME/functions.zsh"
l="$HOME/variables.zsh" # v is taken by vim
x="$HOME/.Xresources"
n="/etc/nixos/configuration.nix"

View file

@ -1,31 +0,0 @@
#!/usr/bin/env zsh
zle_insert_subshell() {
LBUFFER+='$(' ; RBUFFER=")$RBUFFER"
}
zle -N zle_insert_subshell
bindkey '^j' zle_insert_subshell
zle_insert_variable() {
LBUFFER+='${' ; RBUFFER="}$RBUFFER"
}
zle -N zle_insert_variable
bindkey '^v' zle_insert_variable
zle_insert_2x_dash() {
LBUFFER+=' --'
}
zle -N zle_insert_2x_dash
bindkey '^[^f' zle_insert_2x_dash
zle_insert_2x_quote() {
LBUFFER+=' "' ; RBUFFER="\"$RBUFFER"
}
zle -N zle_insert_2x_quote
bindkey '^["' zle_insert_2x_quote
zle_insert_quote() {
LBUFFER+=" '" ; RBUFFER="'$RBUFFER"
}
zle -N zle_insert_quote
bindkey "^['" zle_insert_quote