From 771b57e89a0a07f22ee239002b6471549dcde908 Mon Sep 17 00:00:00 2001 From: Diego Ocko Martins Date: Fri, 25 Oct 2019 09:59:37 -0300 Subject: [PATCH 1/2] themes/powerline: Add possibility to add \n to the end of commands --- themes/powerline/README.md | 8 ++++++++ themes/powerline/powerline.base.sh | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/powerline/README.md b/themes/powerline/README.md index b2f244d4f..16dac6e46 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -40,6 +40,14 @@ You can change the format using the following variable: The time/date is printed by the `date` command, so refer to its man page to change the format. +### New Line + +You can move the cursor to a new line after each command using the following variable: + + POWERLINE_PROMPT_NEWLINE=true + +The prompt will receive a "\n" at the end. This is usefull if you navigate a lot to folders with extensive names. + ### Segment Order The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: diff --git a/themes/powerline/powerline.base.sh b/themes/powerline/powerline.base.sh index 33e8e117b..6b6928448 100644 --- a/themes/powerline/powerline.base.sh +++ b/themes/powerline/powerline.base.sh @@ -2,6 +2,7 @@ # Define this here so it can be used by all of the Powerline themes THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=false} +POWERLINE_PROMPT_NEWLINE=${POWERLINE_PROMPT_NEWLINE:=false} function set_color { if [[ "${1}" != "-" ]]; then @@ -161,8 +162,9 @@ function __powerline_prompt_command { done [[ "${last_status}" -ne 0 ]] && __powerline_left_segment $(__powerline_last_status_prompt ${last_status}) [[ -n "${LEFT_PROMPT}" ]] && LEFT_PROMPT+="$(set_color ${LAST_SEGMENT_COLOR} -)${separator_char}${_omb_prompt_normal}" + [[ "${POWERLINE_PROMPT_NEWLINE=}" == true ]] && END_PROMPT=" \n" || END_PROMPT="" - PS1="${LEFT_PROMPT} " + PS1="${LEFT_PROMPT}${END_PROMPT}" ## cleanup ## unset LAST_SEGMENT_COLOR \ From eb5b6bf7757eb425b02cf028db28f350041a552b Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 9 Apr 2023 21:42:41 +0900 Subject: [PATCH 2/2] themes/powerline: Adjust styles --- themes/powerline/powerline.base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline/powerline.base.sh b/themes/powerline/powerline.base.sh index 6b6928448..7ccf499b8 100644 --- a/themes/powerline/powerline.base.sh +++ b/themes/powerline/powerline.base.sh @@ -162,7 +162,7 @@ function __powerline_prompt_command { done [[ "${last_status}" -ne 0 ]] && __powerline_left_segment $(__powerline_last_status_prompt ${last_status}) [[ -n "${LEFT_PROMPT}" ]] && LEFT_PROMPT+="$(set_color ${LAST_SEGMENT_COLOR} -)${separator_char}${_omb_prompt_normal}" - [[ "${POWERLINE_PROMPT_NEWLINE=}" == true ]] && END_PROMPT=" \n" || END_PROMPT="" + [[ ${POWERLINE_PROMPT_NEWLINE-} == true ]] && END_PROMPT="\n" || END_PROMPT=" " PS1="${LEFT_PROMPT}${END_PROMPT}"