diff options
-rw-r--r-- | README.md | 57 | ||||
-rw-r--r-- | powerlevel9k.zsh-theme | 20 |
2 files changed, 53 insertions, 24 deletions
@@ -44,7 +44,8 @@ like with a normal installation and default settings: - [Styling](#styling) - [Double-Lined Prompt](#double-lined-prompt) - [Light Color Theme](#light-color-theme) - - [Further color customizations](#further-color-customizations) + - [Segment Color Customization](#segment-color-customization) + - [Special Segment Colors](#special-segment-colors) - [Troubleshooting](#troubleshooting) - [Gaps Between Segments](#gaps-between-segments) - [Meta](#meta) @@ -343,6 +344,12 @@ Here is what it looks like: ![](http://bhilburn.org/content/images/2015/03/double-line.png) +You can customize the icons used to draw the multiline prompt by setting the +following variables in your `~/.zshrc`: + + POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="↱" + POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX="↳ " + #### Light Color Theme If you prefer to use "light" colors, simply set `POWERLEVEL9K_COLOR_SCHEME` @@ -355,20 +362,36 @@ Light'](https://github.com/altercation/solarized) users. Check it out: ![](http://bhilburn.org/content/images/2015/03/solarized-light.png) -#### Further color customizations +#### Segment Color Customization For each segment in your prompt, you can specify a foreground and background -color by setting them in your `~/.zshrc`. For example, to change the appearance -of the `time` segment, you would use: +color by setting them in your `~/.zshrc`. Use the segment names from the above +section `Segment Customization`. For example, to change the appearance of the +`time` segment, you would use: POWERLEVEL9K_TIME_FOREGROUND='red' POWERLEVEL9K_TIME_BACKGROUND='blue' -Use the segment names from the above section `Segment Customization`. Some of -the Segments have special color variables, as they change the colors according -to some internal rules. These Segments are `vcs`, `rspec_stats`, `symfony2_tests`: +Note that you can also use a colorcode value. Example: + + POWERLEVEL9K_VCS_FOREGROUND='021' # Dark blue + +For a full list of supported colors, run the `spectrum_ls` program in your +terminal. + +#### Special Segment Colors - # General VCS color segments: +Some segments have additional color options if you want to customize the look of +your prompt even further. These Segments are `context`, `vcs`, `rspec_stats`, +`symfony2_tests`: + + # Customizing `context` colors for root and non-root users + POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND="green" + POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="cyan" + POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND="red" + POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND="blue" + + # Advanced `vcs` color customization POWERLEVEL9K_VCS_FOREGROUND='blue' POWERLEVEL9K_VCS_DARK_FOREGROUND='black' POWERLEVEL9K_VCS_BACKGROUND='green' @@ -396,13 +419,6 @@ to some internal rules. These Segments are `vcs`, `rspec_stats`, `symfony2_tests POWERLEVEL9K_SYMFONY2_TESTS_BAD_FOREGROUND='red' POWERLEVEL9K_SYMFONY2_TESTS_BAD_BACKGROUND='white' -You could also use a colorcode value. Example: - - POWERLEVEL9K_VCS_FOREGROUND='021' # Dark blue - -For a full list of supported colors, run the `spectrum_ls` program in your -terminal. - ### Troubleshooting Here are some fixes to some common problems. @@ -421,9 +437,12 @@ terminal emulator (e.g., 'terminator', 'gnome-terminal', 'konsole', etc.,). #### Kudos -This theme wouldn't have happened without inspiration from the original [agnoster](https://gist.github.com/agnoster/3712874) Oh-My-ZSH theme. +This theme wouldn't have happened without inspiration from the original +[agnoster](https://gist.github.com/agnoster/3712874) Oh-My-ZSH theme. -Before creating this theme, I also tried [jeremyFreeAgent's theme](https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme) and [maverick2000's theme, ZSH2000](https://github.com/maverick2000/zsh2000). +Before creating this theme, I also tried [jeremyFreeAgent's +theme](https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme) and +[maverick2000's theme, ZSH2000](https://github.com/maverick2000/zsh2000). #### Developing @@ -435,7 +454,9 @@ wiki](https://github.com/bhilburn/powerlevel9k/wiki/Developer's-Guide). If you have any requests or bug reports, please use the tracker in this Github repository. -I'm happy to accept code contributions from anyone who has a bug fix, new feature, or just a general improvement! Please submit your contribution as a Github pull-request. +I'm happy to accept code contributions from anyone who has a bug fix, new +feature, or just a general improvement! Please submit your contribution as +a Github pull-request. If you would like to contact me directly, you can find my e-mail address on my [Github profile page](https://github.com/bhilburn). diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c2ad0303..dbfc60c8 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -76,7 +76,7 @@ case $POWERLEVEL9K_MODE in VCS_BOOKMARK_ICON="\uE87B" # VCS_COMMIT_ICON="\uE821 " # VCS_BRANCH_ICON="\uE220" # - VCS_REMOTE_BRANCH_ICON="\uE804" # + VCS_REMOTE_BRANCH_ICON=" \uE804 " # VCS_GIT_ICON="\uE20E " # VCS_HG_ICON="\uE1C3 " # ;; @@ -132,7 +132,7 @@ case $POWERLEVEL9K_MODE in VCS_BOOKMARK_ICON="\uE87B" # VCS_COMMIT_ICON="\uE821 " # VCS_BRANCH_ICON="\uE220" # - VCS_REMOTE_BRANCH_ICON="\uE804" # + VCS_REMOTE_BRANCH_ICON=" \uE804 " # VCS_GIT_ICON="\uE20E " # VCS_HG_ICON="\uE1C3 " # ;; @@ -437,7 +437,12 @@ prompt_aws() { # Note that if $DEFAULT_USER is not set, this prompt segment will always print prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - $1_prompt_segment "$0" "$DEFAULT_COLOR" "011" "%(!.%{%F{yellow}%}.)$USER@%m" + if [[ $(print -P "%#") == '#' ]]; then + # Shell runs as root + $1_prompt_segment "$0_ROOT" "$DEFAULT_COLOR" "yellow" "$USER@%m" + else + $1_prompt_segment "$0_DEFAULT" "$DEFAULT_COLOR" "011" "$USER@%m" + fi fi } @@ -482,7 +487,7 @@ 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" } @@ -622,8 +627,11 @@ powerlevel9k_init() { add-zsh-hook precmd vcs_info if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then - PROMPT="╭─%{%f%b%k%}"'$(build_left_prompt)'" -╰─ " + [[ -n $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX ]] || POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="╭─" + [[ -n $POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX ]] || POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX="╰─ " + + PROMPT="$POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX%{%f%b%k%}"'$(build_left_prompt)'" +$POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX" # 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 |