Created
January 15, 2013 03:49
-
-
Save larzconwell/4535894 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Display prompt | |
#PS1='%~:%# ' | |
setopt prompt_subst | |
autoload colors | |
autoload -Uz vcs_info | |
colors | |
# Set colors for easier reading | |
for COLOR in RED GREEN YELLOW BLUE WHITE BLACK CYAN; do | |
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' | |
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' | |
done | |
PR_RESET="%{${PR_WHITE}%}" | |
PR_BRIGHT_RESET="%{${PR_BRIGHT_WHITE}%}" | |
# Set formats | |
# %b - branchname | |
# %u - unstagedstr (see below) | |
# %c - stangedstr (see below) | |
# %a - action (e.g. rebase-i) | |
# %R - repository path | |
# %S - path in the repository | |
FMT_BRANCH="${PR_RESET}${PR_CYAN}[%b%u%c]${PR_RESET}" # e.g. [master¹²] | |
FMT_ACTION="${PR_RESET}${PR_GREEN}(%a)${PR_RESET}" # e.g. (rebase-i) | |
FMT_PATH="%R/%S" # e.g. ~/repo/subdir | |
# check-for-changes can be really slow. | |
# you should disable it, if you work with large repositories | |
# zstyle ':vcs_info:*:prompt:*' check-for-changes true | |
# zstyle ':vcs_info:*:prompt:*' unstagedstr "¹" # display ¹ if there are unstaged changes | |
# zstyle ':vcs_info:*:prompt:*' stagedstr "²" # display ² if there are staged changes | |
# | |
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" "${FMT_PATH}" | |
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" "${FMT_PATH}" | |
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~" | |
precmd() { vcs_info 'prompt' } | |
lprompt() { | |
local git='$vcs_info_msg_0_' | |
local cwd="%1~" # Removing the 1 from %1~ will show full path | |
#PROMPT="${PR_BRIGHT_RESET}${cwd}${git}${PR_BRIGHT_RESET}%# ${PR_RESET}" | |
PROMPT="%#:${cwd}${git} ⵗ " | |
} | |
rprompt() { | |
local cwd="%w %T" # Adding 1 to %~ will show short path | |
# RPROMPT="${PR_RESET}(${cwd})${PR_RESET}" | |
RPROMPT="(${cwd})" | |
} | |
lprompt | |
rprompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment