Skip to content

Instantly share code, notes, and snippets.

@wellle
Created December 9, 2013 17:21
Show Gist options
  • Save wellle/7876260 to your computer and use it in GitHub Desktop.
Save wellle/7876260 to your computer and use it in GitHub Desktop.
# https://wiki.gentoo.org/wiki/Zsh/HOWTO
# TODO: split in separate files like https://github.com/ivyl/zsh-config
autoload -U compinit
compinit
export CORRECT_IGNORE='_*'
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
source $HOME/.zsh/opp.zsh/opp.zsh
source /Users/welle/.zsh/opp.zsh/opp/surround.zsh
source /Users/welle/.zsh/opp.zsh/opp/textobj-between.zsh
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
zstyle ':completion:*:default' list-prompt '%S%M matches%s' # formatting?
zstyle ':completion:*:default' select-prompt '%S%M matches%s' # do we want a select-prompt?
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' format ' %F{yellow}-- %d --%f'
zstyle ':completion:*' list-colors "${LS_COLORS}"
zstyle ':completion:*' menu select
zstyle ':completion:*' use-cache true
zstyle ':vcs_info:*' formats '%F{blue}%s%f:%F{yellow}%b%f '
zstyle ':vcs_info:*' actionformats '%F{blue}%s%f:%F{yellow}%b%f:%F{cyan}%a%f '
zstyle ':vcs_info:*' enable git hg
setopt prompt_subst
autoload -Uz vcs_info
precmd() { vcs_info }
PROMPT=$'%F{cyan}%1~ %f${vcs_info_msg_0_}%F{green}❱%f '
PROMPT2='%F{yellow}%_ %f%F{green}❭%f '
export HISTSIZE=2000
export HISTFILE=$HOME/.zsh/.history
export SAVEHIST=$HISTSIZE
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt extended_history
setopt autopushd # use `cd -<tab>` to select recent dir
setopt autocd
# http://zsh.sourceforge.net/FAQ/zshfaq03.html
# allow binding of ^s and ^q (was stop/resume output)
setopt no_flow_control
# https://github.com/ivyl/zsh-config/blob/master/bindings.zsh
bindkey -v
export EDITOR=vim
export KEYTIMEOUT=1
export WORDCHARS='*?_-.[]~&;!#$%^(){}<>'
export MANPAGER="col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -"
bindkey -M vicmd 'u' undo
bindkey -M vicmd '^r' redo
bindkey -M viins '^p' up-history
bindkey -M viins '^n' down-history
bindkey -M viins '^h' backward-delete-char
bindkey -M viins '^?' backward-delete-char # backspace
bindkey -M viins '^w' backward-delete-word
bindkey -M viins '^u' backward-kill-line
bindkey -M viins '^a' beginning-of-line
bindkey -M viins '^e' end-of-line
bindkey -M viins '^k' kill-line
bindkey -M viins '^r' history-substring-search-up
bindkey -M viins '^s' history-substring-search-down
bindkey -M viins '^[[Z' reverse-menu-complete # shift-tab
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^f' edit-command-line
export GOROOT=/usr/local/go
export GOPATH=$HOME/Code/go
export PATH=$HOME/.rvm/bin:$PATH
source $GOROOT/misc/zsh/go
# aliases
alias ls="ls -FG"
alias -g v=vim
alias -s go=vim
alias tmuxconfig='vim ~/.tmux.conf'
alias vimconfig='vim ~/.vimrc'
alias zshconfig='vim ~/.zshrc'
alias zshsource='source ~/.zshrc && echo sourced'
alias backend=$GOPATH/src/github.com/adeven/adjust_backend
alias sessionate=$GOPATH/src/github.com/adeven/sessionate
export POSTGRESLOG=/usr/local/var/postgres/server.log
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
# https://github.com/cdlm/infrastructure/blob/master/dotfiles/zsh/rc/zz.highlighting.zsh
if [[ $COLORFGBG = *';15' ]]; then
# solarized light
ZSH_HIGHLIGHT_STYLES[default]='fg=green,bold' #base01
ZSH_HIGHLIGHT_STYLES[alias]='fg=black'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[function]='fg=black'
ZSH_HIGHLIGHT_STYLES[command]='fg=black'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=black'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=cyan,bold' #base1
ZSH_HIGHLIGHT_STYLES[path]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=yellow,bold' #base00
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=yellow,bold' #base00
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=red,bold' #orange
else
# solarized dark
ZSH_HIGHLIGHT_STYLES[default]='fg=cyan,bold' #base1
ZSH_HIGHLIGHT_STYLES[alias]='fg=white'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[function]='fg=white'
ZSH_HIGHLIGHT_STYLES[command]='fg=white'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=white'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=green,bold' #base01
ZSH_HIGHLIGHT_STYLES[path]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue,bold' #base0
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue,bold' #base0
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=red,bold' #orange
fi
# http://chneukirchen.org/blog/archive/2012/02/10-new-zsh-tricks-you-may-not-know.html
# improved version that uses vim instead of less
zman() {
MANPAGER="col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' +/'^ $1' -" man zshall
}
# TODO: try https://github.com/tarruda/zsh-autosuggestions
# TODO: use incremental pattern search?
# http://chneukirchen.org/blog/archive/2012/02/10-new-zsh-tricks-you-may-not-know.html
# bindkey "^R" history-incremental-pattern-search-backward
# bindkey "^S" history-incremental-pattern-search-forward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment