diff --git a/README.md b/README.md index cec4c74..a4608c4 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ The segments that are currently available are: * [`command_execution_time`](#command_execution_time) - Display the time the current command took to execute. * [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. * `detect_virt` - Virtualization detection with systemd +* `newline` - Continues the prompt on a new line. --------------------------------------------------------------------------------- @@ -442,6 +443,14 @@ segment will not be displayed. |`POWERLEVEL9K_PUBLIC_IP_METHODS`|(dig curl wget)| These methods in that order are used to refresh your IP.| |`POWERLEVEL9K_PUBLIC_IP_NONE`|None|The string displayed when an IP was not obtained| +##### newline + +Puts a newline in your prompt so you can continue using segments on the next line. + +This allows you to use segments on both lines, unlike `POWERLEVEL9K_PROMPT_ON_NEWLINE`. + +This only works on the left side. On the right side it does nothing. + ##### rbenv This segment shows the version of Ruby being used when using `rbenv` to change your current Ruby stack. diff --git a/functions/icons.zsh b/functions/icons.zsh index 7b3bba7..72e0fbe 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -39,8 +39,9 @@ case $POWERLEVEL9K_MODE in FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ - MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' - MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' + MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─ + MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─ + MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─ APPLE_ICON $'\uE26E' #  WINDOWS_ICON $'\uE26F' #  FREEBSD_ICON $'\U1F608 ' # 😈 @@ -111,6 +112,7 @@ case $POWERLEVEL9K_MODE in SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─ + MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─ MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─ APPLE_ICON $'\uF179' #  WINDOWS_ICON $'\uF17A' #  @@ -178,6 +180,7 @@ case $POWERLEVEL9K_MODE in SYMFONY_ICON $'\uE757' #  NODE_ICON $'\uE617 ' #  MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─ + MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─ MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─ APPLE_ICON $'\uF179' #  WINDOWS_ICON $'\uF17A' #  @@ -244,8 +247,9 @@ case $POWERLEVEL9K_MODE in FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ - MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\u2500' - MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\u2500 ' + MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─ + MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─ + MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─ APPLE_ICON 'OSX' WINDOWS_ICON 'WIN' FREEBSD_ICON 'BSD' diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0f2445e..e462964 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -337,6 +337,23 @@ prompt_background_jobs() { fi } +# A newline in your prompt, so you can segments on multiple lines. +prompt_newline() { + local lws newline + [[ "$1" == "right" ]] && return + newline=$'\n' + lws=$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS + if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then + newline="${newline}$(print_icon 'MULTILINE_NEWLINE_PROMPT_PREFIX')" + fi + POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS= + "$1_prompt_segment" \ + "$0" \ + "$2" \ + "NONE" "NONE" "${newline}" + POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=$lws +} + # Segment that indicates usage level of current partition. set_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false set_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90