Added configurable padding value to Powerline-Multiline theme
Required on macOS High Sierra with the default Terminal app, otherwise, the right segment would extend to the next line.pull/1128/head
parent
f48560bae0
commit
d0df07435e
|
|
@ -26,7 +26,9 @@ This theme is pretty configurable, all the configuration is done by setting envi
|
|||
|
||||
By default, the username and hostname are shown on the right hand side, but you can change this behavior by setting the value of the following variable:
|
||||
|
||||
POWERLINE_PROMPT_USER_INFO_MODE="sudo"
|
||||
```bash
|
||||
export POWERLINE_PROMPT_USER_INFO_MODE="sudo"
|
||||
```
|
||||
|
||||
For now, the only supported value is `sudo`, which hides the username and hostname, and shows an indicator when `sudo` has the credentials cached. Other values have no effect at this time.
|
||||
|
||||
|
|
@ -34,7 +36,9 @@ For now, the only supported value is `sudo`, which hides the username and hostna
|
|||
|
||||
By default, the current time is shown on the right hand side, you can change the format using the following variable:
|
||||
|
||||
THEME_CLOCK_FORMAT="%H:%M:%S"
|
||||
```bash
|
||||
export THEME_CLOCK_FORMAT="%H:%M:%S"
|
||||
```
|
||||
|
||||
The time/date is printed by the `date` command, so refer to its man page to change the format.
|
||||
|
||||
|
|
@ -53,7 +57,21 @@ The contents of both prompt sides can be "reordered", all the "segments" (every
|
|||
|
||||
Two variables can be defined to set the order of the prompt segments:
|
||||
|
||||
POWERLINE_LEFT_PROMPT="scm python_venv ruby cwd"
|
||||
POWERLINE_RIGHT_PROMPT="in_vim clock battery user_info"
|
||||
```bash
|
||||
export POWERLINE_LEFT_PROMPT="scm python_venv ruby cwd"
|
||||
export POWERLINE_RIGHT_PROMPT="in_vim clock battery user_info"
|
||||
```
|
||||
|
||||
The example values above are the current default values, but if you want to remove anything from the prompt, simply remove the "string" that represents the segment from the corresponding variable.
|
||||
|
||||
### Padding
|
||||
|
||||
To get the length of the left and right segments right, a _padding_ value is used.
|
||||
In most cases, the default value (_2_) works fine, but on some operating systems, this needs to be adjusted.
|
||||
One example is _macOS High Sierra_, where the default padding causes the right segment to extend to the next line.
|
||||
On macOS High Sierra, the padding value needs to be changed to _3_ to make the theme look right.
|
||||
This can be done by setting the `POWERLINE_PADDING` variable before Bash-it is loaded, e.g. in your `~/.bash_profile` or `~/.bashrc` file:
|
||||
|
||||
```bash
|
||||
export POWERLINE_PADDING=3
|
||||
```
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function __powerline_right_segment {
|
|||
local params=( $1 )
|
||||
IFS="${OLD_IFS}"
|
||||
local separator_char="${POWERLINE_RIGHT_SEPARATOR}"
|
||||
local padding=2
|
||||
local padding="${POWERLINE_PADDING}"
|
||||
local separator_color=""
|
||||
|
||||
if [[ "${SEGMENTS_AT_RIGHT}" -eq 0 ]]; then
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
. "$BASH_IT/themes/powerline-multiline/powerline-multiline.base.bash"
|
||||
|
||||
PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:="❯"}
|
||||
|
|
@ -7,6 +8,7 @@ POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""}
|
|||
POWERLINE_RIGHT_SEPARATOR=${POWERLINE_RIGHT_SEPARATOR:=""}
|
||||
POWERLINE_LEFT_END=${POWERLINE_LEFT_END:=""}
|
||||
POWERLINE_RIGHT_END=${POWERLINE_RIGHT_END:=""}
|
||||
POWERLINE_PADDING=${POWERLINE_PADDING:=2}
|
||||
|
||||
USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "}
|
||||
USER_INFO_THEME_PROMPT_COLOR=32
|
||||
|
|
|
|||
Loading…
Reference in New Issue