2011-05-03 21:53:50 -07:00
|
|
|
# .zshrc
|
2012-04-16 12:19:58 -07:00
|
|
|
# vim: ft=zsh
|
|
|
|
#
|
|
|
|
# ZSH init for interactive shells
|
|
|
|
#
|
2011-10-20 13:45:40 -07:00
|
|
|
# Eryn Wells <eryn@erynwells.me>
|
2011-05-03 21:53:50 -07:00
|
|
|
|
2012-11-28 21:44:13 -08:00
|
|
|
PROMPT_THEME='loquacious'
|
|
|
|
|
|
|
|
|
2012-04-16 12:19:58 -07:00
|
|
|
# load bash/zsh/ksh agnostic configurations
|
2012-04-17 23:35:27 -07:00
|
|
|
[ -e $HOME/.rc ] && source $HOME/.rc
|
2012-04-16 12:19:58 -07:00
|
|
|
|
2012-08-17 12:48:04 -07:00
|
|
|
|
2012-10-01 13:37:29 -07:00
|
|
|
# Report seconds since shell was invoked in milliseconds
|
|
|
|
typeset -F SECONDS
|
|
|
|
|
2012-11-28 21:44:13 -08:00
|
|
|
print_info_noisy 1 "Initializing interactive Z Shell"
|
2011-09-16 11:28:09 -07:00
|
|
|
|
2012-11-28 21:44:13 -08:00
|
|
|
# Function path
|
|
|
|
function {
|
|
|
|
local myfpath="$HOME/.zsh/func"
|
|
|
|
fpath=($myfpath/makers $myfpath $fpath)
|
2012-03-14 13:17:03 -07:00
|
|
|
}
|
|
|
|
|
2012-11-29 11:15:24 -08:00
|
|
|
print_info_sub_noisy 2 "Loading vcs_info module"
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
zstyle ':vcs_info:*' enable git
|
|
|
|
|
2012-10-01 11:49:58 -07:00
|
|
|
|
2012-11-28 21:44:13 -08:00
|
|
|
print_info_sub_noisy 2 "Configuring prompt: $PROMPT_THEME"
|
|
|
|
autoload -U promptinit
|
|
|
|
promptinit
|
|
|
|
prompt $PROMPT_THEME
|
2012-10-01 13:37:29 -07:00
|
|
|
|
2012-10-01 11:49:58 -07:00
|
|
|
|
2012-11-28 21:44:13 -08:00
|
|
|
print_info_sub_noisy 2 'Setting shell options'
|
2011-05-03 21:53:50 -07:00
|
|
|
setopt \
|
|
|
|
EXTENDED_GLOB \
|
|
|
|
MULTIOS
|
|
|
|
|
2012-11-28 21:44:13 -08:00
|
|
|
|
2012-08-17 12:48:04 -07:00
|
|
|
print_info_sub_noisy 3 'Creating aliases'
|
2011-11-30 13:08:57 -08:00
|
|
|
alias pd='pushd'
|
|
|
|
alias pod='popd'
|
2011-09-14 16:51:40 -07:00
|
|
|
|
2011-09-13 11:26:06 -07:00
|
|
|
#alias -g nc='netcat'
|
2011-05-03 21:53:50 -07:00
|
|
|
alias -g lessnw='less -S'
|
|
|
|
|
|
|
|
# suffix aliases
|
|
|
|
alias -s c='vim'
|
|
|
|
alias -s tex='vim'
|
|
|
|
alias -s txt='vim'
|
|
|
|
alias -s xml='vim'
|
|
|
|
alias -s jar='java -jar'
|
|
|
|
|
|
|
|
# History settings
|
2012-08-17 12:48:04 -07:00
|
|
|
print_info_sub_noisy 4 'Setting up history'
|
2011-05-03 21:53:50 -07:00
|
|
|
setopt \
|
|
|
|
APPEND_HISTORY \
|
|
|
|
EXTENDED_HISTORY \
|
|
|
|
INC_APPEND_HISTORY \
|
|
|
|
HIST_FIND_NO_DUPS \
|
|
|
|
HIST_IGNORE_SPACE \
|
|
|
|
HIST_NO_STORE \
|
|
|
|
HIST_IGNORE_DUPS \
|
|
|
|
HIST_REDUCE_BLANKS
|
|
|
|
|
2011-06-29 22:46:17 -07:00
|
|
|
HISTSIZE=1000000
|
|
|
|
SAVEHIST=1000000
|
2011-05-03 21:53:50 -07:00
|
|
|
HISTFILE="$HOME/.zhistory"
|
|
|
|
|
2012-08-17 12:48:04 -07:00
|
|
|
# command line editing mode
|
|
|
|
function {
|
|
|
|
local mode='vim'
|
|
|
|
print_info_sub_noisy 5 "Using $mode command line editing mode"
|
|
|
|
if [[ $mode == 'vim' ]]; then
|
|
|
|
bindkey -v
|
|
|
|
elif [[ $mode == 'emacs' ]]; then
|
|
|
|
bindkey -e
|
|
|
|
fi
|
|
|
|
}
|
2011-05-03 21:53:50 -07:00
|
|
|
|
|
|
|
|
2012-04-16 12:19:58 -07:00
|
|
|
###
|
2011-05-03 21:53:50 -07:00
|
|
|
# Completion
|
2012-04-16 12:19:58 -07:00
|
|
|
###
|
2011-05-03 21:53:50 -07:00
|
|
|
|
2012-08-17 12:48:04 -07:00
|
|
|
print_info_sub_noisy 2 'Initializing completion system'
|
2012-08-07 11:19:43 -07:00
|
|
|
|
2011-05-03 21:53:50 -07:00
|
|
|
# load completion system
|
|
|
|
autoload -U compinit
|
|
|
|
compinit
|
|
|
|
|
|
|
|
# Completion options
|
|
|
|
setopt \
|
|
|
|
AUTO_REMOVE_SLASH \
|
|
|
|
COMPLETE_IN_WORD
|
|
|
|
|
|
|
|
# Cache completions
|
|
|
|
zstyle ':completion::complete:*' use-cache 1
|
|
|
|
zstyle ':completion::complete:*' cache-path ~/.zsh/cache
|
|
|
|
|
|
|
|
# For rm, cp, and mv don't complete if file is on the line already
|
|
|
|
zstyle ':completion:*:rm:*' ignore-line yes
|
|
|
|
zstyle ':completion:*:cp:*' ignore-line yes
|
|
|
|
zstyle ':completion:*:mv:*' ignore-line yes
|
|
|
|
|
|
|
|
# Remove trailing slashes in directory arguments
|
|
|
|
zstyle ':completion:*' squeeze-slashes true
|
|
|
|
|
|
|
|
# Never select parent directory
|
|
|
|
zstyle ':completion:*:cd:*' ignore-parents parent pwd
|
|
|
|
|
|
|
|
# Expand partial paths
|
|
|
|
zstyle ':completion:*' expand 'yes'
|
|
|
|
|
2012-11-28 09:44:56 -08:00
|
|
|
# Show a pretty menu of killable processes
|
|
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
|
|
|
zstyle ':completion:*:*:kill:*' menu yes select
|
|
|
|
|
2011-05-03 21:53:50 -07:00
|
|
|
###
|
|
|
|
# FUNCTIONS
|
|
|
|
###
|
|
|
|
|
2012-04-16 12:19:58 -07:00
|
|
|
# Generate a password
|
2012-10-05 11:38:49 -07:00
|
|
|
print_info_sub_noisy 3 "Loading pw module"
|
2011-05-03 21:53:50 -07:00
|
|
|
autoload pw
|
2012-11-02 14:38:34 -07:00
|
|
|
|
2012-10-03 11:20:28 -07:00
|
|
|
# Maker module -- various functions for makin' stuff
|
2012-11-02 14:38:34 -07:00
|
|
|
print_info_sub_noisy 3 "Loading makers module"
|
2012-11-02 14:39:04 -07:00
|
|
|
for func in `ls $HOME/.zsh/func/makers`; do
|
2012-11-02 14:38:34 -07:00
|
|
|
autoload $func
|
|
|
|
done
|
2011-05-03 21:53:50 -07:00
|
|
|
|
2011-12-18 22:51:02 -08:00
|
|
|
# Go up $1 directories, where $1 is an integer (saves me from having to type ../
|
|
|
|
# ad nauseum)
|
2011-09-14 16:50:33 -07:00
|
|
|
function up {
|
|
|
|
if [[ -z $1 ]]; then
|
2012-11-12 23:13:16 -08:00
|
|
|
cd ..
|
2011-09-14 16:50:33 -07:00
|
|
|
else
|
2011-12-18 22:51:02 -08:00
|
|
|
local updir=''
|
|
|
|
for (( i=0; $i < $1; i++ ))
|
|
|
|
do
|
|
|
|
updir="../$updir"
|
|
|
|
done
|
2012-11-12 23:13:16 -08:00
|
|
|
cd $updir
|
2011-09-14 16:50:33 -07:00
|
|
|
fi
|
|
|
|
}
|
2011-09-16 11:28:09 -07:00
|
|
|
|
2012-08-17 12:48:04 -07:00
|
|
|
if [ -e $HOME/.zshrc.$SYS ]; then
|
|
|
|
print_info_noisy 3 "Sourcing ${SYS}-specific Z Shell settings"
|
|
|
|
source $HOME/.zshrc.$SYS
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e $HOME/.zshrc.local ]; then
|
|
|
|
print_info_noisy 3 "Sourcing local Z Shell settings"
|
|
|
|
source $HOME/.zshrc.local
|
|
|
|
fi
|