diff --git a/README.md b/README.md index 8cd1e47..f401256 100644 --- a/README.md +++ b/README.md @@ -131,13 +131,6 @@ Available features: * `LP_ERR` last error code * `LP_MARK` prompt mark -Some indicators are not colored by default (mainly those that are _static_), to -put colors on theme you should not forget to add themed colors variable around -them: - - LP_PS1="${LP_ERR}" # no color - LP_PS1="${LP_COLOR_ERR}${LP_ERR}${NO_COL}" # colored - For example, if you just want to have a liquidprompt displaying the user and the host, with a normal full path in blue and only the git support: @@ -205,8 +198,6 @@ Set to a null string "" if you do not want color. Liquid prompt is distributed under the GNU Affero General Public License version 3. -* Cannot easily change the colors of features having different state colors -(like the colormap of the load or the colors of the branch name). * detached sessions only looks for `screen`, a `tmux` support would be nice… * Does not display the number of commits to be pushed in Mercurial repositories. * Browsing into very large subversion repositories may dramatically slow down diff --git a/liquid.ps1 b/liquid.ps1 index 0950ba5..04672e9 100644 --- a/liquid.ps1 +++ b/liquid.ps1 @@ -18,6 +18,9 @@ # LP_ERR last error code # LP_MARK prompt mark +# Remember that most features come with their corresponding colors, +# see the README. + # add jobs, load and battery LP_PS1="${LP_BATT}${LP_LOAD}${LP_JOBS}" # add user, host and permissions colon @@ -27,15 +30,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_COLOR_PATH}${LP_PWD}${NO_COL}]${LP_COLOR_PROXY}${LP_PROXY}${NO_COL}" + LP_PS1="${LP_PS1}${LP_PWD}]${LP_PROXY}" # add VCS infos LP_PS1="${LP_PS1}${LP_GIT}${LP_HG}${LP_SVN}" else # path in yellow - LP_PS1="${LP_PS1}${LP_COLOR_PATH_ROOT}${LP_PWD}${NO_COL}]${LP_COLOR_PROXY}${LP_PROXY}${NO_COL}" + LP_PS1="${LP_PS1}${LP_PWD}]${LP_PROXY}" # do not add VCS infos fi # add return code and prompt mark -LP_PS1="${LP_PS1}${LP_COLOR_ERR}${LP_ERR}${NO_COL}${LP_MARK}" +LP_PS1="${LP_PS1}${LP_ERR}${LP_MARK}" # vim: set et sts=4 sw=4 tw=120 ft=sh: diff --git a/liquidprompt b/liquidprompt index e01da34..a96037a 100755 --- a/liquidprompt +++ b/liquidprompt @@ -195,6 +195,7 @@ LP_PROXY_MARK=${LP_PROXY_MARK:-"↥"} LP_GIT_MARK=${LP_GIT_MARK:-"±"} LP_MERCURIAL_MARK=${LP_MERCURIAL_MARK:-"☿"} LP_SUBVERSION_MARK=${LP_SUBVERSION_MARK:-"‡"} + LP_ENABLE_GIT=${LP_ENABLE_GIT:-1} LP_ENABLE_SVN=${LP_ENABLE_SVN:-1} LP_ENABLE_HG=${LP_ENABLE_HG:-1} @@ -909,7 +910,7 @@ _lp_sb() _lp_set_bash_prompt() { # as this get the last returned code, it should be called first - LP_ERR=$(_lp_sl "$(_lp_return_value $?)") + LP_ERR="${LP_COLOR_ERR}$(_lp_sl $(_lp_return_value $?))${NO_COL}" # execute the old prompt $LP_OLD_PROMPT_COMMAND @@ -924,7 +925,7 @@ _lp_set_bash_prompt() # LP_HOST is a global set at load time LP_PERM=$(_lp_permissions_color) LP_PWD=$(_lp_shorten_path "$PWD" $LP_PATH_LENGTH) - LP_PROXY=$(_lp_proxy) + LP_PROXY="${LP_COLOR_PROXY}$(_lp_proxy)${NO_COL}" # right of main prompt: space at left LP_GIT=$(_lp_sl "$(_lp_git_branch_color)") @@ -934,6 +935,13 @@ _lp_set_bash_prompt() # end of the prompt line: double spaces LP_MARK=$(_lp_sb "$(_lp_smart_mark)") + # Different path color if root + if [[ "$EUID" -ne "0" ]] ; then + LP_PWD="${LP_COLOR_PATH}${LP_PWD}${NO_COL}" + else + LP_PWD="${LP_COLOR_PATH_ROOT}${LP_PWD}${NO_COL}" + fi + if [[ -z $LP_PS1 ]] ; then # add jobs, load and battery PS1="${LP_BATT}${LP_LOAD}${LP_JOBS}" @@ -944,16 +952,16 @@ _lp_set_bash_prompt() if [[ "$EUID" -ne "0" ]] then # path in foreground color - PS1="${PS1}${LP_COLOR_PATH}${LP_PWD}${NO_COL}]${LP_COLOR_PROXY}${LP_PROXY}${NO_COL}" + PS1="${PS1}${LP_PWD}]${LP_PROXY}" # add VCS infos PS1="${PS1}${LP_GIT}${LP_HG}${LP_SVN}" else # path in yellow - PS1="${PS1}${LP_COLOR_PATH_ROOT}${LP_PWD}${NO_COL}]${LP_COLOR_PROXY}${LP_PROXY}${NO_COL}" + PS1="${PS1}${LP_PWD}]${LP_PROXY}" # do not add VCS infos fi # add return code and prompt mark - PS1="${PS1}${LP_COLOR_ERR}${LP_ERR}${NO_COL}${LP_MARK}" + PS1="${PS1}${LP_ERR}${LP_MARK}" # Glue the bash prompt always go to the first column. # Avoid glitches after interrupting a command with Ctrl-C