From bae9daf7315c7701aee60ce644ecca989c9a8a02 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 10 Oct 2022 22:01:39 +0200 Subject: [PATCH] fixes --- liquidship.theme | 29 +++++++++++++++++------------ pure.theme | 19 ++++++++++--------- starship.theme | 6 ++++-- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/liquidship.theme b/liquidship.theme index 7658f5f..c22cb61 100644 --- a/liquidship.theme +++ b/liquidship.theme @@ -10,6 +10,9 @@ _lp_liquidship_theme_activate() { __lp_foreground_color 11 local YELLOW="${_LP_OPEN_ESC}${af_color}${_LP_CLOSE_ESC}" + __lp_foreground_color 9 + local RED="${_LP_OPEN_ESC}${af_color}${_LP_CLOSE_ESC}" + NO_COL="${_LP_OPEN_ESC}${_LP_TI_RESET-}${_LP_CLOSE_ESC}" # Liquid Prompt reconfig @@ -50,7 +53,7 @@ _lp_liquidship_theme_activate() { # The user or connection type is not expected to change from inside the # shell, so we build this just once. if _lp_username_color; then - LP_USER="$lp_username_color in " + LP_USER="$lp_username_color" else LP_USER= fi @@ -62,7 +65,7 @@ _lp_liquidship_theme_activate() { if _lp_multiplexer; then LP_LIQUIDSHIP_MUX="in ${LP_COLOR_IN_MULTIPLEXER}${LP_LIQUIDSHIP_MARK_MUX}${NO_COL} " else - LP_LIQUIDSHIP_MARK_MUX= + LP_LIQUIDSHIP_MUX= fi _lp_terminal_device @@ -118,6 +121,8 @@ _lp_liquidship_theme_prompt_data() { if _lp_sudo_active_color; then # LP_COLOR_MARK="$lp_sudo_active_color" LP_LIQUIDSHIP_SUDO="${LP_COLOR_MARK_SUDO}${LP_LIQUIDSHIP_MARK_SUDO}${NO_COL} " + else + LP_LIQUIDSHIP_SUDO= fi if _lp_dirstack_color; then @@ -234,9 +239,9 @@ _lp_liquidship_theme_prompt_template() { if [[ -z "${LP_PS1-}" ]]; then # Docker is displayed along with Singularity and Kubernetes (strange that it is not the case in Starship…), # in the container section, which is not duplicated at the end, like in Starship (WTF?). - local n='\n' + local n=$'\n' PS1="${LP_USER}${LP_HOST}${LP_LIQUIDSHIP_MUX}${LP_SHLVL}${LP_DIRSTACK}at ${LP_PWD}${LP_PERM} ${LP_VCS}${LP_CONTAINER}${LP_KUBECONTEXT}${LP_CMAKE}${LP_NODE_VENV}${LP_VENV}${LP_TFSPACE}${LP_AWS_PROFILE}${LP_PROXY}${LP_PS1_POSTFIX}${LP_RUNTIME}${n}" - PS1+="${LP_TIME}${LP_WIFI}${LP_TEMP}${LP_LOAD}${LP_BATTERY}${LP_JOBS}${LP_LIQUIDSHIP_SUDO}${LP_ERR}${LP_COLOR_MARK}${LP_MARK}" + PS1+="${LP_TIME}${LP_WIFI}${LP_TEMP}${LP_LOAD}${LP_BATT}${LP_JOBS}${LP_LIQUIDSHIP_SUDO}${LP_ERR}${LP_COLOR_MARK}${LP_MARK}" # Get the core sections without prompt escapes and make them into a title. _lp_formatted_title "${LP_PS1_PREFIX}${LP_BRACKET_OPEN}${LP_USER}${LP_HOST}${LP_MARK_PERM}${lp_path-}${LP_BRACKET_CLOSE}${LP_MARK_PREFIX}${LP_SHLVL}${LP_MARK}${LP_PS1_POSTFIX}" @@ -249,33 +254,33 @@ _lp_liquidship_theme_prompt_template() { _lp_liquidship_hostname_color() { if _lp_connected_display; then - lp_hostname_color="with ${LP_COLOR_X11_ON}X${NO_COL} " + lp_hostname_color=" with ${LP_COLOR_X11_ON}X${NO_COL}" else - lp_hostname_color="with ${LP_COLOR_X11_OFF}CLI${NO_COL} " + lp_hostname_color=" with ${LP_COLOR_X11_OFF}CLI${NO_COL}" fi if _lp_chroot; then - lp_hostname_color+="(within ${lp_chroot}) " + lp_hostname_color+="(within ${lp_chroot})" fi if _lp_hostname; then case "$lp_connection" in lcl) - lp_hostname_color+="in ${LP_COLOR_HOST}${lp_hostname}${NO_COL}" + lp_hostname_color+=" in ${LP_COLOR_HOST}${lp_hostname}${NO_COL}" ;; ssh) # If we want a different color for each host (( LP_ENABLE_SSH_COLORS )) && LP_COLOR_SSH="$LP_COLOR_HOST_HASH" - lp_hostname_color+="in ${LP_COLOR_SSH}${lp_hostname}${NO_COL}" + lp_hostname_color+=" in ${LP_COLOR_SSH}${lp_hostname}${NO_COL}" ;; su) - lp_hostname_color+="in ${LP_COLOR_SU}${lp_hostname}${NO_COL}" + lp_hostname_color+=" in ${LP_COLOR_SU}${lp_hostname}${NO_COL}" ;; tel) - lp_hostname_color+="IN ${LP_COLOR_TELNET}${lp_hostname}${NO_COL}" + lp_hostname_color+=" IN ${LP_COLOR_TELNET}${lp_hostname}${NO_COL}" ;; *) - lp_hostname_color+="in ${NO_COL}${lp_hostname}" # defaults to no color + lp_hostname_color+=" in ${NO_COL}${lp_hostname}" # defaults to no color ;; esac else diff --git a/pure.theme b/pure.theme index 07842e7..c4f0735 100644 --- a/pure.theme +++ b/pure.theme @@ -121,6 +121,7 @@ _lp_pure_theme_activate() { LP_COLOR_PATH="$BLUE" LP_COLOR_PATH_SEPARATOR="$BLUE" + LP_COLOR_PATH_SHORTENED="$BLUE" LP_COLOR_PATH_VCS_ROOT="$BOLD" LP_COLOR_PATH_LAST_DIR="$BOLD" LP_COLOR_PATH_ROOT="$BOLD_YELLOW" @@ -155,7 +156,7 @@ _lp_pure_theme_activate() { fi if _lp_hostname_color ; then - LP_HOST="$lp_hostname_color " + LP_HOST="$lp_hostname_color" else LP_HOST= fi @@ -165,12 +166,12 @@ _lp_pure_theme_directory() { local lp_path_format _lp_path_format "$LP_COLOR_PATH" "$LP_COLOR_PATH_LAST_DIR" "$LP_COLOR_PATH_VCS_ROOT" "$LP_COLOR_PATH_SHORTENED" "/" "$LP_COLOR_PATH_SEPARATOR" - LP_PWD="${lp_path_format}${NO_COL}" + LP_PWD=" ${lp_path_format}${NO_COL}" } _lp_pure_theme_prompt() { if _lp_jobcount_color; then - LP_JOBS=" ${LP_PURE_COLOR_JOBS}${LP_PURE_MARK_JOBS}${NO_COL}" + LP_JOBS="${LP_PURE_COLOR_JOBS}${LP_PURE_MARK_JOBS}${NO_COL}" else LP_JOBS= fi @@ -213,7 +214,8 @@ _lp_pure_theme_prompt_template() { fi if [[ -z "${LP_PS1-}" ]]; then - PS1="${LP_USER}${LP_HOST}${LP_PWD}${LP_VCS}${LP_RUNTIME}\n${LP_VENV}${LP_JOBS}" + local n=$'\n' + PS1="${LP_USER}${LP_HOST}${LP_PWD}${LP_VCS}${LP_RUNTIME}${n}${LP_VENV}${LP_JOBS}" if [[ -n "${LP_ERR}" ]] ; then PS1+="${LP_COLOR_ERR}${LP_MARK} " @@ -222,7 +224,7 @@ _lp_pure_theme_prompt_template() { fi # Get the core sections without prompt escapes and make them into a title. - _lp_formatted_title "${LP_USER}${LP_HOST}${lp_path-}${LP_MARK}" + # _lp_formatted_title "${LP_USER}${LP_HOST}${lp_path-}${LP_MARK}" else PS1=$LP_PS1 fi @@ -252,7 +254,7 @@ _lp_pure_vcs() { if _lp_vcs_commits_off_remote; then lp_vcs_details_color="$LP_COLOR_COMMITS_BEHIND" if [[ "$lp_vcs_commit_ahead" -ne "0" && "$lp_vcs_commit_behind" -ne "0" ]]; then - has_commit="${LP_COLOR_COMMITS}${LP_PURE_GIT_UP_ARROW}{NO_COL}${LP_COLOR_COMMITS_BEHIND}${LP_PURE_GIT_DOWN_ARROW}${NO_COL}" + has_commit="${LP_COLOR_COMMITS}${LP_PURE_GIT_UP_ARROW}${NO_COL}${LP_COLOR_COMMITS_BEHIND}${LP_PURE_GIT_DOWN_ARROW}${NO_COL}" elif [[ "$lp_vcs_commit_ahead" -ne "0" ]]; then has_commit="${LP_COLOR_COMMITS}${LP_PURE_GIT_UP_ARROW}${NO_COL}" lp_vcs_details_color="$LP_COLOR_COMMITS" @@ -283,18 +285,17 @@ _lp_pure_vcs() { if [[ -n "$has_lines" ]]; then lp_vcs_details_color+="${LP_COLOR_DIFF}${has_lines}${NO_COL}${has_commit}" fi - lp_vcs_details_color+="${has_commit}" fi if _lp_vcs_head_status; then - lp_vcs_details_color+=" $LP_COLOR_CHANGES$lp_vcs_head_status" + lp_vcs_details_color+=" ${LP_COLOR_CHANGES}${lp_vcs_head_status}" if [[ -n "${lp_vcs_head_details-}" ]]; then lp_vcs_details_color+=" ${lp_vcs_head_details}" fi fi if _lp_vcs_stash_count; then - lp_vcs_details_color+=" $LP_COLOR_COMMITS$LP_MARK_STASH" + lp_vcs_details_color+=" ${LP_COLOR_COMMITS}${LP_MARK_STASH}" fi # Pure does not show untracked files. diff --git a/starship.theme b/starship.theme index fd51a99..452d6b5 100644 --- a/starship.theme +++ b/starship.theme @@ -185,6 +185,8 @@ _lp_starship_theme_prompt_data() { if _lp_sudo_active_color; then # LP_COLOR_MARK="$lp_sudo_active_color" LP_STARSHIP_SUDO="${LP_COLOR_MARK_SUDO}${LP_STARSHIP_MARK_SUDO}${NO_COL} " + else + LP_STARSHIP_SUDO= fi # if _lp_dirstack_color; then @@ -310,9 +312,9 @@ _lp_starship_theme_prompt_template() { if [[ -z "${LP_PS1-}" ]]; then # Docker is displayed along with Singularity and Kubernetes (strange that it is not the case in Starship…), # in the container section, which is not duplicated at the end, like in Starship (WTF?). - local n='\n' + local n=$'\n' PS1="${LP_USER}${LP_HOST}${LP_SHLVL}${LP_CONTAINER}${LP_KUBECONTEXT}${LP_PWD}${LP_PERM} ${LP_VCS}${LP_CMAKE}${LP_NODE_VENV}${LP_VENV}${LP_TFSPACE}${LP_AWS_PROFILE}${LP_PS1_POSTFIX}${LP_STARSHIP_SUDO}${LP_RUNTIME}${n}" - PS1+="${LP_JOBS}${LP_BATTERY}${LP_TIME}${LP_ERR}${LP_COLOR_MARK}${LP_MARK}" + PS1+="${LP_JOBS}${LP_BATT}${LP_TIME}${LP_ERR}${LP_COLOR_MARK}${LP_MARK}" # No title support in Starship. else