Files
skel/dotfiles/zshrc
2019-09-26 23:43:31 -07:00

86 lines
2.3 KiB
Bash
Executable File

# For interactive shells
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory autocd autopushd extendedglob nohup nomatch histignorespace histlexwords histverify cbases
unsetopt beep histbeep listbeep flowcontrol
bindkey -v
# Allow core files
ulimit -c unlimited
DIRSTACKSIZE=16
case $TERM in
xterm*)
precmd () {print -Pn "\e]0;%n@%m: %~\a"}
;;
esac
autoload -U colors && colors
PS1="%{$fg[black]%}[%{$fg[yellow]%}%h%{$fg[black]%}] %{%(!.$fg[red].$fg[green])%}%8>..>%n%>>%{$fg[white]%}@%{$fg[blue]%}%12>..>%m%>>%{$fg[white]%}:%{$fg[green]%}%32<...<%~%<<%{$fg[white]%}%#%{$reset_color%} "
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Load prezto
if [[ -z "${NO_ZPREZTO}" && -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# Overrides to prezto
unsetopt cdablevars
# .profile is universal
# but after zprezto to use/override anything setup there
. ~/.profile
# Deduplicate the path
typeset -U path
# Keybindings
bindkey '^[[A' history-search-backward
bindkey '^[[B' history-search-forward
# ctrl-arrow keys
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
# ok, a few convenience bindings
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward
# Source extras and aliases if interactive
if [[ $- == *i* ]] ; then
if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi
# zsh-only-ism to avoid error if glob doesn't expand
for file in $HOME/.zshrc.d/*(N) ; do source "$file" ; done
# extra completions
fpath=(~/.zshrc.completions $fpath)
# Completion
zstyle :compinstall filename "${HOME}/.zshrc"
zstyle ':completion:*' users root ${USER}
autoload -Uz compinit && compinit
fi
# In case ack is named ack-grep
if [ -x /usr/bin/ack-grep ] ; then
alias ack='/usr/bin/ack-grep'
fi
# Setup PATH for tools
PATH=${PATH}:${HOME}/bin/tools
# Most is nice, if we have it
if command -v most >/dev/null 2>&1; then
export PAGER="most"
fi
# Enable grc if we have it
if ls --version 2>&1 >/dev/null ; then
alias ls='ls --color -C'
fi
[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh
# Load any local settings
if [ -e $HOME/.zshrc.local ] ; then source $HOME/.zshrc.local ; fi