newline: add new segment

This commit is contained in:
Christian Höltje 2017-05-04 02:32:18 -04:00
parent 0b2483cf6d
commit 1619c74ad8
2 changed files with 23 additions and 0 deletions

View File

@ -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,13 @@ 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` and
`POWERLEVEL9K_RPROMPT_ON_NEWLINE`.
##### rbenv
This segment shows the version of Ruby being used when using `rbenv` to change your current Ruby stack.

View File

@ -337,6 +337,21 @@ prompt_background_jobs() {
fi
}
# A newline in your prompt, so you can segments on multiple lines.
prompt_newline() {
local lws rws
lws=$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS
rws=$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=
POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS=
"$1_prompt_segment" \
"$0" \
"$2" \
"NONE" "NONE" $'\n'
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=$lws
POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS=$rws
}
# Segment that indicates usage level of current partition.
set_default POWERLEVEL9K_DISK_USAGE_ONLY_WARNING false
set_default POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL 90