Newer
Older
dotfiles / zsh / zshrc.symlink
@Marcus Bengtsson Marcus Bengtsson on 8 Dec 2016 2 KB Use meld as difftool for git
# .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

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

setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE
setopt HIST_VERIFY
setopt EXTENDED_HISTORY

# Globbing
setopt GLOBDOTS
setopt EXTENDEDGLOB


# CD
setopt AUTO_CD
setopt AUTO_PUSHD
setopt CDABLE_VARS

# IO
setopt CORRECT

# Prompting
setopt PROMPT_SUBST

# Scripts and Functions
setopt MULTIOS

# zmv
autoload -U zmv
alias mmv="noglob zmv"

# 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

# Enable reverse search
bindkey '^R' history-incremental-pattern-search-backward

# 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 -)"

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)