Skip to content

Instantly share code, notes, and snippets.

@runarorama
Created January 19, 2012 18:28
Show Gist options
  • Save runarorama/1641718 to your computer and use it in GitHub Desktop.
Save runarorama/1641718 to your computer and use it in GitHub Desktop.
My .zshrc file
# ALIASES
# ls
alias ls='ls --color=auto'
alias ll='ls --color=auto -lh'
alias lll='ls --color=auto -lh | less'
# grep
export GREP_COLOR=31
alias grep='grep --color=auto'
# ps
alias pl='ps aux | less'
# vi
alias vi='vim'
# ENVIRONMENT VARIABLES
# Path
export PATH=$PATH:~/.scripts:/var/lib/gems/1.8/bin
# Editor
export EDITOR=/usr/bin/vim
# ZSH CONFIGURATION
# Vi Editor from command line
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# History
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# Key binding
bindkey -v
bindkey '^R' history-incremental-search-backward
# Completion initialization
zstyle :compinstall filename '~/.zshrc'
autoload -Uz compinit
compinit
# Completion cache
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh_cache
# Completion colours
zmodload zsh/complist
setopt extendedglob
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
# Local configuration
source ~/.zshrc_local
##########
# PROMPT #
##########
autoload colors
colors
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}• '
zstyle ':vcs_info:*' unstagedstr '%F{yellow}• '
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' enable git svn hg
zstyle ':vcs_info:hg*:*' check-for-changes true
zstyle ':vcs_info:hg*' actionformats "(%s|%a)[%i%u %b %m]"
precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%c%u %F{cyan}%b'
} else {
zstyle ':vcs_info:*' formats '%F{red}• %c%u %F{cyan}%b'
}
vcs_info
}
function hg_prompt_info {
hg prompt --angle-brackets "\
< at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
%{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}<
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
}
function prompt_precmd() {
vcs_info
}
function prompt_set() {
RPS1="$(hg_prompt_info) ${vcs_info_msg_0_} %{$fg[magenta]%}%*%{$reset_color%}"
}
autoload -U add-zsh-hook
add-zsh-hook precmd prompt_precmd
add-zsh-hook precmd prompt_set
export PS1="${vcs_info_msg_0_}%{$fg[green]%}%n@%m %{$fg[yellow]%}%~ %{$fg[red]%}%Bλ%b%{$fg[default]%} %{$reset_color%}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment