zsh/.zshrc

79 lines
2.1 KiB
Bash
Raw Normal View History

# Antigen Stuff
ADOTDIR="$HOME/.antigen"
[ ! -e "$ADOTDIR" ] && git clone https://github.com/zsh-users/antigen.git "$ADOTDIR"
source "$ADOTDIR/antigen.zsh"
# Temporary, hopefully remove later when antigen correctly fails to shallow clone from http
[ ! -e "$ADOTDIR/bundles/zsh/fred-prompt" ] && git clone https://adamgoldsmith.name/cgit/zsh/fred-prompt.git/ $ADOTDIR/bundles/zsh/fred-prompt
antigen bundles <<EOBUNDLES
https://adamgoldsmith.name/cgit/zsh/fred-prompt.git prompt_fred_setup
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-history-substring-search
Eriner/zim modules/directory
Eriner/zim modules/git
Eriner/zim modules/history
Eriner/zim modules/input
Eriner/zim modules/utility
Eriner/zim modules/completion
EOBUNDLES
antigen apply
# Source aliases
source $HOME/.aliases/general
# Various Options
setopt EXTENDED_GLOB
unsetopt NOMATCH
setopt CORRECT
CORRECT_IGNORE="_*"
zhighlighters=(main brackets)
stty -ixon #disable XON/XOFF, which breaks C-s
setopt inc_append_history
# rehashes on bin change, might cause performance issues
zstyle ':completion:*' rehash true
#load fasd if it exists
hash fasd 2>/dev/null && eval "$(fasd --init auto)"
2016-02-15 11:20:39 -05:00
# Load run-help
unalias run-help
autoload run-help
# Auto start tmux if a remote connection
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -n "$SSH_TTY" ]]
then
# Attach only to the 'auto' session
exec tmux new-session -A -s 'auto'
fi
2016-12-02 12:50:17 -05:00
# History Substring Search bindings (PageUp and PageDown)
2016-12-02 12:50:17 -05:00
bindkey '^[[5~' history-substring-search-up
bindkey '^[[6~' history-substring-search-down
# Expands ... to ../..
function expand-dot-to-parent-directory-path {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+='/..'
else
LBUFFER+='.'
fi
2016-12-02 12:50:17 -05:00
}
zle -N expand-dot-to-parent-directory-path
bindkey -M emacs "." expand-dot-to-parent-directory-path
2016-12-02 12:50:17 -05:00
# Inserts 'sudo ' at the beginning of the line.
function prepend-sudo() {
if [[ "$BUFFER" != su(do|)\ * ]]; then
BUFFER="sudo $BUFFER"
(( CURSOR += 5 ))
fi
}
zle -N prepend-sudo
bindkey "^X^S" prepend-sudo
# Control-Backspace and Control-Delete
2016-12-02 12:50:17 -05:00
bindkey '^H' backward-kill-word
bindkey '5~' kill-word