prezto/runcoms/zshrc

142 lines
4.1 KiB
Bash
Raw Normal View History

2015-06-26 13:06:30 -06:00
# Sourced for interactive shells
# Set up aliases, functions, options, key bindings, etc.
# Do not produce output
2012-01-31 23:37:51 -05:00
#
2015-08-04 16:17:53 -06:00
# +--------------------+-------+-------+--------+
# | | Inter | Inter | Script |
# | | Login | | |
# +====================+=======+=======+========+
# | /etc/zshenv | A | A | A |
# +--------------------+-------+-------+--------+
# | $ZDOTDIR/.zshenv | B | B | B |
# +--------------------+-------+-------+--------+
# | /etc/zprofile | C | | |
# +--------------------+-------+-------+--------+
# | $ZDOTDIR/.zprofile | D | | |
# +--------------------+-------+-------+--------+
# | /etc/zshrc | E | C | |
# +--------------------+-------+-------+--------+
# | $ZDOTDIR/.zshrc | F | D | |
# +--------------------+-------+-------+--------+
# | /etc/zlogin | G | | |
# +--------------------+-------+-------+--------+
# | $ZDOTDIR/.zlogin | H | | |
# +--------------------+-------+-------+--------+
2012-01-31 23:37:51 -05:00
#
2015-06-26 13:06:30 -06:00
# http://zsh.sourceforge.net
2012-01-31 23:37:51 -05:00
# Source Prezto.
2012-09-03 16:13:53 -04:00
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
2015-06-26 13:06:30 -06:00
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
else
# Setup Prompt
declare PS1='%(!,%S%F{red},%F{green})%m:%!(%L)%#%(!,%s%f,%f) '
#declare PS1="\[\033[1;30m\][\[\033[1;34m\]\$(date +%H:%M) \u\[\033[1;30m\]@\[\033[0;35m\]\h\[\033[1;30m\]] \[\033[0;37m\]\W \[\033[1;30m\]\$\[\033[0m\] "
#PS1=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
#%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B]%{\e[0m%}%b '
declare RPS1='%DT%*'
fi
2015-07-07 11:46:36 -06:00
setopt histsubstpattern
setopt vi
2015-06-26 13:06:30 -06:00
2015-08-27 08:57:47 -06:00
# Browser
case `/usr/bin/uname -s` in
Darwin)
export BROWSER='open'
;;
esac
# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X and -F (exit if the content fits on one screen) to enable it.
export LESS='-F -g -i -M -R -S -w -X -z-4'
# Set the Less input preprocessor.
# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system.
if (( $#commands[(i)lesspipe(|.sh)] )); then
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi
2015-06-26 13:06:30 -06:00
# General Settings
declare -x CALENDAR_DIR="/usr/share/calendar"
declare HISTFILESIZE='50'
declare HISTSIZE='50'
2015-08-27 08:57:47 -06:00
2015-06-26 13:06:30 -06:00
#aliases
alias c="clear; clear; dirs"
alias ls="ls -FGh"
alias su="su -m"
alias ping="ping -c 4"
alias sed="sed -E"
2015-07-07 11:46:36 -06:00
alias grep="grep -anHE --color --exclude-dir=\.git --exclude-dir=\.hg --exclude-dir=\.svn --exclude-dir=build --exclude-dir=dist --exclude=tags"
2015-06-26 13:06:30 -06:00
if [ "$ZSH_VERSION" ]; then
autoload -U compinit
compinit
# cd hook
autoload -U add-zsh-hook
2015-07-07 11:46:36 -06:00
title-bar() {
[[ -t 1 ]] || return
case $TERM in
sun-cmd)
print -Pn "\e]l%~\e\\"
;;
*xterm*|rxvt|(dt|k|E)term)
print -Pn "\e]1;%~\a"
;;
esac
}
add-zsh-hook precmd title-bar
2015-06-26 13:06:30 -06:00
load-local-conf() {
# check file exists, is regular file and is readable:
if [[ -f .sh_source && -r .sh_source ]]; then
2015-07-07 11:46:36 -06:00
source .sh_source
fi
2015-06-26 13:06:30 -06:00
}
add-zsh-hook chpwd load-local-conf
2012-09-03 16:13:53 -04:00
fi
2015-06-26 13:06:30 -06:00
# Setup by operating system type
case `/usr/bin/uname -s` in
Darwin)
alias psql_start="sudo -u _postgres /opt/local/bin/pg_ctl -D /opt/local/var/db/pgsql/data start"
alias psql_stop="sudo -u _postgres /opt/local/bin/pg_ctl -D /opt/local/var/db/pgsql/data stop"
;;
linux*)
;;
esac
# Setup by processor type
case `/usr/bin/uname -m` in
powerpc)
;;
i386)
;;
esac
# Setup by host name
case `/usr/bin/uname -n` in
helsten)
;;
pfiefferhorn)
;;
esac
# Setup by subsystem
for f in `find $HOME/Library/Scripts/config -name '*.shrc'`; do
source "$f"
done