diff options
-rw-r--r-- | README.md | 89 | ||||
-rw-r--r-- | powerlevel9k.zsh-theme | 166 |
2 files changed, 202 insertions, 53 deletions
@@ -9,6 +9,30 @@ Look like a bad-ass. Impress everyone in 'Screenshot Your Desktop' threads. Use In addition to looking amazing, this theme actually provides a lot of useful information in configurable prompt segments. +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Features](#features) +- [Installation](#installation) + - [Install Powerlevel9k](#install-powerlevel9k) +- [Segment Customization](#segment-customization) + - [The AWS Profile Segment](#the-aws-profile-segment) + - [The 'context' Segment](#the-context-segment) + - [Test ratio](#test-ratio) + - [The 'time' segment](#the-time-segment) + - [The 'vcs' Segment](#the-vcs-segment) + - [Symbols](#symbols) +- [Styling](#styling) + - [Fonts](#fonts) + - [Double-Lined Prompt](#double-lined-prompt) + - [Light Color Theme](#light-color-theme) +- [Troubleshooting](#troubleshooting) + - [Gaps Between Segments](#gaps-between-segments) +- [Contributions / Bugs / Contact](#contributions--bugs--contact) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + ### Features * Supports `git` and `mercurial` repo information through ZSH's `VCS_INFO`: @@ -40,19 +64,9 @@ Here are some screenshots of `powerlevel9k` with default settings: ### Installation -There are two things you need to make this theme work correctly: Powerline -fonts, and the theme itself. - -#### Install Powerline Fonts -First, you need to install Powerline Fonts. You can find the [installation -instructions -here](https://powerline.readthedocs.org/en/latest/installation/linux.html#fonts-installation). -You can also find the raw font files [in this Github -repository](https://github.com/powerline/fonts) if you want to manually install -them for your OS. - -After you have installed Powerline fonts, make the default font in your terminal -emulator the Powerline font you want to use. +You just need to install the theme and set `POWERLEVEL9K_MODE='compatible'` +to join the experience. If you want to customize your experience even further +read the chapter about "[fonts](#fonts)" or about "[segment customization](#segment-customization)". #### Install Powerlevel9k @@ -143,22 +157,51 @@ Example: ##### Symbols -The `vcs` segment uses various symbols to tell you the state of your repository: - -* `↑4` - The number of commits your repository is ahead of your remote branch -* `↓5` - The number of commits your repository is behind of your remote branch -* `⍟3` - The number of stashes, here 3. -* `●` - There are unstaged changes in your working copy -* `✚` - There are staged changes in your working copy -* `?` - There are files in your working copy, that are unknown to your repository -* `→` - The name of your branch differs from its tracking branch. -* `☿` - A mercurial bookmark is active. +The `vcs` segment uses various symbols to tell you the state of your repository. +These symbols depend on your installed [Font](#fonts) and your `POWERLEVEL9K_MODE` +set. + +| `compatible` | `powerline-patched` | `awesome-patched` | explanation +|--------------|---------------------|-------------------|-------------------------- +| `↑4` | `↑4` | ![icon_outgoing](https://cloud.githubusercontent.com/assets/1544760/7976089/b5904d6e-0a76-11e5-8147-5e873ac52d79.gif)4 | Number of commits your repository is ahead of your remote branch +| `↓5` | `↓5` | ![icon_incoming](https://cloud.githubusercontent.com/assets/1544760/7976091/b5909c9c-0a76-11e5-9cad-9bf0a28a897c.gif)5 | Number of commits your repository is behind of your remote branch +| None | `⍟3` | ![icon_stash](https://cloud.githubusercontent.com/assets/1544760/7976094/b5ae9346-0a76-11e5-8cc7-e98b81824118.gif)3 | Number of stashes, here 3. +| `●` | `●` | ![icon_unstaged](https://cloud.githubusercontent.com/assets/1544760/7976096/b5aefa98-0a76-11e5-9408-985440471215.gif) | There are unstaged changes in your working copy +| `✚` | `✚` | ![icon_staged](https://cloud.githubusercontent.com/assets/1544760/7976095/b5aecc8a-0a76-11e5-8988-221afc6e8982.gif) | There are staged changes in your working copy +| `?` | `?` | ![icon_untracked](https://cloud.githubusercontent.com/assets/1544760/7976098/b5c7a2e6-0a76-11e5-8c5b-315b595b2bc4.gif) | There are files in your working copy, that are unknown to your repository +| `→` | `→` | ![icon_remote_tracking_branch](https://cloud.githubusercontent.com/assets/1544760/7976093/b5ad2c0e-0a76-11e5-9cd3-62a077b1b0c7.gif) | The name of your branch differs from its tracking branch. +| None | `☿` | ![icon_bookmark](https://cloud.githubusercontent.com/assets/1544760/7976197/546cfac6-0a78-11e5-88a6-ce3a1e0a174e.gif) | A mercurial bookmark is active. +| `@` | ![icon_branch_powerline](https://cloud.githubusercontent.com/assets/1544760/8000852/e7e8d8a0-0b5f-11e5-9834-de9b25c92284.gif) | ![](https://cloud.githubusercontent.com/assets/1544760/7976087/b58bbe3e-0a76-11e5-8d0d-7a5c1bc7f730.gif) | Branch Icon +| None | None | ![icon_commit](https://cloud.githubusercontent.com/assets/1544760/7976088/b58f4e50-0a76-11e5-9e70-86450d937030.gif)2c3705 | The current commit hash. Here "2c3705" +| None | None | ![icon_git](https://cloud.githubusercontent.com/assets/1544760/7976092/b5909f80-0a76-11e5-9950-1438b9d72465.gif) | Repository is a git repository +| None | None | ![icon_mercurial](https://cloud.githubusercontent.com/assets/1544760/7976090/b5908da6-0a76-11e5-8c91-452b6e73f631.gif) | Repository is a Mercurial repository ### Styling You can configure the look and feel of your prompt easily with some built-in options. +#### Fonts + +If you set `POWERLEVEL9K_MODE='compatible'` you just get a little glimpse of +the beauty of this theme. + +To get nicer Icons you need to install a [powerline-patched](https://github.com/Lokaltog/powerline-fonts) font. +In your terminal emulator you need to select this font and in your `~/.zshrc` you need +to set `POWERLEVEL9K_MODE='powerline-patched'`. +You can find the [installation instructions here](https://powerline.readthedocs.org/en/latest/installation/linux.html#fonts-installation). +You can also find the raw font files [in this Github repository](https://github.com/powerline/fonts) if you want to manually install them for your OS. +Screenshot: +![](http://bhilburn.org/content/images/2015/01/pl9k-improved.png) + +If even these Icons did not impress you, have a look at `POWERLEVEL9K_MODE='awesome-patched'`. +For this mode, you have to install a [awesome-patched](https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched) font and set the according mode. +Screenshot: +![](https://cloud.githubusercontent.com/assets/1544760/7959660/67612918-09fb-11e5-9ef2-2308363c3c51.png) + +If you prefer segements as rectangles, just set `POWERLEVEL9K_MODE='flat'`, but +beware: You still need a [awesome-patched](https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched) font. + #### Double-Lined Prompt By default, `powerlevel9k` is a single-lined prompt. If you would like to have diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index df0319c7..04e7183d 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -8,9 +8,6 @@ # # The `vcs_info` hooks in this file are from Tom Upton: # https://github.com/tupton/dotfiles/blob/master/zsh/zshrc -# -# In order for this theme to render correctly, you will need a Powerline-patched font: -# https://github.com/Lokaltog/powerline-fonts ################################################################ ################################################################ @@ -49,11 +46,117 @@ 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. -LEFT_SEGMENT_SEPARATOR='' -RIGHT_SEGMENT_SEPARATOR='' -VCS_UNSTAGED_ICON='●' -VCS_STAGED_ICON='✚' +# bizarre characters below, your fonts are not correctly installed. In case you +# do not want to install a special font, you can set `POWERLEVEL9K_MODE` to +# `compatible`. This shows all icons in regular symbols. +case $POWERLEVEL9K_MODE in + 'flat') + 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" # ✘ + 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='*R*' + RUBY_ICON='' + AWS_ICON="AWS:" + BACKGROUND_JOBS_ICON="\u2699" # ⚙ + TEST_ICON='' + OK_ICON='' + FAIL_ICON='x' + VCS_UNTRACKED_ICON='?' + VCS_UNSTAGED_ICON="\u25CF" # ● + VCS_STAGED_ICON="\u271A" # ✚ + VCS_STASH_ICON='' + VCS_INCOMING_CHANGES="\u2193" # ↓ + VCS_OUTGOING_CHANGES="\u2191" # ↑ + VCS_TAG_ICON='' + VCS_BOOKMARK_ICON='' + VCS_COMMIT_ICON='' + VCS_BRANCH_ICON='@' + 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" # ✘ + 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" # ⚡ + RUBY_ICON='' + AWS_ICON="AWS:" + BACKGROUND_JOBS_ICON="\u2699" # ⚙ + TEST_ICON='' + OK_ICON="\u2713" # ✓ + FAIL_ICON="\u2718" # ✘ + VCS_UNTRACKED_ICON='?' + 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_COMMIT_ICON='' + VCS_BRANCH_ICON='@' + VCS_REMOTE_BRANCH_ICON="\u2192" # → + VCS_GIT_ICON="\uE0A0" # + VCS_HG_ICON="\uE0A0" # + ;; +esac ################################################################ # color scheme @@ -97,13 +200,16 @@ if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH fi - VCS_CHANGESET_PREFIX="%F{$VCS_FOREGROUND_COLOR_DARK}%0.$VCS_CHANGESET_HASH_LENGTH""i@%f" + VCS_CHANGESET_PREFIX="%F{$VCS_FOREGROUND_COLOR_DARK}$VCS_COMMIT_ICON%0.$VCS_CHANGESET_HASH_LENGTH""i%f" fi zstyle ':vcs_info:*' enable git hg zstyle ':vcs_info:*' check-for-changes true -zstyle ':vcs_info:*' formats " $VCS_CHANGESET_PREFIX%F{$VCS_FOREGROUND_COLOR}%b%c%u%m%f" +local 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:*' actionformats " %b %F{red}| %a%f" zstyle ':vcs_info:*' stagedstr " %F{$VCS_FOREGROUND_COLOR}$VCS_STAGED_ICON%f" @@ -112,7 +218,7 @@ zstyle ':vcs_info:*' unstagedstr " %F{$VCS_FOREGROUND_COLOR}$VCS_UNSTAGED_ICON%f zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-stash git-remotebranch git-tagname # For Hg, only show the branch name -zstyle ':vcs_info:hg*:*' branchformat "%b" +zstyle ':vcs_info:hg*:*' branchformat "$VCS_BRANCH_ICON%b" # The `get-revision` function must be turned on for dirty-check to work for Hg zstyle ':vcs_info:hg*:*' get-revision true zstyle ':vcs_info:hg*:*' get-bookmarks true @@ -211,14 +317,14 @@ prompt_vcs() { $1_prompt_segment $0 green $DEFAULT_COLOR fi - echo -n "%F{$VCS_FOREGROUND_COLOR}%f$vcs_prompt" + echo -n "%F{$VCS_FOREGROUND_COLOR}%f$vcs_prompt" fi } 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 | tr -d ' ') != 0 ]]; then - hook_com[unstaged]+=" %F{$VCS_FOREGROUND_COLOR}?%f" + hook_com[unstaged]+=" %F{$VCS_FOREGROUND_COLOR}$VCS_UNTRACKED_ICON%f" fi } @@ -231,12 +337,12 @@ function +vi-git-aheadbehind() { # for git prior to 1.7 # ahead=$(git rev-list origin/${branch_name}..HEAD | wc -l) ahead=$(git rev-list ${branch_name}@{upstream}..HEAD 2>/dev/null | wc -l | tr -d ' ') - (( $ahead )) && gitstatus+=( " %F{$VCS_FOREGROUND_COLOR}↑${ahead// /}%f" ) + (( $ahead )) && gitstatus+=( " %F{$VCS_FOREGROUND_COLOR}$VCS_OUTGOING_CHANGES${ahead// /}%f" ) # for git prior to 1.7 # behind=$(git rev-list HEAD..origin/${branch_name} | wc -l) behind=$(git rev-list HEAD..${branch_name}@{upstream} 2>/dev/null | wc -l | tr -d ' ') - (( $behind )) && gitstatus+=( " %F{$VCS_FOREGROUND_COLOR}↓${behind// /}%f" ) + (( $behind )) && gitstatus+=( " %F{$VCS_FOREGROUND_COLOR}$VCS_INCOMING_CHANGES${behind// /}%f" ) hook_com[misc]+=${(j::)gitstatus} } @@ -248,12 +354,12 @@ function +vi-git-remotebranch() { remote=${$(git rev-parse --verify HEAD@{upstream} --symbolic-full-name 2>/dev/null)/refs\/(remotes|heads)\/} branch_name=${$(git symbolic-ref --short HEAD 2>/dev/null)} - hook_com[branch]="%F{$VCS_FOREGROUND_COLOR}${hook_com[branch]}%f" + hook_com[branch]="%F{$VCS_FOREGROUND_COLOR}$VCS_BRANCH_ICON${hook_com[branch]}%f" # Always show the remote #if [[ -n ${remote} ]] ; then # Only show the remote if it differs from the local if [[ -n ${remote} && ${remote#*/} != ${branch_name} ]] ; then - hook_com[branch]+="%F{$VCS_FOREGROUND_COLOR}→%f%F{$VCS_FOREGROUND_COLOR}${remote// /}%f" + hook_com[branch]+="%F{$VCS_FOREGROUND_COLOR}$VCS_REMOTE_BRANCH_ICON%f%F{$VCS_FOREGROUND_COLOR}${remote// /}%f" fi } @@ -261,7 +367,7 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - [[ -n ${tag} ]] && hook_com[branch]=" %F{$VCS_FOREGROUND_COLOR}${tag}%f" + [[ -n ${tag} ]] && hook_com[branch]=" %F{$VCS_FOREGROUND_COLOR}$VCS_TAG_ICON${tag}%f" } # Show count of stashed changes @@ -271,13 +377,13 @@ function +vi-git-stash() { if [[ -s $(git rev-parse --git-dir)/refs/stash ]] ; then stashes=$(git stash list 2>/dev/null | wc -l) - hook_com[misc]+=" %F{$VCS_FOREGROUND_COLOR}⍟${stashes// /}%f" + hook_com[misc]+=" %F{$VCS_FOREGROUND_COLOR}$VCS_STASH_ICON${stashes// /}%f" fi } function +vi-hg-bookmarks() { if [[ -n "${hgbmarks[@]}" ]]; then - hook_com[hg-bookmark-string]=" ☿ ${hgbmarks[@]}" + hook_com[hg-bookmark-string]=" %F{$VCS_FOREGROUND_COLOR}$VCS_BOOKMARK_ICON${hgbmarks[@]}%f" # And to signal, that we want to use the sting we just generated, # set the special variable `ret' to something other than the default @@ -304,7 +410,7 @@ prompt_aws() { local aws_profile=$AWS_DEFAULT_PROFILE if [[ -n $aws_profile ]]; then - $1_prompt_segment $0 red white "AWS: $aws_profile" + $1_prompt_segment $0 red white "$AWS_ICON $aws_profile" fi } @@ -337,12 +443,12 @@ prompt_longstatus() { symbols+="%{%F{"226"}%}%? ↵" bg="009" else - symbols+="%{%F{"046"}%}✓" + symbols+="%{%F{"046"}%}$OK_ICON" bg="008" fi - [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" + [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%} $ROOT_ICON" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$BACKGROUND_JOBS_ICON" [[ -n "$symbols" ]] && $1_prompt_segment $0 $bg $DEFAULT_COLOR "$symbols" } @@ -360,7 +466,7 @@ prompt_rspec_stats() { local code_amount=$(ls -1 app/**/*.rb | wc -l) local tests_amount=$(ls -1 spec/**/*.rb | wc -l) - build_test_stats $1 $0 $code_amount $tests_amount "RSpec" + build_test_stats $1 $0 $code_amount $tests_amount "RSpec $TEST_ICON" fi } @@ -369,7 +475,7 @@ prompt_rvm() { local rvm_prompt rvm_prompt=`rvm-prompt` if [ "$rvm_prompt" != "" ]; then - $1_prompt_segment $0 "240" $DEFAULT_COLOR "$rvm_prompt " + $1_prompt_segment $0 "240" $DEFAULT_COLOR "$rvm_prompt $RUBY_ICON " fi } @@ -378,9 +484,9 @@ prompt_rvm() { prompt_status() { local symbols symbols=() - [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" - [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" + [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$FAIL_ICON" + [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%} $ROOT_ICON" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$BACKGROUND_JOBS_ICON" [[ -n "$symbols" ]] && $1_prompt_segment $0 $DEFAULT_COLOR default "$symbols" } @@ -391,7 +497,7 @@ prompt_symfony2_tests() { local code_amount=$(ls -1 src/**/*.php | grep -v Tests | wc -l) local tests_amount=$(ls -1 src/**/*.php | grep Tests | wc -l) - build_test_stats $1 $0 $code_amount $tests_amount "SF2-Tests" + build_test_stats $1 $0 $code_amount $tests_amount "SF2 $TEST_ICON" fi } |