From 3f074d5e984e379f518bbdb43a9b11d934781f6a Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Fri, 5 Jun 2015 17:17:35 -0700 Subject: [PATCH 1/6] README: Changes / reorg regarding new font options --- README.md | 89 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index dbcb14f6..c7fdb61d 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,12 @@ Here are some screenshots of `powerlevel9k` with default settings: ### Installation +There are three different forms of installation that you can use to make use of +this theme: -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)". +* Normal - Theme + Powerline Fonts +* Über - Theme + Awesome Powerline Fonts +* Bare Bones - Theme Only #### Install Powerlevel9k @@ -80,6 +82,60 @@ You then need to select this theme in your `~/.zshrc`: ZSH_THEME="powerlevel9k/powerlevel9k" + +#### Install Powerline Fonts for Normal Configuration + +You can find the [installation instructions for Powerline Fonts 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. + +This is the default mode for `Powerlevel9k`, and no further configuration is +necessary. + +#### Alternative Configuration: Über + +Alternatively, you can install [Awesome Powerline +Fonts](https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched), +which provide a number of additional glyphs. + +You then need to indicate that you wish to use the additional glyphs by defining +the following in your `~/.zshrc`: + + POWERLEVEL9K_MODE='awesome-patched' + +If you choose to make use of this, your prompt will look something like this: + +![](https://cloud.githubusercontent.com/assets/1544760/7959660/67612918-09fb-11e5-9ef2-2308363c3c51.png) + +Note that if you prefer flat segment transitions, you can use the following with +`Awesome Powerline Fonts` installed: + + POWERLEVEL9K_MODE='flat' + +Which looks like this: + +![](https://cloud.githubusercontent.com/assets/1544760/7981324/76d0eb5a-0aae-11e5-9608-d662123d0b0a.png) + +#### Alternative Configuration: Bare Bones + +This option is best if you prefer not to install additional fonts. This option +will work out-of-the-box if your your terminal font supports the segment +separator characters `\uE0B0` (left segment separator) and `\uE0B2` (right +segment separator). + +All you need to do to in this case is install the `Powerlevel9k` theme itself, +as explained above, and then define the following in your `~/.zshrc`: + + POWERLEVEL9K_MODE='compatible' + +Note that depending on your terminal font, this may still not render +appropriately. This configuration should be used as a back-up. + ### Segment Customization Customizing your prompt is easy! Select the segments you want to have displayed, @@ -158,10 +214,10 @@ Example: ##### Symbols 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. +These symbols depend on your installed font and selected `POWERLEVEL9K_MODE` +from the [Installation](#Installation) section above. -| `compatible` | `powerline-patched` | `awesome-patched` | explanation +| `Bare Bones` | `Normal` | `Über` | 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 @@ -181,27 +237,6 @@ set. 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 From 9a507fbdae016d1250f5a63c705361c207bee290 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Fri, 5 Jun 2015 17:26:00 -0700 Subject: [PATCH 2/6] Minor changes to docs in README and theme file. --- README.md | 4 ++-- powerlevel9k.zsh-theme | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c7fdb61d..e74adf7e 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ necessary. #### Alternative Configuration: Über Alternatively, you can install [Awesome Powerline -Fonts](https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched), -which provide a number of additional glyphs. +Fonts](https://github.com/gabrielelana/awesome-terminal-fonts), which provide +a number of additional glyphs. You then need to indicate that you wish to use the additional glyphs by defining the following in your `~/.zshrc`: diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index a02e9d4b..0fb515fe 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -46,11 +46,13 @@ 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. In case you +# 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 # `compatible`. This shows all icons in regular symbols. case $POWERLEVEL9K_MODE in 'flat') + # Awesome-Patched Font required! + # See https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched LEFT_SEGMENT_SEPARATOR='' RIGHT_SEGMENT_SEPARATOR='' ROOT_ICON="\uE801" #  @@ -103,7 +105,8 @@ case $POWERLEVEL9K_MODE in VCS_HG_ICON='HG' ;; 'awesome-patched') - # Awesome-Patched Font required! See https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/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" # ⚡ @@ -132,7 +135,8 @@ case $POWERLEVEL9K_MODE in VCS_HG_ICON="\uE1C3 " #  ;; *) - # Powerline-Patched Font required! See https://github.com/Lokaltog/powerline-fonts + # Powerline-Patched Font required! + # See https://github.com/Lokaltog/powerline-fonts LEFT_SEGMENT_SEPARATOR="\uE0B0" #  RIGHT_SEGMENT_SEPARATOR="\uE0B2" #  ROOT_ICON="\u26A1" # ⚡ From 86db2731886c6c8882cb6b3f1fd9c5bf94d94632 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 6 Jun 2015 18:18:35 +0200 Subject: [PATCH 3/6] Cleaned up whitespaces: Now the whitespaces are controlled by the functions that draw the segments (except vcs). This makes it more flexible, and you don't get unwanted whitespaces, when flipping segments from one side to another. --- powerlevel9k.zsh-theme | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index a02e9d4b..800faec9 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -263,22 +263,24 @@ left_prompt_segment() { [[ -n $2 ]] && bg="%K{$2}" || bg="%k" [[ -n $3 ]] && fg="%F{$3}" || fg="%f" if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then + # Middle segment echo -n "%{$bg%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR%{$fg%} " else + # First segment echo -n "%{$bg%}%{$fg%} " fi CURRENT_BG=$2 - [[ -n $4 ]] && echo -n $4 + [[ -n $4 ]] && echo -n "$4 " } # End the left prompt, closing any open segments left_prompt_end() { if [[ -n $CURRENT_BG ]]; then - echo -n " %{%k%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR" + echo -n "%{%k%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR" else - echo -n " %{%k%}" + echo -n "%{%k%}" fi - echo -n "%{%f%}" + echo -n "%{%f%} " CURRENT_BG='' } @@ -300,8 +302,8 @@ right_prompt_segment() { local bg fg [[ -n $2 ]] && bg="%K{$2}" || bg="%k" [[ -n $3 ]] && fg="%F{$3}" || fg="%f" - echo -n " %f%F{$2}$RIGHT_SEGMENT_SEPARATOR%f%{$bg%}%{$fg%} " - [[ -n $4 ]] && echo -n $4 + echo -n "%f%F{$2}$RIGHT_SEGMENT_SEPARATOR%f%{$bg%}%{$fg%} " + [[ -n $4 ]] && echo -n "$4 " } ################################################################ @@ -317,7 +319,7 @@ 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 } @@ -523,7 +525,7 @@ prompt_time() { time_format=$POWERLEVEL9K_TIME_FORMAT fi - $1_prompt_segment $0 $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$time_format " + $1_prompt_segment $0 $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR $time_format } # Virtualenv: current working virtualenv @@ -583,7 +585,7 @@ if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down else - PROMPT='%{%f%b%k%}$(build_left_prompt) ' + PROMPT='%{%f%b%k%}$(build_left_prompt)' RPROMPT_PREFIX='' RPROMPT_SUFFIX='' fi From 6a0925ac962d921d74577a1f2c09254178737977 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 6 Jun 2015 18:21:57 +0200 Subject: [PATCH 4/6] Updated TOC. --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e74adf7e..9da57cb8 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,20 @@ information in configurable prompt segments. - [Features](#features) - [Installation](#installation) - [Install Powerlevel9k](#install-powerlevel9k) + - [Install Powerline Fonts for Normal Configuration](#install-powerline-fonts-for-normal-configuration) + - [Alternative Configuration: Über](#alternative-configuration-%C3%BCber) + - [Alternative Configuration: Bare Bones](#alternative-configuration-bare-bones) - [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) + - [Unit Test Ratios](#unit-test-ratios) - [The 'vcs' Segment](#the-vcs-segment) - [Symbols](#symbols) - [Styling](#styling) - - [Fonts](#fonts) - [Double-Lined Prompt](#double-lined-prompt) - [Light Color Theme](#light-color-theme) + - [Further color customizations](#further-color-customizations) - [Troubleshooting](#troubleshooting) - [Gaps Between Segments](#gaps-between-segments) - [Contributions / Bugs / Contact](#contributions--bugs--contact) From 945412480ef05502ce14f716dd755860f1394ab8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 6 Jun 2015 19:38:20 +0200 Subject: [PATCH 5/6] Reordering code. --- powerlevel9k.zsh-theme | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d5ce60bb..34470e2a 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -40,10 +40,9 @@ # POWERLEVEL9K_COLOR_SCHEME='light' ################################################################ -# 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' +## Debugging +#zstyle ':vcs_info:*+*:*' debug true +#set -o xtrace # These characters require the Powerline fonts to work properly. If see boxes or # bizarre characters below, your fonts are not correctly installed. If you @@ -236,10 +235,6 @@ else zstyle ':vcs_info:*' use-simple true fi -## Debugging -#zstyle ':vcs_info:*+*:*' debug true -#set -o xtrace - ################################################################ # Prompt Segment Constructors ################################################################ @@ -411,6 +406,11 @@ function +vi-vcs-detect-changes() { # Prompt Segments ################################################################ +# 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' + # AWS Profile prompt_aws() { local aws_profile=$AWS_DEFAULT_PROFILE From 5592c90041c2791c4fa816d957a492ab6d2d71c6 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 8 Jun 2015 13:42:03 -0700 Subject: [PATCH 6/6] Removing the VCS_BRAND_INDICATOR by default --- powerlevel9k.zsh-theme | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 34470e2a..8055ce05 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -74,7 +74,8 @@ case $POWERLEVEL9K_MODE in VCS_TAG_ICON="\uE817 " #  VCS_BOOKMARK_ICON="\uE87B" #  VCS_COMMIT_ICON="\uE821 " #  - VCS_BRANCH_ICON=" \uE220" #  + #VCS_BRANCH_ICON=" \uE220" #  + VCS_BRANCH_ICON='' VCS_REMOTE_BRANCH_ICON="\uE804" #  VCS_GIT_ICON="\uE20E " #  VCS_HG_ICON="\uE1C3 " #  @@ -98,7 +99,8 @@ case $POWERLEVEL9K_MODE in VCS_TAG_ICON='' VCS_BOOKMARK_ICON="\u263F" # ☿ VCS_COMMIT_ICON='' - VCS_BRANCH_ICON='@' + #VCS_BRANCH_ICON='@' + VCS_BRANCH_ICON='' VCS_REMOTE_BRANCH_ICON="\u2192" # → VCS_GIT_ICON='Git' VCS_HG_ICON='HG' @@ -128,7 +130,8 @@ case $POWERLEVEL9K_MODE in VCS_TAG_ICON="\uE817 " #  VCS_BOOKMARK_ICON="\uE87B" #  VCS_COMMIT_ICON="\uE821 " #  - VCS_BRANCH_ICON=" \uE220" #  + #VCS_BRANCH_ICON=" \uE220" #  + VCS_BRANCH_ICON='' VCS_REMOTE_BRANCH_ICON="\uE804" #  VCS_GIT_ICON="\uE20E " #  VCS_HG_ICON="\uE1C3 " #  @@ -154,7 +157,8 @@ case $POWERLEVEL9K_MODE in VCS_TAG_ICON='' VCS_BOOKMARK_ICON="\u263F" # ☿ VCS_COMMIT_ICON='' - VCS_BRANCH_ICON='@' + #VCS_BRANCH_ICON='@' + VCS_BRANCH_ICON='' VCS_REMOTE_BRANCH_ICON="\u2192" # → VCS_GIT_ICON="\uE0A0" #  VCS_HG_ICON="\uE0A0" #  @@ -582,10 +586,11 @@ precmd() { if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then PROMPT='╭─%{%f%b%k%}$(build_left_prompt) ╰─ ' - # The right prompt should be on the same line as the first line of the left prompt. - # To do so, there is just a quite ugly workaround: Before zsh draws the RPROMPT, - # we advise it, to go one line up. At the end of RPROMPT, we advise it to go one - # line down. See http://superuser.com/questions/357107/zsh-right-justify-in-ps1 + # The right prompt should be on the same line as the first line of the left + # prompt. To do so, there is just a quite ugly workaround: Before zsh draws + # the RPROMPT, we advise it, to go one line up. At the end of RPROMPT, we + # advise it to go one line down. See: + # http://superuser.com/questions/357107/zsh-right-justify-in-ps1 RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down else