This commit is contained in:
Sindre Sorhus
2012-09-20 20:16:36 +02:00
commit 62852d7fd1
3 changed files with 53 additions and 0 deletions

24
prompt.zsh Normal file
View File

@@ -0,0 +1,24 @@
# Pure
# by Sindre Sorhus
# https://github.com/sindresorhus/pure/
# MIT License
local default_username='sindresorhus'
# Only show username if not default
username() {
if [ $USER != $default_username ]; then echo '%n@%m '; fi
}
git_branch() {
echo `git symbolic-ref --short -q HEAD 2>/dev/null`
}
precmd() {
print -P '\n%F{blue}%~%f %F{236}`git_branch` `username`%*%f'
}
# Turns the prompt red if the last command exited with 0
PROMPT='%(?.%F{magenta}.%F{red})%f '
# Can be disabled:
# PROMPT='%F{magenta}%f '