Skip to content

Instantly share code, notes, and snippets.

@dhavalsavalia
Last active February 3, 2019 15:53
Show Gist options
  • Save dhavalsavalia/5e1d8259c54bb632c064713237aa54a0 to your computer and use it in GitHub Desktop.
Save dhavalsavalia/5e1d8259c54bb632c064713237aa54a0 to your computer and use it in GitHub Desktop.
My ZSH config
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
#export ZSH_THEME="zanshin"
POWERLEVEL9K_MODE='nerdfont-complete'
ZSH_THEME="powerlevel9k/powerlevel9k"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# export DISABLE_AUTO_TITLE="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(git textmate lighthouse)
plugins=(git textmate osx zsh-syntax-highlighting you-should-use h z)
source $ZSH/oh-my-zsh.sh
# ZSH-SYNTAX-HIGHLIGHTING
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern url)
ZSH_HIGHLIGHT_STYLES[url-good]='fg=blue,bold'
ZSH_HIGHLIGHT_STYLES[url-bad]='fg=magenta,bold'
# Customize to your needs...
# added my path 2011.7.19
export PATH=/usr/local/bin:/usr/local/apache-maven-2.2.1/bin:/usr/local/maven-1.1/bin:/Developer/android/android-sdk-mac_x86/tools:/usr/local/mysql/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/mark/.rvm/bin
# added RVM stuff
# load RVM
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# copied from .bash_aliases 2001.07.19
# -------------------------------------------------------------------
# some alias settings, just for fun
# -------------------------------------------------------------------
#alias 'today=calendar -A 0 -f ~/calendar/calendar.mark | sort'
alias 'today=calendar -A 0 -f /usr/share/calendar/calendar.mark | sort'
alias 'dus=du -sckx * | sort -nr'
alias 'adventure=emacs -batch -l dunnet'
alias 'mailsize=du -hs ~/Library/mail'
alias 'bk=cd $OLDPWD'
alias 'ttop=top -ocpu -R -F -s 2 -n30'
alias lh='ls -a | egrep "^\."'
alias vi='vim'
alias rs='rsync -a --progress --stats --human-readable'
# -------------------------------------------------------------------
# make some commands (potentially) less destructive
# -------------------------------------------------------------------
alias 'rm=rm -i'
# -------------------------------------------------------------------
# Jboss
# -------------------------------------------------------------------
alias 'startjboss=/usr/local/jboss-4.0.5.GA/bin/run.sh &'
alias 'stopjboss=/usr/local/jboss-4.0.5.GA/bin/shutdown.sh --shutdown'
# -------------------------------------------------------------------
# Mercurial (hg)
# -------------------------------------------------------------------
alias 'h=hg status'
alias 'hc=hg commit'
alias 'push=hg push'
alias 'pull=hg pull'
alias 'clone=hg clone'
# -------------------------------------------------------------------
# Git
# -------------------------------------------------------------------
alias gi='git init'
alias ga='git add'
alias gp='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gm='git commit -m'
alias gma='git coeditor.fontFamilymmit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpu='git pull'
alias gcl='git clone'
alias gta='git tag -a -m'
alias gf='git reflog'
# leverage an alias from the ~/.gitconfig
alias gh='git hist'
# -------------------------------------------------------------------
# Oddball stuff
# -------------------------------------------------------------------
alias 'sloc=/usr/local/sloccount/bin/sloccount'
# docker
alias dcup='docker-compose up'
alias dcrun='docker-compose --rm run'
# necessary to make rake work inside of zsh
alias rake="noglob rake"
# sort files in current directory by the number of words they contain
alias 'wordy=wc -w * | sort | tail -n10'
alias 'filecount=ls -aRF | wc -l'
# alias for colorls
alias ls='colorls -A --sd'
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
# -------------------------------------------------------------------
# Functions ported directly from .bashrc
# -------------------------------------------------------------------
# turn hidden files on/off in Finder
function hiddenOn() { defaults write com.apple.Finder AppleShowAllFiles YES ; }
function hiddenOff() { defaults write com.apple.Finder AppleShowAllFiles NO ; }
# postgres functions
function psqlstart() { /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start ; }
function psqlstop() { /usr/local/pgsql/bin/pg_ctl stop ; }
# view man pages in Preview
function pman() { ps=`mktemp -t manpageXXXX`.ps ; man -t $@ > "$ps" ; open "$ps" ; }
# apache tomcat functions
function tomcatup() { /usr/local/tomcat/bin/startup.sh ; }
function tomcatdown() { /usr/local/tomcat/bin/shutdown.sh ; }
# nice mount (http://catonmat.net/blog/another-ten-one-liners-from-commandlingfu-explained)
# displays mounted drive information in a nicely formatted manner
function nicemount() { (echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2="";1') | column -t ; }
#
## new functions
#
s() { pwd > ~/.save_dir ; }
i() { cd "$(cat ~/.save_dir)" ; }
## my custom environment vars
PIP_USER=true
#
## powelevel9k functions
#
prompt_pyversion() {
if [[ "$VIRTUAL_ENV" != "" ]]
then
PYV=`python3 -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)";`
echo -n " v$PYV ";
else
fi
}
TERM=xterm-256color
source $(dirname $(gem which colorls))/tab_complete.sh
# Advanced `custom_pyversion` color customization
POWERLEVEL9K_CUSTOM_PYVERSION=prompt_pyversion
POWERLEVEL9K_CUSTOM_PYVERSION_FOREGROUND='027'
POWERLEVEL9K_CUSTOM_PYVERSION_DARK_FOREGROUND='027'
POWERLEVEL9K_CUSTOM_PYVERSION_BACKGROUND='011'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir virtualenv vcs dir_writable)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status rbenv custom_pyversion)
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=""
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
# Advanced `vcs` color customization
POWERLEVEL9K_VCS_FOREGROUND='blue'
POWERLEVEL9K_VCS_DARK_FOREGROUND='black'
POWERLEVEL9K_VCS_BACKGROUND='green'
# Advanced `vierualenv` color customization
POWERLEVEL9K_VIRTUALENV_FOREGROUND='white'
POWERLEVEL9K_VIRTUALENV_DARK_FOREGROUND='white'
POWERLEVEL9K_VIRTUALENV_BACKGROUND='magenta'
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/base16-material.dark.sh"
[[ -s $BASE16_SHELL ]] && source $BASE16_SHELL
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment