From b4939868ce651c12d0b7da889b467560f9f245cb Mon Sep 17 00:00:00 2001 From: Panayiotis Kkolos Date: Sat, 8 Mar 2014 07:28:02 +0200 Subject: [PATCH] Synchronize rc, theme, and ps1 files with main file --- liquid.ps1 | 33 +++++++++++++++---------------- liquid.theme | 55 +++++++++++++++++++++++++++++++--------------------- liquidprompt | 1 + 3 files changed, 50 insertions(+), 39 deletions(-) diff --git a/liquid.ps1 b/liquid.ps1 index babf71a..ca6fde4 100644 --- a/liquid.ps1 +++ b/liquid.ps1 @@ -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}" + +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}" -# 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_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: diff --git a/liquid.theme b/liquid.theme index 6ff980f..17395d4 100644 --- a/liquid.theme +++ b/liquid.theme @@ -8,20 +8,21 @@ # characters at once. # Below is an example of how to fallback to ascii if the term is not unicode capable. # Defaults to UTF-8 characters. -if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]] ; then +if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]]; then # If charset is UTF-8. - LP_MARK_BATTERY="⌁" # in front of the battery charge - LP_MARK_ADAPTER="⏚" # displayed when plugged - LP_MARK_LOAD="⌂" # in front of the load - LP_MARK_TEMP="θ" # in front of the temp - LP_MARK_PROXY="↥" # indicate a proxy in use - LP_MARK_HG="☿" # prompt mark in hg repositories - LP_MARK_SVN="‡" # prompt mark in svn repositories - LP_MARK_GIT="±" # prompt mark in git repositories + LP_MARK_BATTERY="⌁" # in front of the battery charge + LP_MARK_ADAPTER="⏚" # displayed when plugged + LP_MARK_LOAD="⌂" # in front of the load + LP_MARK_TEMP="θ" # in front of the temp + LP_MARK_PROXY="↥" # indicate a proxy in use + LP_MARK_HG="☿" # prompt mark in hg repositories + 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_UNTRACKED="*" # if git has untracked files - LP_MARK_STASH="+" # if git has stashs - LP_MARK_SHORTEN_PATH="…" # prompt mark in shortened paths + 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 else # If charset is anything else, fallback to ASCII chars LP_MARK_BATTERY="b" @@ -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="..." + 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 @@ -73,13 +80,14 @@ LP_COLOR_USER_ALT="$BOLD" # user but not the one who logged in LP_COLOR_USER_ROOT="$BOLD_YELLOW" # root # Hostname -LP_COLOR_HOST="" # local host -LP_COLOR_SSH="$BLUE" # connected via SSH -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 +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 diff --git a/liquidprompt b/liquidprompt index 7fdccc6..af07a41 100755 --- a/liquidprompt +++ b/liquidprompt @@ -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}