Newer
Older
dotfiles / zsh / zshrc.symlink
@Marcus Bengtsson Marcus Bengtsson on 2 Nov 2015 1 KB Added jenv
# .zshrc

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

export DOTFILES=$HOME/.dotfiles
export ZSH=$DOTFILES/zsh

# Source iTerm shell-integration
source ~/.iterm2_shell_integration.`basename $SHELL`

# Source config-files
for config ($ZSH/**/*.zsh) source $config

# Source git-completion and git-prompt
source $DOTFILES/git/git-prompt.sh
source $DOTFILES/git/git-completion.zsh &>/dev/null

# Init autocomplete
autoload -U compinit
compinit

# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000

setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt APPEND_HISTORY
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE

setopt COMPLETE_ALIASES

# color code completion
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"

# Vi mode
bindkey -v
zle -N zle-line-init
zle -N zle-keymap-select

# Ensure that arrow keys work as they should
bindkey '\e[A' up-line-or-history
bindkey '\e[B' down-line-or-history

bindkey '\eOA' up-line-or-history
bindkey '\eOB' down-line-or-history

bindkey '\e[C' forward-char
bindkey '\e[D' backward-char

bindkey '\eOC' forward-char
bindkey '\eOD' backward-char

# Rebind the insert key.
bindkey '\e[2~' overwrite-mode

# Rebind the delete key.
bindkey '\e[3~' delete-char

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

eval "$(jenv init -)"