Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

themes/powerline: Add possibility to add \n to the end of commands #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions themes/powerline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion themes/powerline/powerline.base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down