Synchronize rc, theme, and ps1 files with main file

This commit is contained in:
Panayiotis Kkolos 2014-03-08 07:28:02 +02:00 committed by Olivier Mengué
parent cbba559340
commit b4939868ce
3 changed files with 50 additions and 39 deletions

View File

@ -11,13 +11,18 @@
# LP_HOST hostname
# LP_PERM a colon ":"
# LP_PWD current working directory
# LP_VENV Python virtual environment
# LP_PROXY HTTP proxy
# LP_VCS the content of the current repository
# LP_ERR last error code
# LP_MARK prompt mark
# LP_TIME current time
# LP_RUNTIME runtime of last command
# LP_MARK_PREFIX user-defined prompt mark prefix (helpful if you want 2-line prompts)
# LP_PS1_PREFIX user-defined general-purpose prefix (default set a generic prompt as the window title)
# LP_PS1_POSTFIX user-defined general-purpose postfix
# LP_BRACKET_OPEN open bracket
# LP_BRACKET_CLOSE close bracket
# Remember that most features come with their corresponding colors,
# see the README.
@ -25,29 +30,23 @@
# add time, jobs, load and battery
LP_PS1="${LP_PS1_PREFIX}${LP_TIME}${LP_BATT}${LP_LOAD}${LP_JOBS}"
# add user, host and permissions colon
LP_PS1="${LP_PS1}[${LP_USER}${LP_HOST}${LP_PERM}"
LP_PS1="${LP_PS1}${LP_BRACKET_OPEN}${LP_USER}${LP_HOST}${LP_PERM}"
# if not root
if [[ "$EUID" -ne "0" ]]
then
# path in foreground color
LP_PS1="${LP_PS1}${LP_PWD}]${LP_VENV}${LP_PROXY}"
# add VCS infos
LP_PS1="${LP_PS1}${LP_PWD}${LP_BRACKET_CLOSE}${LP_VENV}${LP_PROXY}"
# Add VCS infos
# If root, the info has not been collected unless LP_ENABLE_VCS_ROOT
# is set.
LP_PS1="${LP_PS1}${LP_VCS}"
else
# path in yellow
LP_PS1="${LP_PS1}${LP_PWD}]${LP_VENV}${LP_PROXY}"
# do not add VCS infos unless told otherwise (LP_ENABLE_VCS_ROOT)
[[ "$LP_ENABLE_VCS_ROOT" = "1" ]] && LP_PS1="${LP_PS1}${LP_VCS}"
fi
# add return code and prompt mark
LP_PS1="${LP_PS1}${LP_RUNTIME}${LP_ERR}${LP_MARK}"
LP_PS1="${LP_PS1}${LP_RUNTIME}${LP_ERR}${LP_MARK_PREFIX}${LP_MARK}${LP_PS1_POSTFIX}"
# "invisible" parts
# Get the current prompt on the fly and make it a title
LP_TITLE=$(_lp_title $PS1)
LP_TITLE="$(_lp_title "$LP_PS1")"
# Insert it in the prompt
PS1="${LP_TITLE}${PS1}"
LP_PS1="${LP_TITLE}${LP_PS1}"
# vim: set et sts=4 sw=4 tw=120 ft=sh:

View File

@ -19,6 +19,7 @@ if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]
LP_MARK_SVN="‡" # prompt mark in svn repositories
LP_MARK_GIT="±" # prompt mark in git repositories
LP_MARK_FOSSIL="⌘" # prompt mark in fossil repositories
LP_MARK_DISABLED="⌀" # prompt mark in directory with disabled VCS info
LP_MARK_UNTRACKED="*" # if git has untracked files
LP_MARK_STASH="+" # if git has stashs
LP_MARK_SHORTEN_PATH=" … " # prompt mark in shortened paths
@ -33,19 +34,25 @@ else
LP_MARK_SVN="="
LP_MARK_GIT="+"
LP_MARK_FOSSIL="f"
LP_MARK_DISABLED="!"
LP_MARK_UNTRACKED="*"
LP_MARK_STASH="+"
LP_MARK_SHORTEN_PATH=" ... "
fi
# Do not prefix the prompt
LP_MARK_BRACKET_OPEN="[" # open bracket
LP_MARK_BRACKET_CLOSE="]" # close bracket
#LP_MARK_DEFAULT="" # default prompt mark
LP_MARK_PREFIX="" # prompt mark prefix
LP_PS1_PREFIX=""
LP_PS1_POSTFIX=""
# Colors
# Available colors are:
# BOLD, BLACK, BOLD_GRAY, WHITE, BOLD_WHITE,
# GREEN, BOLD_GREEN, YELLOW, BOLD_YELLOW, BLUE, BOLD_BLUE, PINK, CYAN, BOLD_CYAN
# RED, BOLD_RED, WARN_RED, CRIT_RED, DANGER_RED,
# GREEN, BOLD_GREEN, YELLOW, BOLD_YELLOW, BLUE,
# BOLD_BLUE, PURPLE, PINK, CYAN, BOLD_CYAN
# Set to a null string "" if you do not want color.
# Current working directory
@ -75,11 +82,12 @@ LP_COLOR_USER_ROOT="$BOLD_YELLOW" # root
# Hostname
LP_COLOR_HOST="" # local host
LP_COLOR_SSH="$BLUE" # connected via SSH
LP_COLOR_SU="$BOLD_YELLOW" # connected remotely but in new environment through su/sudo
LP_COLOR_TELNET="$WARN_RED" # connected via telnet
LP_COLOR_X11_ON="$GREEN" # connected with X11 support
LP_COLOR_X11_OFF="$YELLOW" # connected without X11 support
# Separation mark (aka permiison in the working dir)
# Separation mark (aka permission in the working dir)
LP_COLOR_WRITE="$GREEN" # have write permission
LP_COLOR_NOWRITE="$RED" # do not have write permission
@ -98,7 +106,10 @@ LP_COLOR_DISCHARGING_UNDER="$RED" # discharging and under threshold
# Time
LP_COLOR_TIME="$BLUE"
# Virtualenv
# Brackets inside screen/tmux
LP_COLOR_IN_MULTIPLEXER="$BOLD_BLUE"
# Virtual environment
LP_COLOR_VIRTUALENV="$CYAN"
# Runtime

View File

@ -333,6 +333,7 @@ _lp_source_config()
LP_COLOR_TIME=${LP_COLOR_TIME:-$BLUE}
LP_COLOR_IN_MULTIPLEXER=${LP_COLOR_IN_MULTIPLEXER:-$BOLD_BLUE}
LP_COLOR_RUNTIME=${LP_COLOR_RUNTIME:-$YELLOW}
LP_COLOR_VIRTUALENV=${LP_COLOR_VIRTUALENV:-$CYAN}
LP_COLORMAP_0=${LP_COLORMAP_0:-""}
LP_COLORMAP_1=${LP_COLORMAP_1:-$GREEN}