My .zshrc with ohmyzsh and bullet train theme, includes various utilities for easy life
export ZSH=/Users/u/.oh-my-zsh | |
# Bullet train needs powerline fonts unavailable in VSCode | |
# ps -p `ps -o pid,ppid | awk "/^ *$$/ {print \$2}"` | grep -q "Visual Studio Code" && ZSH_THEME="random" | |
[[ -n "$VSCODE_PID" ]] && ZSH_THEME="random" || ZSH_THEME="bullet-train" | |
plugins=(git brew virtualenv osx zsh-completions) | |
# DISABLE_AUTO_UPDATE="true" | |
# export UPDATE_ZSH_DAYS=13 | |
BULLETTRAIN_CUSTOM_MSG="Rabbit!" | |
BULLETTRAIN_CUSTOM_FG=black | |
BULLETTRAIN_CUSTOM_BG=magenta | |
BULLETTRAIN_DIR_FG=black | |
BULLETTRAIN_VIRTUALENV_FG=black | |
BULLETTRAIN_PROMPT_ORDER=( | |
time | |
status | |
custom | |
# context | |
dir | |
perl | |
ruby | |
virtualenv | |
# nvm | |
aws | |
go | |
elixir | |
git | |
hg | |
cmd_exec_time | |
) | |
HYPHEN_INSENSITIVE="true" | |
COMPLETION_WAITING_DOTS="true" | |
DISABLE_UNTRACKED_FILES_DIRTY="true" | |
source $ZSH/oh-my-zsh.sh | |
# User configuration | |
# --- Golang config | |
GOPATH_ORIG="$HOME/Programming/go" | |
export GOPATH='/tmp/go' | |
[[ -n "$VSCODE_PID" ]] || export GOROOT_FINAL=$GOPATH | |
[ ! -d $GOPATH ] && ln -s "$GOPATH_ORIG" "$GOPATH" | |
[[ ! $PATH =~ $GOPATH ]] && export PATH=$PATH:$GOPATH/bin | |
# --- Qt environments | |
export QT_VERSION='5.8.1' | |
export QT_PATH='/usr/local/opt/qt' | |
# --- Miscellaneous configs | |
export LANG=en_US.UTF-8 | |
export VIRTUALENVWRAPPER_PYTHON='/usr/local/bin/python2' | |
export HOMEBREW_BOTTLE_DOMAIN='https://mirrors.ustc.edu.cn/homebrew-bottles' | |
export PATH=$PATH:/opt/metasploit-framework/bin | |
alias certbot='/usr/local/bin/certbot --config-dir /usr/local/etc/letsencrypt --work-dir /usr/local/var/lib/letsencrypt' | |
alias hdiattach='hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount' | |
alias hdimount='hdiutil attach -imagekey diskimage-class=CRawDiskImage' | |
alias gbw='GOOS=windows GOARCH=386 go build' | |
alias workon='[ -n "$WORKON_HOME" ] || source `which virtualenvwrapper.sh` && workon' | |
function md5check() {grep $(md5 -q "$@") "$@.md5sum" && echo "Success"} | |
# function vscode() {open -n -b "com.microsoft.VSCode" --args "$PWD/$*" } # install `code` cmdline tool in VSCode instead | |
function hexedit() {open -b "com.ridiculousfish.HexFiend" "$PWD/$*" } | |
function stsrv() { [ -n "$1" ] && { brew services $1 syncthing ; brew services $1 syncthing-inotify } } | |
function togbk() { echo "$(iconv -t gbk $1)" > $1 } | |
function goenv() { | |
if [[ -n "$1" ]]; then | |
GENV="${1:a}" | |
else | |
GENV="$PWD" | |
while [[ "$GENV" != "/" && "${GENV:t}" != "src" ]]; do | |
GENV=${GENV:h} | |
done | |
if [[ "$GENV" == "/" ]]; then | |
GENV="$PWD" | |
else | |
GENV="${GENV:h}" | |
fi | |
fi | |
# [ -n "$1" ] && GENV=$1 || GENV=`pwd`; | |
mkdir -p "$GENV" && export GOPATH="$GENV" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment