Skip to content

Instantly share code, notes, and snippets.

@csamuel
Forked from agnoster/README.md
Created September 19, 2012 02:57

Revisions

  1. @agnoster agnoster revised this gist Sep 14, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ A ZSH theme optimized for people who use:

    To test if your terminal and font support it, check that all the necessary characters are supported by copying the following command to your terminal: `echo "⮀ ± ⭠ ➦ ✔ ✘ ⚡"`. The result should look like this:

    ![Character Example](http://cl.ly/image/2l3w443z363P)
    ![Character Example](http://cl.ly/content/image/2l3w443z363P/aHR0cDovL2YuY2wubHkvaXRlbXMvM2ozTjJpMDMzTzJNM0ozcDFjMjgvU2NyZWVuJTIwU2hvdCUyMDIwMTItMDktMTQlMjBhdCUyMDEyLjA2LjAyJTIwLnBuZw==)

    ## What does it show?

  2. @agnoster agnoster revised this gist Sep 14, 2012. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,11 @@ A ZSH theme optimized for people who use:
    - Git
    - Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

    To test if your terminal and font support it, check that all the necessary characters are supported by copying the following command to your terminal: `echo "⮀±⭠ ➦✔✘⚡"`. The result should look like this:
    # Compatibility

    ![Character Example](http://cl.ly/image/3m3b0k2g2Y1A/Screen%20Shot%202012-09-14%20at%2012.01.14%20.png)
    To test if your terminal and font support it, check that all the necessary characters are supported by copying the following command to your terminal: `echo "⮀ ± ⭠ ➦ ✔ ✘ ⚡"`. The result should look like this:

    ![Character Example](http://cl.ly/image/2l3w443z363P)

    ## What does it show?

    @@ -29,4 +31,6 @@ I don't want to clutter it up too much, but I am toying with the idea of adding

    It's currently hideously slow, especially inside a git repo. I guess it's not overly so for comparable themes, but it bugs me, and I'd love to hear ideas about how to improve the performance.

    Would be nice for the code to be a bit more sane and re-usable. Something to easily append a section with a given FG/BG, and add the correct opening and closing.
    Would be nice for the code to be a bit more sane and re-usable. Something to easily append a section with a given FG/BG, and add the correct opening and closing.

    Apparently the unicode characters don't display correctly on all systems. It would be nice to be able to say "this font will make it work, always". But what font?
  3. @agnoster agnoster revised this gist Sep 14, 2012. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,10 @@ A ZSH theme optimized for people who use:
    - Git
    - Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

    To test if your terminal and font support it, check that all the necessary characters are supported by copying the following command to your terminal: `echo "⮀±⭠ ➦✔✘⚡"`. The result should look like this:

    ![Character Example](http://cl.ly/image/3m3b0k2g2Y1A/Screen%20Shot%202012-09-14%20at%2012.01.14%20.png)

    ## What does it show?

    - Success (✔) or failure (✘) of previous command
    @@ -25,4 +29,4 @@ I don't want to clutter it up too much, but I am toying with the idea of adding

    It's currently hideously slow, especially inside a git repo. I guess it's not overly so for comparable themes, but it bugs me, and I'd love to hear ideas about how to improve the performance.

    Would be nice for the code to be a bit more sane and re-usable. Something to easily append a section with a given FG/BG, and add the correct opening and closing.
    Would be nice for the code to be a bit more sane and re-usable. Something to easily append a section with a given FG/BG, and add the correct opening and closing.
  4. @agnoster agnoster revised this gist Sep 13, 2012. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -22,3 +22,7 @@ A ZSH theme optimized for people who use:
    ## Future Work

    I don't want to clutter it up too much, but I am toying with the idea of adding RVM (ruby version) and n (node.js version) display.

    It's currently hideously slow, especially inside a git repo. I guess it's not overly so for comparable themes, but it bugs me, and I'd love to hear ideas about how to improve the performance.

    Would be nice for the code to be a bit more sane and re-usable. Something to easily append a section with a given FG/BG, and add the correct opening and closing.
  5. @agnoster agnoster revised this gist Sep 13, 2012. 1 changed file with 24 additions and 0 deletions.
    24 changes: 24 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # agnoster.zsh-theme

    A ZSH theme optimized for people who use:

    - Solarized
    - Git
    - Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

    ## What does it show?

    - Success (✔) or failure (✘) of previous command
    - Hostname
    - Git status
    - Branch (⭠) or detached head (➦)
    - Current branch / SHA1 in detached head state
    - Dirty working directory (±, color change)
    - Working directory
    - Elevated (root) privileges (⚡)

    ![Screenshot](https://gist.github.com/raw/3712874/de4828056ec1f04b03dbf4940f1b61e525ec9799/screenshot.png)

    ## Future Work

    I don't want to clutter it up too much, but I am toying with the idea of adding RVM (ruby version) and n (node.js version) display.
  6. @agnoster agnoster revised this gist Sep 13, 2012. 1 changed file with 0 additions and 0 deletions.
    Binary file added screenshot.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  7. @agnoster agnoster created this gist Sep 13, 2012.
    27 changes: 27 additions & 0 deletions agnoster.zsh-theme
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # https://github.com/agnoster zsh theme

    ZSH_THEME_GIT_PROMPT_DIRTY='±'

    function _git_prompt_info() {
    ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="$(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
    echo "${ref/refs\/heads\//⭠ }$(parse_git_dirty)"
    }

    function _git_info() {
    if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
    local BG_COLOR=green
    if [[ -n $(parse_git_dirty) ]]; then
    BG_COLOR=yellow
    fi
    echo "%{%K{$BG_COLOR}%}⮀%{%F{black}%} $(_git_prompt_info) %{%F{$BG_COLOR}%K{blue}%}⮀"
    else
    echo "%{%K{blue}%}⮀"
    fi
    }

    PROMPT_HOST='%{%b%F{gray}%K{black}%} %(?.%{%F{green}%}✔.%{%F{red}%}✘)%{%F{gray}%} %m %{%F{black}%}'
    PROMPT_DIR='%{%F{white}%} %1~ '
    PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}⮀%{%F{yellow}%} ⚡ %{%k%F{black}%}.%{%k%F{blue}%})⮀%{%f%k%b%}'

    PROMPT='%{%f%b%k%}
    $PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU '