2014-03-07 16:38:23 -08:00
|
|
|
# modify the prompt to contain git branch name if applicable
|
|
|
|
git_prompt_info() {
|
2015-01-25 16:48:36 -08:00
|
|
|
current_branch=$(git current-branch 2> /dev/null)
|
|
|
|
if [[ -n $current_branch ]]; then
|
2015-02-12 15:20:25 +01:00
|
|
|
echo " %{$fg_bold[green]%}$current_branch%{$reset_color%}"
|
2014-03-07 16:38:23 -08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
setopt promptsubst
|
2014-03-26 22:30:07 -07:00
|
|
|
export PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '
|
2014-03-07 16:38:23 -08:00
|
|
|
|
2011-01-13 17:26:04 -05:00
|
|
|
# load our own completion functions
|
|
|
|
fpath=(~/.zsh/completion $fpath)
|
|
|
|
|
|
|
|
# completion
|
|
|
|
autoload -U compinit
|
|
|
|
compinit
|
|
|
|
|
2014-03-07 16:38:23 -08:00
|
|
|
# load custom executable functions
|
2013-03-01 23:32:03 -05:00
|
|
|
for function in ~/.zsh/functions/*; do
|
|
|
|
source $function
|
|
|
|
done
|
|
|
|
|
2014-03-07 16:38:23 -08:00
|
|
|
# makes color constants available
|
|
|
|
autoload -U colors
|
|
|
|
colors
|
|
|
|
|
|
|
|
# enable colored output from ls, etc
|
|
|
|
export CLICOLOR=1
|
|
|
|
|
2013-08-03 11:44:23 -07:00
|
|
|
# history settings
|
2014-04-04 15:08:10 -07:00
|
|
|
setopt hist_ignore_all_dups inc_append_history
|
|
|
|
HISTFILE=~/.zhistory
|
2013-08-03 11:44:23 -07:00
|
|
|
HISTSIZE=4096
|
2014-03-21 23:04:57 +01:00
|
|
|
SAVEHIST=4096
|
2011-01-13 17:26:04 -05:00
|
|
|
|
2013-08-03 11:44:23 -07:00
|
|
|
# awesome cd movements from zshkit
|
|
|
|
setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars
|
|
|
|
DIRSTACKSIZE=5
|
|
|
|
|
|
|
|
# Enable extended globbing
|
|
|
|
setopt extendedglob
|
|
|
|
|
|
|
|
# Allow [ or ] whereever you want
|
|
|
|
unsetopt nomatch
|
2011-01-13 17:26:04 -05:00
|
|
|
|
|
|
|
# vi mode
|
|
|
|
bindkey -v
|
2011-03-25 09:45:53 -04:00
|
|
|
bindkey "^F" vi-cmd-mode
|
2011-01-14 01:17:25 -05:00
|
|
|
bindkey jj vi-cmd-mode
|
2011-01-13 17:26:04 -05:00
|
|
|
|
2013-08-03 11:44:23 -07:00
|
|
|
# handy keybindings
|
2011-01-14 01:17:25 -05:00
|
|
|
bindkey "^A" beginning-of-line
|
|
|
|
bindkey "^E" end-of-line
|
2013-08-03 11:44:23 -07:00
|
|
|
bindkey "^R" history-incremental-search-backward
|
2011-01-14 01:17:25 -05:00
|
|
|
bindkey "^P" history-search-backward
|
|
|
|
bindkey "^Y" accept-and-hold
|
|
|
|
bindkey "^N" insert-last-word
|
|
|
|
bindkey -s "^T" "^[Isudo ^[A" # "t" for "toughguy"
|
|
|
|
|
2013-07-07 15:55:41 -07:00
|
|
|
# aliases
|
|
|
|
[[ -f ~/.aliases ]] && source ~/.aliases
|
|
|
|
|
2014-07-22 16:51:20 +02:00
|
|
|
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
|
|
|
|
# these are loaded first, second, and third, respectively.
|
|
|
|
_load_settings() {
|
|
|
|
_dir="$1"
|
|
|
|
if [ -d "$_dir" ]; then
|
|
|
|
if [ -d "$_dir/pre" ]; then
|
2014-10-03 10:28:08 -07:00
|
|
|
for config in "$_dir"/pre/**/*(N-.); do
|
2014-07-22 16:51:20 +02:00
|
|
|
. $config
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2014-10-03 10:28:08 -07:00
|
|
|
for config in "$_dir"/**/*(N-.); do
|
2014-07-22 16:51:20 +02:00
|
|
|
case "$config" in
|
|
|
|
"$_dir"/pre/*)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
"$_dir"/post/*)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -f $config ]; then
|
|
|
|
. $config
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -d "$_dir/post" ]; then
|
2014-10-03 10:28:08 -07:00
|
|
|
for config in "$_dir"/post/**/*(N-.); do
|
2014-07-22 16:51:20 +02:00
|
|
|
. $config
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
_load_settings "$HOME/.zsh/configs"
|
|
|
|
|
2013-07-07 15:55:41 -07:00
|
|
|
# Local config
|
|
|
|
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
|