Skip to content

Instantly share code, notes, and snippets.

@noah
Created January 29, 2009 23:36
Show Gist options
  • Save noah/54842 to your computer and use it in GitHub Desktop.
Save noah/54842 to your computer and use it in GitHub Desktop.
# zsh crap
#
# include git info in the prompt
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# see: http://www.cims.nyu.edu/cgi-systems/info2html?(zsh)Prompt%2520Expansion
export PS1='%B%(?..[%?] )%{$fg_bold[yellow]%}%(1j.%U[%j]%u .)%{$reset_color%}%{$fg_bold[red]%}$(parse_git_branch)%{$reset_color%}
%% '
# Suffix aliases
alias -s tex=vim
alias -s rb=vim
alias -s pl=vim
alias -s conf=vim
alias -s php=vim
alias -s txt=vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment