From 947781bac939ef13ee8f1ad6ae2bca61151ff2cb Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 4 Jan 2013 14:08:26 +0100 Subject: [PATCH] Default prefix put a classical prompt as title Update the doc and themes accordingly --- README.md | 2 +- liquid.ps1 | 13 ++++++++----- liquid.theme | 3 +++ liquidprompt | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c97c75d..5e4481c 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ You can prefix the `LP_PS1` variable with anything you want using the `LP_PS1_PREFIX`. The following example activate title change on xterm-like windows: - export LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]" + LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]" ### PUT THE PROMPT IN A DIFFERENT ORDER diff --git a/liquid.ps1 b/liquid.ps1 index c10765b..5b7c478 100644 --- a/liquid.ps1 +++ b/liquid.ps1 @@ -18,12 +18,13 @@ # LP_ERR last error code # LP_MARK prompt mark # LP_TIME current time +# LP_PS1_PREFIX user-defined general-purpose prefix # Remember that most features come with their corresponding colors, # see the README. -# add jobs, load and battery -LP_PS1="${LP_TIME}${LP_BATT}${LP_LOAD}${LP_JOBS}" +# 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}" @@ -31,13 +32,15 @@ LP_PS1="${LP_PS1}[${LP_USER}${LP_HOST}${LP_PERM}" if [[ "$EUID" -ne "0" ]] then # path in foreground color - LP_PS1="${LP_PS1}${LP_PWD}]${LP_PROXY}" + LP_PS1="${LP_PS1}${LP_PWD}]${LP_VENV}${LP_PROXY}" # add VCS infos LP_PS1="${LP_PS1}${LP_GIT}${LP_HG}${LP_SVN}" else # path in yellow - LP_PS1="${LP_PS1}${LP_PWD}]${LP_PROXY}" - # do not add VCS infos + 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_GIT}${LP_HG}${LP_SVN}" fi # add return code and prompt mark LP_PS1="${LP_PS1}${LP_ERR}${LP_MARK}" diff --git a/liquid.theme b/liquid.theme index a2dd601..205ecef 100644 --- a/liquid.theme +++ b/liquid.theme @@ -30,6 +30,9 @@ else LP_MARK_UNTRACKED="*" fi +# Use the prefix to change the title of the terminal window +LP_PS1_PREFIX="\[\e]0;\u@\h: \w\a\]" + # Colors # Available colors are: # BOLD, BLACK, BOLD_GRAY, WHITE, BOLD_WHITE, diff --git a/liquidprompt b/liquidprompt index afe18e1..e5a1c2e 100755 --- a/liquidprompt +++ b/liquidprompt @@ -189,7 +189,7 @@ _lp_source_config() LP_PATH_KEEP=${LP_PATH_KEEP:-2} LP_HOSTNAME_ALWAYS=${LP_HOSTNAME_ALWAYS:-0} LP_PS1=${LP_PS1:-""} - LP_PS1_PREFIX=${LP_PS1_PREFIX:-""} + LP_PS1_PREFIX=${LP_PS1_PREFIX:-"\[\e]0;\u@\h: \w\a\]"} LP_ENABLE_PERM=${LP_ENABLE_PERM:-1} LP_ENABLE_SHORTEN_PATH=${LP_ENABLE_SHORTEN_PATH:-1}