Skip to content

Instantly share code, notes, and snippets.

@Autoplectic
Created May 11, 2017 22:31
Show Gist options
  • Save Autoplectic/cca256e7dcf7b64cad59d20d19294e51 to your computer and use it in GitHub Desktop.
Save Autoplectic/cca256e7dcf7b64cad59d20d19294e51 to your computer and use it in GitHub Desktop.
# color shortcuts
RED="%{$fg[red]%}"
YELLOW="%{$fg[yellow]%}"
GREEN="%{$fg[green]%}"
WHITE="%{$fg[white]%}"
BLUE="%{$fg[blue]%}"
CYAN="%{$fg[cyan]%}"
RED_BOLD="%{$fg_bold[red]%}"
YELLOW_BOLD="%{$fg_bold[yellow]%}"
GREEN_BOLD="%{$fg_bold[green]%}"
WHITE_BOLD="%{$fg_bold[white]%}"
BLUE_BOLD="%{$fg_bold[blue]%}"
CYAN_BOLD="%{$fg_bold[cyan]%}"
RESET="%{${reset_color}%}"
# some local variables
PROMPT_PATH_MAX_LENGTH=30
# needed loads and such
setopt promptsubst
autoload -U colors && colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
# vcs_info parameters
zstyle ':vcs_info:*' enable bzr git hg svn
zstyle ':vcs_info:*:*' get-revision true
zstyle ':vcs_info:*:*' check-for-changes true
zstyle ':vcs_info:*:*' stagedstr "${GREEN}●${RESET}"
zstyle ':vcs_info:*:*' unstagedstr "${RED}●${RESET}"
zstyle ':vcs_info:*:*' branchformat "%b"
zstyle ':vcs_info:*' formats "●%S" "%u%c${GREEN}[${BLUE_BOLD}%r${RESET}:${CYAN_BOLD}%b${RESET}${GREEN}]${RESET}(${WHITE_BOLD}%s${RESET})"
zstyle ':vcs_info:*' actionformats "●%S" "%u%c${GREEN}[${BLUE_BOLD}%r${RESET}:${CYAN_BOLD}%b${RESET}|${RED_BOLD}%a${RESET}${GREEN}]${RESET}(%s)"
zstyle ':vcs_info:*:*' nvcsformats "%~" ""
# prompt definitions
local truncated_path="${CYAN}[%$PROMPT_PATH_MAX_LENGTH<...<"'${vcs_info_msg_0_%%.}'"%<<]${RESET}"
local return_status="%(?.${GREEN_BOLD}.${RED_BOLD})%#${RESET}"
local date_time="${BLUE}${RESET}"
PROMPT="${truncated_path}${return_status} "
RPROMPT=' ${vcs_info_msg_1_}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment