Files
pure/prompt.zsh
Sindre Sorhus 62852d7fd1 init
2012-09-20 20:16:36 +02:00

25 lines
523 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 '