Skip to content

Instantly share code, notes, and snippets.

@dgladkov
Created October 27, 2010 15:45
Show Gist options
  • Save dgladkov/649301 to your computer and use it in GitHub Desktop.
Save dgladkov/649301 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# my favorite apps to use
export EDITOR='/opt/local/bin/vim'
export BROWSER='open' # can be replaced by firefox or smt on Linux
# completion
fpath=(~/.zshfuncs $fpath)
autoload -U compinit
compinit
# correction
setopt correctall
# misc improvements
setopt autocd
setopt extendedglob
#history
setopt hist_ignore_space
setopt hist_ignore_all_dups
export HISTSIZE=2000
export HISTFILE="$HOME/.history"
export SAVEHIST=$HISTSIZE
# my prompt
autoload -Uz vcs_info
precmd() {
psvar=()
vcs_info
[[ -n $vcs_info_msg_0_ ]] && psvar[1]="$vcs_info_msg_0_"
}
zstyle ':vcs_info:*' formats ' %b'
PS1="%F{cyan}%n@%m%f %F{yellow}%~%f%(1v.%F{green}%1v%f.) %F{yellow}$%f "
# completion of known hosts
local _myhosts
_myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
zstyle ':completion:*' hosts $_myhosts
# useful keybindings
bindkey "\e[5C" forward-word # ctrl-left
bindkey "\e[5D" backward-word # ctrl-right
bindkey "^A" vi-beginning-of-line
bindkey "^E" vi-end-of-line
bindkey '^R' history-incremental-search-backward
bindkey '^J' accept-line
# show matching groups
zstyle ':completion:*:descriptions' format '%U%d%u'
zstyle ':completion:*:warnings' format 'Sorry, no matches for: %B%d%b'
# extenstions
alias -s html=$BROWSER
# settings for go lang
export GOROOT=$HOME/.go
export GOARCH=amd64
export GOOS=darwin
export GOBIN=$HOME/.go/bin
# virtualenv
export WORKON_HOME=$HOME/.virtualenvs
source virtualenvwrapper.sh
# ls coloring
export LSCOLORS=dxfxcxdxbxegedabagacad
alias ls="ls -G"
# grep coloring
alias grep="grep --color"
# completing process IDs with menu selection
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
# ignore completion functions for commands don't have
zstyle ':completion:*:functions' ignored-patterns '_*'
# completion cache
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zshcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment