diff options
-rw-r--r-- | README.md | 32 | ||||
-rw-r--r-- | powerlevel9k.zsh-theme | 40 |
2 files changed, 48 insertions, 24 deletions
@@ -46,7 +46,9 @@ like with a normal installation and default settings: - [Further color customizations](#further-color-customizations) - [Troubleshooting](#troubleshooting) - [Gaps Between Segments](#gaps-between-segments) -- [Contributions / Bugs / Contact](#contributions--bugs--contact) +- [Meta](#meta) + - [Kudos](#kudos) + - [Contributions / Bugs / Contact](#contributions--bugs--contact) <!-- END doctoc generated TOC please keep comment here to allow auto update --> @@ -136,9 +138,12 @@ You then need to select this theme in your `~/.zpreztorc`: If you prefer [antigen](https://github.com/zsh-users/antigen), just add this theme to the antigen config in your `~/.zshrc`: - $ echo 'antigen theme /vagrant_data powerlevel9k' >> ~/.zshrc + $ echo 'antigen theme bhilburn/powerlevel9k powerlevel9k' >> ~/.zshrc $ echo 'antigen apply' >> ~/.zshrc +Note that you should define any customizations before calling `antigen theme` +(i.e. setting the `POWERLEVEL9K_*` variables) in your `.zshrc`. + #### Step 2: Install Powerline Fonts Technically, you don't *have* to install Powerline fonts. If you are using a font that has some of the basic glyphs we need, you can use the theme in @@ -222,6 +227,7 @@ currently available are: * **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. * **symfony2_tests** - Show a ratio of test classes vs code classes for Symfony2. +* **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * **time** - System time. * **virtualenv** - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). * **vcs** - Information about this `git` or `hg` repository (if you are in one). @@ -275,14 +281,19 @@ By default, the `vcs` segment will provide quite a bit of information. If you would also like for it to display the current hash / changeset, simply define `POWERLEVEL9K_SHOW_CHANGESET` in your `~/.zshrc`. If activated, it will show the first 12 characters of the changeset id. To change the amount of characters, -set `POWERLEVEL9K_CHANGESET_HASH_LENTH` to any value you want. -Example: +set `POWERLEVEL9K_CHANGESET_HASH_LENGTH` to any value you want. # enable the vcs segment in general POWERLEVEL9K_SHOW_CHANGESET=true # just show the 6 first characters of changeset POWERLEVEL9K_CHANGESET_HASH_LENGTH=6 +You can also enable an additional branch icon in your prompt by setting +`POWERLEVEL9K_SHOW_BRANCH_ICON` to `true`: + + # Show an icon before the branch name + POWERLEVEL9K_SHOW_BRANCH_ICON=true + ##### Symbols The `vcs` segment uses various symbols to tell you the state of your repository. @@ -395,13 +406,20 @@ 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.,). -### Contributions / Bugs / Contact +### Meta + +#### Kudos + +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). + +#### Contributions / Bugs / Contact 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 an 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 1ebc31bb..83d7314c 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -61,6 +61,7 @@ case $POWERLEVEL9K_MODE in TEST_ICON="\uE891" # OK_ICON="\u2713" # ✓ FAIL_ICON="\u2718" # ✘ + SYMFONY_ICON="SF" VCS_UNTRACKED_ICON="\uE16C" # VCS_UNSTAGED_ICON="\uE17C" # VCS_STAGED_ICON="\uE168" # @@ -74,8 +75,7 @@ case $POWERLEVEL9K_MODE in VCS_TAG_ICON="\uE817 " # VCS_BOOKMARK_ICON="\uE87B" # VCS_COMMIT_ICON="\uE821 " # - #VCS_BRANCH_ICON=" \uE220" # - VCS_BRANCH_ICON='' + VCS_BRANCH_ICON=" \uE220" # VCS_REMOTE_BRANCH_ICON="\uE804" # VCS_GIT_ICON="\uE20E " # VCS_HG_ICON="\uE1C3 " # @@ -90,6 +90,7 @@ case $POWERLEVEL9K_MODE in TEST_ICON='' OK_ICON="\u2713" # ✓ FAIL_ICON="\u2718" # ✘ + SYMFONY_ICON="SF" VCS_UNTRACKED_ICON='?' VCS_UNSTAGED_ICON="\u25CF" # ● VCS_STAGED_ICON="\u271A" # ✚ @@ -99,8 +100,7 @@ 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' @@ -117,6 +117,7 @@ case $POWERLEVEL9K_MODE in TEST_ICON="\uE891" # OK_ICON="\u2713" # ✓ FAIL_ICON="\u2718" # ✘ + SYMFONY_ICON="SF" VCS_UNTRACKED_ICON="\uE16C" # VCS_UNSTAGED_ICON="\uE17C" # VCS_STAGED_ICON="\uE168" # @@ -130,8 +131,7 @@ case $POWERLEVEL9K_MODE in VCS_TAG_ICON="\uE817 " # VCS_BOOKMARK_ICON="\uE87B" # VCS_COMMIT_ICON="\uE821 " # - #VCS_BRANCH_ICON=" \uE220" # - VCS_BRANCH_ICON='' + VCS_BRANCH_ICON=" \uE220" # VCS_REMOTE_BRANCH_ICON="\uE804" # VCS_GIT_ICON="\uE20E " # VCS_HG_ICON="\uE1C3 " # @@ -148,6 +148,7 @@ case $POWERLEVEL9K_MODE in TEST_ICON='' OK_ICON="\u2713" # ✓ FAIL_ICON="\u2718" # ✘ + SYMFONY_ICON="SF" VCS_UNTRACKED_ICON='?' VCS_UNSTAGED_ICON="\u25CF" # ● VCS_STAGED_ICON="\u271A" # ✚ @@ -157,14 +158,17 @@ 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" # ;; esac +if [[ "$POWERLEVEL9K_SHOW_BRANCH_ICON" != true ]]; then + VCS_BRANCH_ICON='' +fi + ################################################################ # color scheme ################################################################ @@ -221,7 +225,8 @@ zstyle ':vcs_info:*' actionformats " %b %F{red}| %a%f" zstyle ':vcs_info:*' stagedstr " %F{$VCS_FOREGROUND_COLOR}$VCS_STAGED_ICON%f" 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 +zstyle ':vcs_info:git*+set-message:*' hooks vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname +zstyle ':vcs_info:hg*+set-message:*' hooks vcs-detect-changes # For Hg, only show the branch name zstyle ':vcs_info:hg*:*' branchformat "$VCS_BRANCH_ICON%b" @@ -510,6 +515,14 @@ prompt_symfony2_tests() { fi } +# Symfony2-Version +prompt_symfony2_version() { + if [[ -f app/bootstrap.php.cache ]]; then + local symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g') + $1_prompt_segment "$0" "240" "$DEFAULT_COLOR" "$SYMFONY_ICON $symfony2_version" + fi +} + # Show a ratio of tests vs code build_test_stats() { local code_amount="$3" @@ -575,13 +588,6 @@ build_right_prompt() { done } -prompt_powerlevel9k_precmd() { - vcs_info - - # Add a static hook to examine staged/unstaged changes. - vcs_info_hookadd set-message vcs-detect-changes -} - powerlevel9k_init() { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS @@ -593,7 +599,7 @@ powerlevel9k_init() { # initialize VCS autoload -Uz add-zsh-hook - add-zsh-hook precmd prompt_powerlevel9k_precmd + add-zsh-hook precmd vcs_info if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then PROMPT="╭─%{%f%b%k%}"'$(build_left_prompt)'" |