aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md122
1 files changed, 82 insertions, 40 deletions
diff --git a/README.md b/README.md
index 82650131..f6b8c54c 100644
--- a/README.md
+++ b/README.md
@@ -76,10 +76,10 @@ variables to your `~/.zshrc`.
So if you wanted to set these variables manually, you would put the following in
your `~/.zshrc`:
-
- POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
- POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
-
+```zsh
+POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
+POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
+```
#### Available Prompt Segments
The segments that are currently available are:
@@ -90,6 +90,7 @@ The segments that are currently available are:
* [`dir`](#dir) - Your current working directory.
* `history` - The command number for the current line.
* [`ip`](#ip) - Shows the current 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.
* `ram` - Show free RAM.
@@ -123,6 +124,8 @@ The segments that are currently available are:
* [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec.
* **Rust Segments:**
* `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg).
+* **Swift Segments:**
+ * `swift_version` - Show the version number of the installed Swift.
**Cloud Segments:**
* **AWS Segments:**
@@ -134,6 +137,7 @@ The segments that are currently available are:
* [`custom_command`](#custom_command) - Create a custom segment to display the
output of an arbitrary command.
* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.
+* `detect-virt` - Virtualization detection with systemd
---------------------------------------------------------------------------------
@@ -198,28 +202,28 @@ The `custom_...` segment allows you to turn the output of a custom command into
a prompt segment. As an example, if you wanted to create a custom segment to
display your WiFi signal strength, you might define a custom segment called
`custom_wifi_signal` like this:
-
- POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
- POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="echo signal: \$(nmcli device wifi | grep yes | awk '{print \$8}')"
- POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="blue"
- POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="yellow"
-
+```zsh
+POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
+POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="echo signal: \$(nmcli device wifi | grep yes | awk '{print \$8}')"
+POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="blue"
+POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="yellow"
+```
If you prefer, you can also define the function in your `.zshrc` rather than
putting it in-line with the variable export, as shown above. Just don't forget
to invoke your function from your segment! Example code that achieves the same
result as the above:
+```zsh
+zsh_wifi_signal(){
+ local signal=$(nmcli device wifi | grep yes | awk '{print $8}')
+ local color='%F{yellow}'
+ [[ $signal -gt 75 ]] && color='%F{green}'
+ [[ $signal -lt 50 ]] && color='%F{red}'
+ echo -n "%{$color%}\uf230 $signal%{%f%}" # \uf230 is 
+}
- zsh_wifi_signal(){
- local signal=$(nmcli device wifi | grep yes | awk '{print $8}')
- local color='%F{yellow}'
- [[ $signal -gt 75 ]] && color='%F{green}'
- [[ $signal -lt 50 ]] && color='%F{red}'
- echo -n "%{$color%}\uf230 $signal%{%f%}" # \uf230 is 
- }
-
- POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
- POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
-
+POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
+POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
+```
The command, above, gives you the wireless signal segment shown below:
![signal](http://i.imgur.com/hviMATC.png)
@@ -237,9 +241,17 @@ it, but only display it if you are not your normal user or on a remote host
To use this feature, make sure the `context` segment is enabled in your prompt
elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`:
+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. 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.
+
| Variable | Default Value | Description |
|----------|---------------|-------------|
|`DEFAULT_USER`|None|Username to consider a "default context" (you can also use `$USER`)|
+|`POWERLEVEL9K_CONTEXT_HOST_DEPTH`|%m|Customizable host depth on prompt|
##### dir
@@ -253,11 +265,11 @@ Powerline" fonts, there are additional glyphs, as well:
| None | None | ![](https://cloud.githubusercontent.com/assets/1544760/12183452/40f79286-b58f-11e5-9b8c-ed1343a07b08.png) | Outside of your home folder |
To turn off these icons you could set these variables to an empty string.
-
- POWERLEVEL9K_HOME_ICON=''
- POWERLEVEL9K_HOME_SUB_ICON=''
- POWERLEVEL9K_FOLDER_ICON=''
-
+```zsh
+POWERLEVEL9K_HOME_ICON=''
+POWERLEVEL9K_HOME_SUB_ICON=''
+POWERLEVEL9K_FOLDER_ICON=''
+```
You can limit the output to a certain length by truncating long paths.
Customizations available are:
@@ -269,11 +281,11 @@ Customizations available are:
For example, if you wanted the truncation behavior of the `fish` shell, which
truncates `/usr/share/plasma` to `/u/s/plasma`, you would use the following:
-
- POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
- POWERLEVEL9K_SHORTEN_DELIMITER=""
- POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right"
-
+```zsh
+POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
+POWERLEVEL9K_SHORTEN_DELIMITER=""
+POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right"
+```
In each case you have to specify the length you want to shorten the directory
to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in
others whole directories.
@@ -288,6 +300,12 @@ The `truncate_with_package_name` strategy gives your directory path relative to
the path shown would be `my-cool-project`. If you navigate to `$HOME/projects/my-project/src`, then the path shown would be `my-cool-project/src`. Please note that this currently looks for `.git` directory to determine the root of the project.
+If you want to customize the directory separator, you could set:
+```zsh
+# You'll need patched awesome-terminal fonts for that example
+POWERLEVEL9K_DIR_PATH_SEPARATOR="%f "$'\uE0B1'" %F"
+```
+
##### ip
This segment tries to examine all currently used network interfaces and prints
@@ -298,6 +316,29 @@ specify the correct network interface by setting:
|----------|---------------|-------------|
|`POWERLEVEL9K_IP_INTERFACE`|None|The NIC for which you wish to display the IP address. Example: `eth0`.|
+##### public_ip
+
+This segment will display your public IP address. There are several methods of obtaining this
+information and by default it will try all of them starting with the most efficient. You can
+also specify which method you would like it to use. The methods available are dig using opendns,
+curl, or wget. The host used for wget and curl is http://ident.me by default but can be set to
+another host if you prefer.
+
+The public_ip segment will attempt to update your public IP address every 5 minutes by default(also
+configurable by the user). If you lose connection your cached IP address will be displayed until
+your timeout expires at which point every time your prompt is generated a new attempt will be made.
+Until an IP is successfully pulled the value of $POWERLEVEL9K_PUBLIC_IP_NONE will be displayed for
+this segment. If this value is empty(the default)and $POWERLEVEL9K_PUBLIC_IP_FILE is empty the
+segment will not be displayed.
+
+| Variable | Default Value | Description |
+|----------|---------------|-------------|
+|`POWERLEVEL9K_PUBLIC_IP_FILE`|'/tmp/p8k_public_ip'|This is the file your public IP is cached in.|
+|`POWERLEVEL9K_PUBLIC_IP_HOST`|'http://ident.me'|This is the default host to get your public IP.|
+|`POWERLEVEL9K_PUBLIC_IP_TIMEOUT`|300|The amount of time in seconds between refreshing your cached IP.|
+|`POWERLEVEL9K_PUBLIC_IP_METHOD`|None|You can set this to any of 'dig', 'curl', or 'wget' to only use that method to refresh your IP.|
+|`POWERLEVEL9K_PUBLIC_IP_NONE`|None|The string displayed when an IP was not obtained|
+
##### rbenv
This segment shows the version of Ruby being used when using `rbenv` to change your current Ruby stack.
@@ -317,7 +358,8 @@ 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 hide this segment when the last command completed successfully.|
+|`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.|
##### ram
@@ -336,16 +378,16 @@ See [Unit Test Ratios](#unit-test-ratios), below.
|`POWERLEVEL9K_TIME_FORMAT`|`'H:M:S'`|ZSH time format to use in this segment.|
As an example, if you wanted a reversed time format, you would use this:
-
- # Reversed time format
- POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
-
+```zsh
+# Reversed time format
+POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
+```
If you are using an "Awesome Powerline Font", you can add a time symbol to this
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}"
-
+```zsh
+# Output time, date, and a symbol from the "Awesome Powerline Font" set
+POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S \uE868 %d.%m.%y}"
+```
##### vcs
By default, the `vcs` segment will provide quite a bit of information. Further