Skip to content

Instantly share code, notes, and snippets.

@bharadwaj-raju bharadwaj-raju/zsh.zsh
Last active May 1, 2016

Embed
What would you like to do?
My ultra-custom zshrc
# Path to your oh-my-zsh installation.
export ZSH=/home/bharadwaj/.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.
ZSH_THEME="bullet-train"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git gnu-utils ubuntu zsh-syntax-highlighting)
#{{{ Options
# Disable the annoying "You have new mail" message
unset MAILCHECK
# History search
bindkey "^[[A" up-line-or-search
bindkey "^[[B" down-line-or-search
# why would you type 'cd dir' if you could just type 'dir'?
setopt AUTO_CD
# Now we can pipe to multiple outputs!
setopt MULTIOS
# Spell check commands! (Sometimes annoying)
setopt CORRECT
# This makes cd=pushd
setopt AUTO_PUSHD
# This will use named dirs when possible
setopt AUTO_NAME_DIRS
# If we have a glob this will expand it
setopt GLOB_COMPLETE
setopt PUSHD_MINUS
# No more annoying pushd messages...
# setopt PUSHD_SILENT
# blank pushd goes to home
setopt PUSHD_TO_HOME
# this will ignore multiple directories for the stack. Useful? I dunno.
setopt PUSHD_IGNORE_DUPS
# 10 second wait if you do something that will delete everything. I wish I'd had this before...
setopt RM_STAR_WAIT
# use magic (this is default, but it can't hurt!)
setopt ZLE
setopt NO_HUP
setopt VI
# One day, when I learn vim...
export EDITOR="nano"
setopt IGNORE_EOF
# If I could disable Ctrl-s completely I would!
setopt NO_FLOW_CONTROL
# beeps are annoying
setopt NO_BEEP
# echo "station" > station *will* clobber station
setopt CLOBBER
# Case insensitive globbing
setopt NO_CASE_GLOB
# Be Reasonable!
setopt NUMERIC_GLOB_SORT
# I don't know why I never set this before.
setopt EXTENDED_GLOB
# hows about arrays be awesome? (that is, frew${cool}frew has frew surrounding all the variables, not just first and last
setopt RC_EXPAND_PARAM
#}}}
#{{{ Aliases
#{{{ Shell Conveniences
alias sz='source ~/.zshrc'
alias ez='vim ~/.zshrc'
alias new='touch'
alias mk=mkdir
alias ls='pwd; ls --color'
alias cls='clear'
alias resh='clear; sz'
alias php='php-cgi'
#}}}
#{{{ Misc
#alias gedit='kate' # KDE > Gnome
#}}}
#{{{ Files
alias diskspace='df -Tha --total'
alias codecommit='git add .; git commit; git push origin master'
alias linecount='wc -l <'
alias charcount='wc -c <'
alias filecount='ls -1 | wc -l'
alias rmcrlf='sed -i -e 's/\r$//''
#}}}
#{{{ Long commands
alias weather='curl --silent http://wttr.in/ | head -7'
alias forecast='curl --silent http://wttr.in/'
alias forecast1='curl --silent http://wttr.in/ | sed -e "1,7d;17q"'
alias forecast2='curl --silent http://wttr.in/ | sed -e "1,17d;27q"' #> $HOME/.forecast2; cat $HOME/.forecast2'
alias forecast3='curl --silent http://wttr.in/ | sed -e "1,27d;37q"'
alias moon='curl --silent http://wttr.in/Moon'
alias startvncserver='x11vnc -auth guess -forever -tightfilexfer -loop -noxdamage -repeat -rfbauth /home/bharadwaj/.vnc/passwd -rfbport 5900 -shared -ncache 10 &'
alias getip="ifconfig | grep 'inet addr:19' | sed 's/.\{40\}$//' | sed 's/inet addr://g' | tr -d '[:blank:]'"
alias lswin="wmctrl -l | awk '{print $4}'"
#alias chknet='if [ ping -c 3 google.com ]; echo "Working"; fi'
alias pubip='dig +short myip.opendns.com @resolver1.opendns.com'
alias psin='ps -fp'
#}}}
# Prevents xkcd.com/1168
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f "$1" ] ; then
NAME=${1%.*}
#mkdir $NAME && cd $NAME
case "$1" in
*.tar.bz2) tar xvjf ./"$1" ;;
*.tar.gz) tar xvzf ./"$1" ;;
*.tar.xz) tar xvJf ./"$1" ;;
*.lzma) unlzma ./"$1" ;;
*.bz2) bunzip2 ./"$1" ;;
*.rar) unrar x -ad ./"$1" ;;
*.gz) gunzip ./"$1" ;;
*.tar) tar xvf ./"$1" ;;
*.tbz2) tar xvjf ./"$1" ;;
*.tgz) tar xvzf ./"$1" ;;
*.zip) unzip ./"$1" ;;
*.Z) uncompress ./"$1" ;;
*.7z) 7z x ./"$1" ;;
*.xz) unxz ./"$1" ;;
*.exe) cabextract ./"$1" ;;
*) echo "extract: '$1' - unknown archive method" ;;
esac
else
echo "'$1' - file does not exist"
fi
fi
}
# Autocompile
function compile {
# NOTE: Requires the extract() shell function
if [ -z "$1" ]; then
# Display usage if no parameters given
echo "Usage: compile <source code archive>"
else
if [ -f "$1" ] ; then
extract "$1"
filename=$(basename "$1")
foldername="${filename%.*}" # Remove extension
if [[ "${foldername##*.}" == *tar ]] ; then # Workaround tar.*
foldername="${foldername%.*}"
fi
pushd "$foldername"
if ls ./autogen* 1> /dev/null 2>&1 ; then
sh ./autogen*
fi
if ls ./configure 1> /dev/null 2>&1 ; then
sh ./configure
elif ls ./configure.sh 1> /dev/null 2>&1 ; then
sh ./configure.sh
fi
make
sudo make install
make distclean
popd
else
echo "Error: file $1 does not exist"
fi
fi
}
#}}}
# A tribute to FreeBSD
make() {
if [[ $@ == "love" ]]; then
command echo "Not war."
else
command make "$@"
fi
}
#{{{ Media
# Better with the GUI here
#}}}
#{{{ Package management (Debian)
alias pkginstall='sudo apt-get install'
alias pkgrm='sudo apt-get remove'
alias pkgsearch='apt-cache search'
alias rmarchs='sudo apt-get autoclean && sudo apt-get clean'
alias rmunusedpkgs='sudo apt-get autoremove'
#}}}
#{{{
alias setupmpdhttp='mpc clear; mpc add http://localhost:8000; mpc ls | mpc add; mpc enable 1'
alias fullmpdstart='mpd &; ympd &; setupmpdhttp'
#}}}
#}}}
#{{{ Prompt
TMOUT=1
TRAPALRM() {
zle reset-prompt
}
#}}}
# User configuration
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/texlive/2007/bin/i386-linux"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
source /etc/zsh_command_not_found
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.