Comments code

This commit is contained in:
Caio Gondim
2014-07-10 16:21:51 +02:00
parent 97ca2d0533
commit cccdb11bcd

View File

@@ -4,12 +4,14 @@
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# #
# In addition, I recommend the # In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're # [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - # you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# it has significantly better color fidelity. # Terminal.app - it has significantly better color fidelity.
### Configuration # ------------------------------------------------------------------------------
# CONFIGURATION
# The default configuration, that can be overwrite in your .zshrc file # The default configuration, that can be overwrite in your .zshrc file
# ------------------------------------------------------------------------------
VIRTUAL_ENV_DISABLE_PROMPT=true VIRTUAL_ENV_DISABLE_PROMPT=true
@@ -50,8 +52,10 @@ ZSH_THEME_GIT_PROMPT_AHEAD=" ⬆"
ZSH_THEME_GIT_PROMPT_BEHIND=" ⬇" ZSH_THEME_GIT_PROMPT_BEHIND=" ⬇"
ZSH_THEME_GIT_PROMPT_DIVERGED=" ⬍" ZSH_THEME_GIT_PROMPT_DIVERGED=" ⬍"
### Segment drawing # ------------------------------------------------------------------------------
# A few utility functions to make it easy and re-usable to draw segmented prompts # SEGMENT DRAWING
# A few functions to make it easy and re-usable to draw segmented prompts
# ------------------------------------------------------------------------------
CURRENT_BG='NONE' CURRENT_BG='NONE'
SEGMENT_SEPARATOR='' SEGMENT_SEPARATOR=''
@@ -83,8 +87,11 @@ prompt_end() {
CURRENT_BG='' CURRENT_BG=''
} }
### Prompt components # ------------------------------------------------------------------------------
# Each component will draw itself, and hide itself if no information needs to be shown # PROMPT COMPONENTS
# Each component will draw itself, and hide itself if no information needs
# to be shown
# ------------------------------------------------------------------------------
# Context: user@hostname (who am I and where am I) # Context: user@hostname (who am I and where am I)
prompt_context() { prompt_context() {
@@ -95,7 +102,7 @@ prompt_context() {
fi fi
} }
# Git: branch/detached head, dirty status # Git
prompt_git() { prompt_git() {
local ref dirty mode repo_path local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null) repo_path=$(git rev-parse --git-dir 2>/dev/null)
@@ -182,7 +189,11 @@ prompt_status() {
[[ -n "$symbols" ]] && prompt_segment $BULLETTRAIN_STATUS_BG $BULLETTRAIN_STATUS_FG "$symbols" [[ -n "$symbols" ]] && prompt_segment $BULLETTRAIN_STATUS_BG $BULLETTRAIN_STATUS_FG "$symbols"
} }
## Main prompt # ------------------------------------------------------------------------------
# MAIN
# Entry point
# ------------------------------------------------------------------------------
build_prompt() { build_prompt() {
RETVAL=$? RETVAL=$?
prompt_status prompt_status