summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md143
1 files changed, 137 insertions, 6 deletions
diff --git a/README.md b/README.md
index bb07b7fd..9c17c2c5 100644
--- a/README.md
+++ b/README.md
@@ -92,7 +92,9 @@ The segments that are currently available are:
* `dir_writable` - Displays a lock icon, if you do not have write permissions on the current folder.
* [`disk_usage`](#disk_usage) - Disk usage of your current partition.
* `history` - The command number for the current line.
+* [`host`](#host) - Your current host name
* [`ip`](#ip) - Shows the current IP address.
+* [`vpn`](#vpn) - Shows the current VPN IP address.
* [`public_ip`](#public_ip) - Shows your public IP address.
* `load` - Your machine's load averages.
* `os_icon` - Display a nice little icon, depending on your operating system.
@@ -101,6 +103,7 @@ The segments that are currently available are:
* [`status`](#status) - The return code of the previous command.
* `swap` - Prints the current swap size.
* [`time`](#time) - System time.
+* [`user`](#user) - Your current username
* [`vi_mode`](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT).
* `ssh` - Indicates whether or not you are in an SSH session.
@@ -136,6 +139,7 @@ The segments that are currently available are:
* [`aws`](#aws) - The current AWS profile, if active.
* `aws_eb_env` - The current Elastic Beanstalk Environment.
* `docker_machine` - The current Docker Machine.
+* `kubecontext` - The current context of your `kubectl` configuration.
**Other:**
* [`custom_command`](#custom_command) - Create a custom segment to display the
@@ -143,6 +147,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.
---------------------------------------------------------------------------------
@@ -184,9 +189,8 @@ your `~/.zshrc`:
##### battery
-This segment will display your current battery status (fails gracefully on
-systems without a battery). It is supported on both OSX and Linux (note that it
-requires `acpi` on Linux).
+The default settings for this segment will display your current battery status (fails gracefully on
+systems without a battery). It is supported on both OSX and Linux (note that it requires `acpi` on Linux).
| Variable | Default Value | Description |
|----------|---------------|-------------|
@@ -201,6 +205,56 @@ Note that you can [modify the `_FOREGROUND`
color](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization)
without affecting the icon color.
+You can also change the battery icon automatically depending on the battery
+level. This will override the default battery icon. In order to do this, you
+need to define the `POWERLEVEL9k_BATTERY_STAGES` variable.
+
+| Variable | Default Value | Description |
+| `POWERLEVEL9K_BATTERY_STAGES`|Unset|A string or array, which each index indicates a charge level.|
+
+Powerlevel9k will use each index of the string or array as a stage to indicate battery
+charge level, progressing from left to right. You can provide any number of
+stages. The setting below, for example, provides 8 stages for Powerlevel9k to use.
+```zsh
+POWERLEVEL9K_BATTERY_STAGES="▁▂▃▄▅▆▇█"
+```
+
+If you require extra spacing after the icon, you will have to set it as an array,
+since spaces in the string will be used as one of the stages and you will get a
+missing icon. To do this, declare the variable as follows:
+```zsh
+POWERLEVEL9K_BATTERY_STAGES=($'\u2581 ' $'\u2582 ' $'\u2583 ' $'\u2584 ' $'\u2585 ' $'\u2586 ' $'\u2587 ' $'\u2588 ')
+```
+
+Using the array syntax, you can create stages comprised of multiple characters.
+The below setting provides 40 battery stages.
+```zsh
+POWERLEVEL9K_BATTERY_STAGES=(
+ $'▏ ▏' $'▎ ▏' $'▍ ▏' $'▌ ▏' $'▋ ▏' $'▊ ▏' $'▉ ▏' $'█ ▏'
+ $'█▏ ▏' $'█▎ ▏' $'█▍ ▏' $'█▌ ▏' $'█▋ ▏' $'█▊ ▏' $'█▉ ▏' $'██ ▏'
+ $'██ ▏' $'██▎ ▏' $'██▍ ▏' $'██▌ ▏' $'██▋ ▏' $'██▊ ▏' $'██▉ ▏' $'███ ▏'
+ $'███ ▏' $'███▎ ▏' $'███▍ ▏' $'███▌ ▏' $'███▋ ▏' $'███▊ ▏' $'███▉ ▏' $'████ ▏'
+ $'████ ▏' $'████▎▏' $'████▍▏' $'████▌▏' $'████▋▏' $'████▊▏' $'████▉▏' $'█████▏' )
+```
+
+You can also change the background of the segment automatically depending on the
+battery level. This will override the following variables:
+`POWERLEVEL9K_BATTERY_CHARGING`, `POWERLEVEL9K_BATTERY_CHARGED`,
+`POWERLEVEL9K_BATTERY_DISCONNECTED`, and `POWERLEVEL9K_BATTERY_LOW_COLOR`. In
+order to do this, define a color array, from low to high, as shown below:
+```zsh
+POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(196 202 208 214 220 226 190 154 118 82 46)
+```
+
+As with the battery stages, you can use any number of colors and Powerlevel9k
+will automatically use all of them appropriately.
+
+Some example settings:
+|Brightness|Possible Array|
+|Bright Colors|(196 202 208 214 220 226 190 154 118 82 46)|
+|Normal Colors|(124 130 136 142 148 112 76 40 34 28 22)|
+|Subdued Colors|( 88 94 100 106 70 34 28 22)|
+
##### command_execution_time
Display the time the previous command took to execute if the time is above
@@ -261,11 +315,11 @@ elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`.
You can customize the `context` segment. For example, you can make it to print the
full hostname by setting
+
```
POWERLEVEL9K_CONTEXT_TEMPLATE="%n@`hostname -f`"
```
-
You can set the `POWERLEVEL9K_CONTEXT_HOST_DEPTH` variable to change how the
hostname is displayed. See (ZSH Manual)[http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information]
for details. The default is set to %m which will show the hostname up to the first ‘.’
@@ -349,7 +403,11 @@ You can also customize the leading tilde character when you are in `$HOME` using
# Double quotes are important here!
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION="%F{red} $(print_icon 'HOME_ICON') %F{black}"
```
+You can also configure the `dir` segment to show when you are in a directory without write permissions, using the variable below.
+| Variable | Default Value | Description |
+|----------|---------------|-------------|
+|`POWERLEVEL9K_DIR_SHOW_WRITABLE`|`false`|If set to `true` and you are in a directory that you do not have write permissions for, this segment will display a lock icon and enter the `NOT_WRITABLE` state (which can be customized per [our usual process](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization). Note that this functionality is also available in a separate segment, `dir_writable`.|
##### disk_usage
@@ -361,6 +419,28 @@ The `disk_usage` segment will show the usage level of the partition that your cu
|POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL|90|The usage level that triggers a warning state.|
|POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL|95|The usage level that triggers a critical state.|
+##### host
+
+The `host` segment will print the hostname.
+
+You can set the `POWERLEVEL9K_HOST_TEMPLATE` variable to change how the hostname
+is displayed. See (ZSH Manual)[http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information]
+for details. The default is set to `%m` which will show the hostname up to the
+first `.`. You can set it to `%{N}m` where N is an integer to show that many
+segments of system hostname. Setting `N` to a negative integer will show that many
+segments from the end of the hostname.
+
+```
+POWERLEVEL9K_HOST_TEMPLATE="%2m"
+```
+
+By default, LOCAL hosts will show the host icon and remote hosts will show the SSH icon. You can override them by setting
+```
+POWERLEVEL9K_HOST_ICON="\uF109 " # 
+POWERLEVEL9K_SSH_ICON="\uF489 " # 
+```
+
+
##### ip
This segment tries to examine all currently used network interfaces and prints
@@ -371,6 +451,14 @@ specify the correct network interface by setting:
|----------|---------------|-------------|
|`POWERLEVEL9K_IP_INTERFACE`|None|The NIC for which you wish to display the IP address. Example: `eth0`.|
+##### vpn
+
+This segment tries to extract the VPN related IP addresses from nmcli, based on the NIC type:
+
+| Variable | Default Value | Description |
+|----------|---------------|-------------|
+|`POWERLEVEL9K_VPN_IP_INTERFACE`|`tun`|The VPN interface.|
+
##### public_ip
This segment will display your public IP address. There are several methods of obtaining this
@@ -394,6 +482,15 @@ 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`, which simply separates segments from the
+prompt itself.
+
+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.
@@ -413,8 +510,10 @@ This segment shows the return code of the last command.
| Variable | Default Value | Description |
|----------|---------------|-------------|
-|`POWERLEVEL9K_STATUS_VERBOSE`|`true`|Set to false if you wish to not show the error code when the last command returned an error and optionally hide this segment when the last command completed successfully by setting `POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE` to false.|
-|`POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE`|`false`|Set to true if you wish to show this segment when the last command completed successfully in non-verbose mode.|
+|`POWERLEVEL9K_STATUS_CROSS`|`false`|Set to true if you wish not to show the error code when the last command returned an error and optionally hide this segment when the last command completed successfully by setting `POWERLEVEL9K_STATUS_OK` to false.|
+|`POWERLEVEL9K_STATUS_OK`|`true`|Set to true if you wish to show this segment when the last command completed successfully, false to hide it.|
+|`POWERLEVEL9K_STATUS_SHOW_PIPESTATUS`|`true`|Set to true if you wish to show the exit status for all piped commands.|
+|`POWERLEVEL9K_STATUS_HIDE_SIGNAME`|`false`|Set to true return the raw exit code (`1-255`). When set to false, values over 128 are shown as `SIGNAME(-n)` (e.g. `KILL(-9)`)|
##### ram
@@ -443,6 +542,23 @@ segment, as well:
# Output time, date, and a symbol from the "Awesome Powerline Font" set
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S \uE868 %d.%m.%y}"
```
+##### user
+
+The `user` segment will print the username.
+
+You can also override the icons by setting:
+
+```
+POWERLEVEL9K_USER_ICON="\uF415" # 
+POWERLEVEL9K_ROOT_ICON="#"
+```
+
+| Variable | Default Value | Description |
+|----------|---------------|-------------|
+|`DEFAULT_USER`|None|Username to consider a "default context".|
+|`POWERLEVEL9K_ALWAYS_SHOW_USER`|`false`|Always print this segment.|
+|`POWERLEVEL9K_USER_TEMPLATE`|`%n`|Default username prompt. Refer to the [ZSH Documentation](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) for all possible expansions|
+
##### vcs
By default, the `vcs` segment will provide quite a bit of information. Further
@@ -499,6 +615,21 @@ is count your source files and test files, and calculate the ratio between them.
Just enough to give you a quick overview about the test situation of the project
you are dealing with.
+### Disabling / Enabling Powerlevel9k
+
+You can disable P9k and return to a very basic prompt at any time simply by
+calling:
+
+```zsh
+$ prompt_powerlevel9k_teardown
+```
+
+You can then re-enable it by calling:
+
+```zsh
+$ prompt_powerlevel9k_setup
+```
+
### tl; dr
Want to just get a quick start? Check out the [Show Off Your