summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md33
-rw-r--r--powerlevel9k.zsh-theme209
2 files changed, 154 insertions, 88 deletions
diff --git a/README.md b/README.md
index 4aec6745..787e98f6 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Look like a bad-ass. Impress everyone in 'Screenshot Your Desktop' threads. Use
![](http://bhilburn.org/content/images/2015/01/pl9k-improved.png)
There are a number of Powerline ZSH themes available, now. The developers of
-this theme focus on three primary goals:
+this theme focus on four primary goals:
1. Give users a great out-of-the-box configuration with no additional
configuration required.
@@ -19,6 +19,8 @@ this theme focus on three primary goals:
3. Provide useful segments that you can enable to make your prompt even more
effective and helpful. We have prompt segments for everything from unit test
coverage to your AWS instance.
+4. Optimize the code for execution speed as much as possible. A snappy terminal
+ is a happy terminal.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -45,11 +47,13 @@ this theme focus on three primary goals:
- [Symbols](#symbols)
- [Styling](#styling)
- [Double-Lined Prompt](#double-lined-prompt)
+ - [Disable Right Prompt](#disable-right-prompt)
- [Light Color Theme](#light-color-theme)
- [Segment Color Customization](#segment-color-customization)
- [Special Segment Colors](#special-segment-colors)
- [Troubleshooting](#troubleshooting)
- [Gaps Between Segments](#gaps-between-segments)
+ - [Segment Colors are Wrong](#segment-colors-are-wrong)
- [Meta](#meta)
- [Kudos](#kudos)
- [Developing](#developing)
@@ -229,6 +233,7 @@ currently available are:
* **dir** - Your current working directory.
* **history** - The command number for the current line.
* **node_version** - Show the version number of the installed Node.js.
+* **os_icon** - Display a nice little icon, depending on your operating system.
* **rbenv** - Ruby environment information (if one is active).
* **rspec_stats** - Show a ratio of test classes vs code classes for RSpec.
* **status** - The return code of the previous command, and status of background jobs.
@@ -287,10 +292,17 @@ others whole directories.
#### The 'time' segment
By default the time is show in 'H:M:S' format. If you want to change it,
-just set another format in your `~/.zshrc`:
+just set another format in your `~/.zshrc`. As an example, this is a reversed
+time format:
# Reversed time format
- POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
+ 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}"
#### Unit Test Ratios
@@ -364,6 +376,12 @@ following variables in your `~/.zshrc`:
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="↱"
POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX="↳ "
+#### Disable Right Prompt
+
+If you do not want a right prompt, you can disable it by setting:
+
+ POWERLEVEL9K_DISABLE_RPROMPT=true
+
#### Light Color Theme
If you prefer to use "light" colors, simply set `POWERLEVEL9K_COLOR_SCHEME`
@@ -447,6 +465,15 @@ Thankfully, this is easy to fix. This happens if you have successfully installed
Powerline fonts, but did not make a Powerline font the default font in your
terminal emulator (e.g., 'terminator', 'gnome-terminal', 'konsole', etc.,).
+#### Segment Colors are Wrong
+
+If the color display within your terminal seems off, it's possible you are using
+a reduced color set. You can check this by invoking `echotc Co` in your
+terminal, which should yield `256`. If you see something different, try setting
+`xterm-256color` in your `~/.zshrc`:
+
+ TERM=xterm-256color
+
### Meta
#### Kudos
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index da3e617b..4ee919cc 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -26,7 +26,7 @@
# export DEFAULT_USER=<your username>
#
# Customize the format of the time segment. Example of reverse format:
-# POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
+# POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
#
# Show the hash/changeset string in the `vcs` segment:
# POWERLEVEL9K_SHOW_CHANGESET=true
@@ -44,6 +44,11 @@
#zstyle ':vcs_info:*+*:*' debug true
#set -o xtrace
+# The `CURRENT_BG` variable is used to remember what the last BG color used was
+# when building the left-hand prompt. Because the RPROMPT is created from
+# right-left but reads the opposite, this isn't necessary for the other side.
+CURRENT_BG='NONE'
+
# These characters require the Powerline fonts to work properly. If see boxes or
# bizarre characters below, your fonts are not correctly installed. If you
# do not want to install a special font, you can set `POWERLEVEL9K_MODE` to
@@ -54,117 +59,144 @@ case $POWERLEVEL9K_MODE in
# See https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
LEFT_SEGMENT_SEPARATOR=''
RIGHT_SEGMENT_SEPARATOR=''
- ROOT_ICON="\uE801" # 
- RUBY_ICON="\uE847" # 
- AWS_ICON="\uE895" # 
- BACKGROUND_JOBS_ICON="\uE82F " # 
- TEST_ICON="\uE891" # 
- OK_ICON="\u2713" # ✓
- FAIL_ICON="\u2718" # ✘
+ ROOT_ICON="\UE801" # 
+ RUBY_ICON="\UE847" # 
+ AWS_ICON="\UE895" # 
+ BACKGROUND_JOBS_ICON="\UE82F " # 
+ TEST_ICON="\UE891" # 
+ OK_ICON="\U2713" # ✓
+ FAIL_ICON="\U2718" # ✘
SYMFONY_ICON="SF"
- VCS_UNTRACKED_ICON="\uE16C" # 
- VCS_UNSTAGED_ICON="\uE17C" # 
- VCS_STAGED_ICON="\uE168" # 
- VCS_STASH_ICON="\uE133 " # 
- #VCS_INCOMING_CHANGES="\uE1EB " # 
- #VCS_INCOMING_CHANGES="\uE80D " # 
- VCS_INCOMING_CHANGES="\uE131 " # 
- #VCS_OUTGOING_CHANGES="\uE1EC " # 
- #VCS_OUTGOING_CHANGES="\uE80E " # 
- VCS_OUTGOING_CHANGES="\uE132 " # 
- VCS_TAG_ICON="\uE817 " # 
- VCS_BOOKMARK_ICON="\uE87B" # 
- VCS_COMMIT_ICON="\uE821 " # 
- VCS_BRANCH_ICON="\uE220" # 
- VCS_REMOTE_BRANCH_ICON=" \uE804 " # 
- VCS_GIT_ICON="\uE20E " # 
- VCS_HG_ICON="\uE1C3 " # 
+ APPLE_ICON=$'\UF8FF' # 
+ FREEBSD_ICON=$'\U1F608 ' # 😈
+ LINUX_ICON=$'\U1F427 ' # 🐧
+ SUNOS_ICON=$'\U1F31E ' # 🌞
+ VCS_UNTRACKED_ICON="\UE16C" # 
+ VCS_UNSTAGED_ICON="\UE17C" # 
+ VCS_STAGED_ICON="\UE168" # 
+ VCS_STASH_ICON="\UE133 " # 
+ #VCS_INCOMING_CHANGES="\UE1EB " # 
+ #VCS_INCOMING_CHANGES="\UE80D " # 
+ VCS_INCOMING_CHANGES="\UE131 " # 
+ #VCS_OUTGOING_CHANGES="\UE1EC " # 
+ #VCS_OUTGOING_CHANGES="\UE80E " # 
+ VCS_OUTGOING_CHANGES="\UE132 " # 
+ VCS_TAG_ICON="\UE817 " # 
+ VCS_BOOKMARK_ICON="\UE87B" # 
+ VCS_COMMIT_ICON="\UE821 " # 
+ VCS_BRANCH_ICON=$'\UE220' # 
+ VCS_REMOTE_BRANCH_ICON=" \UE804 " # 
+ VCS_GIT_ICON="\UE20E " # 
+ VCS_HG_ICON="\UE1C3 " # 
;;
'compatible')
- LEFT_SEGMENT_SEPARATOR="\u2B80" # ⮀
- RIGHT_SEGMENT_SEPARATOR="\u2B82" # ⮂
- ROOT_ICON="\u26A1" # ⚡
+ LEFT_SEGMENT_SEPARATOR="\U2B80" # ⮀
+ RIGHT_SEGMENT_SEPARATOR="\U2B82" # ⮂
+ ROOT_ICON="\U26A1" # ⚡
RUBY_ICON=''
AWS_ICON="AWS:"
- BACKGROUND_JOBS_ICON="\u2699" # ⚙
+ BACKGROUND_JOBS_ICON="\U2699" # ⚙
TEST_ICON=''
- OK_ICON="\u2713" # ✓
- FAIL_ICON="\u2718" # ✘
+ OK_ICON="\U2713" # ✓
+ FAIL_ICON="\U2718" # ✘
SYMFONY_ICON="SF"
+ APPLE_ICON='OSX'
+ FREEBSD_ICON='BSD'
+ LINUX_ICON='Lx'
+ SUNOS_ICON='Sun'
VCS_UNTRACKED_ICON='?'
- VCS_UNSTAGED_ICON="\u25CF" # ●
- VCS_STAGED_ICON="\u271A" # ✚
- VCS_STASH_ICON="\u235F" # ⍟
- VCS_INCOMING_CHANGES="\u2193" # ↓
- VCS_OUTGOING_CHANGES="\u2191" # ↑
+ VCS_UNSTAGED_ICON="\U25CF" # ●
+ VCS_STAGED_ICON="\U271A" # ✚
+ VCS_STASH_ICON="\U235F" # ⍟
+ VCS_INCOMING_CHANGES="\U2193" # ↓
+ VCS_OUTGOING_CHANGES="\U2191" # ↑
VCS_TAG_ICON=''
- VCS_BOOKMARK_ICON="\u263F" # ☿
+ VCS_BOOKMARK_ICON="\U263F" # ☿
VCS_COMMIT_ICON=''
VCS_BRANCH_ICON='@'
- VCS_REMOTE_BRANCH_ICON="\u2192" # →
+ VCS_REMOTE_BRANCH_ICON="\U2192" # →
VCS_GIT_ICON='Git'
VCS_HG_ICON='HG'
;;
'awesome-patched')
# Awesome-Patched Font required!
# See https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
- LEFT_SEGMENT_SEPARATOR="\uE0B0" # 
- RIGHT_SEGMENT_SEPARATOR="\uE0B2" # 
- ROOT_ICON="\u26A1" # ⚡
- RUBY_ICON="\uE847" # 
- AWS_ICON="\uE895" # 
- BACKGROUND_JOBS_ICON="\uE82F " # 
- TEST_ICON="\uE891" # 
- OK_ICON="\u2713" # ✓
- FAIL_ICON="\u2718" # ✘
+ LEFT_SEGMENT_SEPARATOR="\UE0B0" # 
+ RIGHT_SEGMENT_SEPARATOR="\UE0B2" # 
+ ROOT_ICON="\U26A1" # ⚡
+ RUBY_ICON="\UE847" # 
+ AWS_ICON="\UE895" # 
+ BACKGROUND_JOBS_ICON="\UE82F " # 
+ TEST_ICON="\UE891" # 
+ OK_ICON="\U2713" # ✓
+ FAIL_ICON="\U2718" # ✘
SYMFONY_ICON="SF"
- VCS_UNTRACKED_ICON="\uE16C" # 
- VCS_UNSTAGED_ICON="\uE17C" # 
- VCS_STAGED_ICON="\uE168" # 
- VCS_STASH_ICON="\uE133 " # 
- #VCS_INCOMING_CHANGES="\uE1EB " # 
- #VCS_INCOMING_CHANGES="\uE80D " # 
- VCS_INCOMING_CHANGES="\uE131 " # 
- #VCS_OUTGOING_CHANGES="\uE1EC " # 
- #VCS_OUTGOING_CHANGES="\uE80E " # 
- VCS_OUTGOING_CHANGES="\uE132 " # 
- VCS_TAG_ICON="\uE817 " # 
- VCS_BOOKMARK_ICON="\uE87B" # 
- VCS_COMMIT_ICON="\uE821 " # 
- VCS_BRANCH_ICON="\uE220" # 
- VCS_REMOTE_BRANCH_ICON=" \uE804 " # 
- VCS_GIT_ICON="\uE20E " # 
- VCS_HG_ICON="\uE1C3 " # 
+ APPLE_ICON=$'\UF8FF' # 
+ FREEBSD_ICON=$'\U1F608 ' # 😈
+ LINUX_ICON=$'\U1F427 ' # 🐧
+ SUNOS_ICON=$'\U1F31E ' # 🌞
+ VCS_UNTRACKED_ICON="\UE16C" # 
+ VCS_UNSTAGED_ICON="\UE17C" # 
+ VCS_STAGED_ICON="\UE168" # 
+ VCS_STASH_ICON="\UE133 " # 
+ #VCS_INCOMING_CHANGES="\UE1EB " # 
+ #VCS_INCOMING_CHANGES="\UE80D " # 
+ VCS_INCOMING_CHANGES="\UE131 " # 
+ #VCS_OUTGOING_CHANGES="\UE1EC " # 
+ #VCS_OUTGOING_CHANGES="\UE80E " # 
+ VCS_OUTGOING_CHANGES="\UE132 " # 
+ VCS_TAG_ICON="\UE817 " # 
+ VCS_BOOKMARK_ICON="\UE87B" # 
+ VCS_COMMIT_ICON="\UE821 " # 
+ VCS_BRANCH_ICON=$'\UE220' # 
+ VCS_REMOTE_BRANCH_ICON=" \UE804 " # 
+ VCS_GIT_ICON="\UE20E " # 
+ VCS_HG_ICON="\UE1C3 " # 
;;
*)
# Powerline-Patched Font required!
# See https://github.com/Lokaltog/powerline-fonts
- LEFT_SEGMENT_SEPARATOR="\uE0B0" # 
- RIGHT_SEGMENT_SEPARATOR="\uE0B2" # 
- ROOT_ICON="\u26A1" # ⚡
+ LEFT_SEGMENT_SEPARATOR="\UE0B0" # 
+ RIGHT_SEGMENT_SEPARATOR="\UE0B2" # 
+ ROOT_ICON="\U26A1" # ⚡
RUBY_ICON=''
AWS_ICON="AWS:"
- BACKGROUND_JOBS_ICON="\u2699" # ⚙
+ BACKGROUND_JOBS_ICON="\U2699" # ⚙
TEST_ICON=''
- OK_ICON="\u2713" # ✓
- FAIL_ICON="\u2718" # ✘
+ OK_ICON="\U2713" # ✓
+ FAIL_ICON="\U2718" # ✘
SYMFONY_ICON="SF"
+ APPLE_ICON='OSX'
+ FREEBSD_ICON='BSD'
+ LINUX_ICON='Lx'
+ SUNOS_ICON='Sun'
VCS_UNTRACKED_ICON='?'
- VCS_UNSTAGED_ICON="\u25CF" # ●
- VCS_STAGED_ICON="\u271A" # ✚
- VCS_STASH_ICON="\u235F" # ⍟
- VCS_INCOMING_CHANGES="\u2193" # ↓
- VCS_OUTGOING_CHANGES="\u2191" # ↑
+ VCS_UNSTAGED_ICON="\U25CF" # ●
+ VCS_STAGED_ICON="\U271A" # ✚
+ VCS_STASH_ICON="\U235F" # ⍟
+ VCS_INCOMING_CHANGES="\U2193" # ↓
+ VCS_OUTGOING_CHANGES="\U2191" # ↑
VCS_TAG_ICON=''
- VCS_BOOKMARK_ICON="\u263F" # ☿
+ VCS_BOOKMARK_ICON="\U263F" # ☿
VCS_COMMIT_ICON=''
- VCS_BRANCH_ICON="\uE0A0 " # 
- VCS_REMOTE_BRANCH_ICON="\u2192" # →
+ VCS_BRANCH_ICON="\UE0A0 " # 
+ VCS_REMOTE_BRANCH_ICON="\U2192" # →
VCS_GIT_ICON=""
VCS_HG_ICON=""
;;
esac
+# OS detection for the `os_icon` segment
+case $(uname) in
+ Darwin) OS_ICON=$APPLE_ICON ;;
+ FreeBSD) OS_ICON=$FREEBSD_ICON ;;
+ OpenBSD) OS_ICON=$FREEBSD_ICON ;;
+ DragonFly) OS_ICON=$FREEBSD_ICON ;;
+ Linux) OS_ICON=$LINUX_ICON ;;
+ SunOS) OS_ICON=$SUNOS_ICON ;;
+ *) OS_ICON='' ;;
+esac
+
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
VCS_BRANCH_ICON=''
fi
@@ -217,8 +249,8 @@ zstyle ':vcs_info:*' enable git hg
zstyle ':vcs_info:*' check-for-changes true
VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%F{$VCS_FOREGROUND_COLOR}%b%c%u%m%f"
-zstyle ':vcs_info:git:*' formats "%F{$VCS_FOREGROUND_COLOR}$VCS_GIT_ICON%f$VCS_DEFAULT_FORMAT"
-zstyle ':vcs_info:hg:*' formats "%F{$VCS_FOREGROUND_COLOR}$VCS_HG_ICON%f$VCS_DEFAULT_FORMAT"
+zstyle ':vcs_info:git:*' formats "%F{$VCS_FOREGROUND_COLOR}$VCS_GIT_ICON%f$VCS_DEFAULT_FORMAT"
+zstyle ':vcs_info:hg:*' formats "%F{$VCS_FOREGROUND_COLOR}$VCS_HG_ICON%f$VCS_DEFAULT_FORMAT"
zstyle ':vcs_info:*' actionformats " %b %F{red}| %a%f"
@@ -253,7 +285,7 @@ fi
# The latter three can be omitted,
left_prompt_segment() {
# Overwrite given background-color by user defined variable for this segment.
- # We get as first Parameter the function name, which called this function.
+ # We get as first Parameter the function name, which called this function.
# From the given function name, we strip the "prompt_"-prefix and uppercase it.
# This is, prefixed with "POWERLEVEL9K_" and suffixed with either "_BACKGROUND"
# of "_FOREGROUND", our variable name. So each new Segment should automatically
@@ -337,7 +369,7 @@ prompt_vcs() {
function +vi-git-untracked() {
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \
- ${$(git ls-files --others --exclude-standard | sed q | wc -l)// /} != 0 ]]; then
+ -n $(git ls-files --others --exclude-standard | sed q) ]]; then
hook_com[unstaged]+=" %F{$VCS_FOREGROUND_COLOR}$VCS_UNTRACKED_ICON%f"
fi
}
@@ -427,7 +459,7 @@ CURRENT_BG='NONE'
# AWS Profile
prompt_aws() {
local aws_profile="$AWS_DEFAULT_PROFILE"
- if [[ -n "$aws_profile" ]];
+ if [[ -n "$aws_profile" ]];
then
$1_prompt_segment "$0" red white "$AWS_ICON $aws_profile"
fi
@@ -498,11 +530,16 @@ prompt_longstatus() {
prompt_node_version() {
local nvm_prompt=$(node -v 2>/dev/null)
[[ -z "${nvm_prompt}" ]] && return
- NODE_ICON=$'\u2B22' # ⬢
+ NODE_ICON=$'\U2B22' # ⬢
$1_prompt_segment "$0" "green" "white" "${nvm_prompt:1} $NODE_ICON"
}
+# print a little OS icon
+prompt_os_icon() {
+ $1_prompt_segment "$0" "008" "255" "$OS_ICON"
+}
+
# rbenv information
prompt_rbenv() {
if [[ -n "$RBENV_VERSION" ]]; then
@@ -655,8 +692,10 @@ $POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX"
RPROMPT_PREFIX=''
RPROMPT_SUFFIX=''
fi
- RPROMPT=$RPROMPT_PREFIX"%{%f%b%k%}"'$(build_right_prompt)'"%{$reset_color%}"$RPROMPT_SUFFIX
+ if [[ "$POWERLEVEL9K_DISABLE_RPROMPT" != true ]]; then
+ RPROMPT=$RPROMPT_PREFIX"%{%f%b%k%}"'$(build_right_prompt)'"%{$reset_color%}"$RPROMPT_SUFFIX
+ fi
}
powerlevel9k_init "$@"