Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
My ZSH Theme


A ZSH theme optimized for people who use:

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

For Mac users, I highly recommend iTerm 2 + Solarized Dark


NOTE: In all likelihood, you will need to install a Powerline-patched font for this theme to render correctly.

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 "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699". The result should look like this:

Character Example

What does it show?

  • If the previous command failed (✘)
  • User @ Hostname (if user is not DEFAULT_USER, which can then be set in your profile)
  • Git status
    • Branch () or detached head (➦)
    • Current branch / SHA1 in detached head state
    • Dirty working directory (±, color change)
  • Working directory
  • Elevated (root) privileges (⚡)


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.

Also the dependency on a powerline-patched font is regrettable, but there's really no way to get that effect without it. Ideally there would be a way to check for compatibility, or maybe even fall back to one of the similar unicode glyphs.

# vim:ft=zsh ts=2 sw=2 sts=2
# agnoster's Theme -
# A Powerline-inspired theme for ZSH
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](
# In addition, I recommend the
# [Solarized theme]( and, if you're
# using it on Mac OS X, [iTerm 2]( over -
# it has significantly better color fidelity.
# # Goals
# The aim of this theme is to only show you *relevant* information. Like most
# prompts, it will only show git information when in a git working directory.
# However, it goes a step further: everything from the current user and
# hostname to whether the last call exited with an error to whether background
# jobs are running in this shell will all be displayed automatically when
# appropriate.
### Segment drawing
# A few utility functions to make it easy and re-usable to draw segmented prompts
# Characters
# Begin a segment
# Takes two arguments, background and foreground. Both can be omitted,
# rendering default background/foreground.
prompt_segment() {
local bg fg
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
print -n "%{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%}"
print -n "%{$bg%}%{$fg%}"
[[ -n $3 ]] && print -n $3
# End the prompt, closing any open segments
prompt_end() {
if [[ -n $CURRENT_BG ]]; then
print -n "%{%k%}"
print -n "%{%f%}"
### Prompt components
# Each component will draw itself, and hide itself if no information needs to be shown
# Context: user@hostname (who am I and where am I)
prompt_context() {
local user=`whoami`
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CONNECTION" ]]; then
prompt_segment $PRIMARY_FG default " %(!.%{%F{yellow}%}.)$user@%m "
# Git: branch/detached head, dirty status
prompt_git() {
local color ref
is_dirty() {
test -n "$(git status --porcelain --ignore-submodules)"
if [[ -n "$ref" ]]; then
if is_dirty; then
ref="${ref} $PLUSMINUS"
ref="${ref} "
if [[ "${ref/.../}" == "$ref" ]]; then
ref="$BRANCH $ref"
ref="$DETACHED ${ref/.../}"
prompt_segment $color $PRIMARY_FG
print -Pn " $ref"
# Dir: current working directory
prompt_dir() {
prompt_segment blue $PRIMARY_FG ' %~ '
# Status:
# - was there an error
# - am I root
# - are there background jobs?
prompt_status() {
local symbols
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$CROSS"
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}$LIGHTNING"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$GEAR"
[[ -n "$symbols" ]] && prompt_segment $PRIMARY_FG default " $symbols "
## Main prompt
prompt_agnoster_main() {
prompt_agnoster_precmd() {
PROMPT='%{%f%b%k%}$(prompt_agnoster_main) '
prompt_agnoster_setup() {
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
prompt_opts=(cr subst percent)
add-zsh-hook precmd prompt_agnoster_precmd
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes false
zstyle ':vcs_info:git*' formats '%b'
zstyle ':vcs_info:git*' actionformats '%b (%a)'
prompt_agnoster_setup "$@"

This looks awesome - great job. I'd love to use it but I'm not using OMZ anymore (using Prezto now). Might have to look into retro-fitting your theme. :)

tjdett commented Sep 19, 2012

The first and third glyphs don't appear to be standard unicode, and aren't present in either Bitstream Vera or Deja Vu. Looks like this is set to be an Mac-only theme.

Screenshots look great though.

Love this theme.
I already use Menlo as my iTerm2 Font but the first an third character doesn't seem to work.
Any solutions?

jtheoof commented Sep 19, 2012

Same as tjdett and npostular.
I'm using Ubuntu Monospace and the > don't show up properly.
Any thing you could do ?

Same here.

Linuus commented Sep 19, 2012

Using ZSH and Menlo on OSX. The same problem with the 1st and 3rd glyphs. Too bad, it looked like a sweet theme :(

Linuus commented Sep 19, 2012

Same issue here. OSX, ZSH and Menlo font.

Linuus commented Sep 19, 2012

Maybe this character can be made to work?

Linuus commented Sep 19, 2012

Yep, seems broken :(

(My comments doesn't show up! ARGH!)

Linuus commented Sep 19, 2012

To make special characters work you need a Powerline patched font:

@agnoster Could you share your iTerm2 profile?

Linuus commented Sep 19, 2012

You need a Powerline patched font to make the glyphs work:

+1 I'm using Ubuntu Monospace and the > don't show up properly.

Linuus commented Sep 19, 2012

You need a Powerline patched font.

brkattk commented Sep 19, 2012

Please share your profile. Wondering how you got these special characters to show up properly

It's a the patched Menlo Powerline font.

Thanks! Awesome.
I was interested in your profile also for the color palette...

Oh! My fault :)
I guess that I have to thank you also for making me discover Solarized, now!


agnoster commented Sep 25, 2012

Oh my. I guess I need to update this with the proper prerequisites... hehe. Didn't get any notifications about all the comments!

Will update with the latest version and better details about what you need to use it.


agnoster commented Sep 25, 2012

It looks like the main issue people were having was with the Powerline-specific glyphs - I had installed these earlier and forgotten that there was that prereq. I've now put a clear link in the README and in a comment on the theme itself, hopefully that should remove the biggest stumbling block.

Linuus commented Sep 26, 2012

Anyone else has issues with the color of the glyphs? Some of them are not rendering in the same color for me.


Linuus commented Sep 26, 2012

Anyone else has issues with the color of the glyphs? Some of them are not rendering in the same color for me.


To1ne commented Sep 28, 2012

Why do I get an empty line between each prompt?
empty line between prompts

To1ne commented Sep 28, 2012

For some reason github made the link invalid:


agnoster commented Sep 28, 2012

@To1ne Looks like you have an older version of the theme, which put lines between each entry because... well, I thought it looked better. I've since changed my opinion ;-)


agnoster commented Sep 28, 2012

@jeremyFreeAgent Indeed! I like the look of your theme, too - a bit fancier with the right prompt for date/time, might have to borrow that for mine. Though I do like keeping it minimal...

adben commented Oct 1, 2012

What is the plugin that you use for the colorized unix-command highlight?

azmodude commented Oct 2, 2012

Very stylish and informative theme - thanks a lot for it!

jeroenh commented Oct 2, 2012

I'm getting errors in the git part of the prompt:
prompt_git:4: command not found: parse_git_dirty

Is there something missing there?

Linuus commented Oct 2, 2012

@adben It's called "zsh-syntax-highlighting" I believe.

Anyone know why I get the color mismatch I wrote about above?

(Sorry that so many comments was added by me. Apparently github flagged me as spam by mistake which prevented my comments to show up at first)

zoomix commented Oct 3, 2012

Loved the theme. Although I use the solarized light color scheme. I fiddled with it a bit and came up with this . You wanna 'support' it? =)

jeromegn commented Oct 7, 2012

Is there a way to remove the duplicate git information on the far right? Is that a plugin I'm using or something? I looked at my config, can't find how to disable it.

jeromegn commented Oct 7, 2012

Nevermind, seems like it was a quirk from zsh, from my old theme.


agnoster commented Oct 8, 2012

@jeromegn Yeah, it doesn't explicitly set an RPROMPT, meaning if you had one from a previous theme it'll linger. The advantage is you can put whatever you want in there without messing with the theme ;-)


agnoster commented Oct 8, 2012

@jeroenh parse_git_dirty is included in oh_my_zsh - this version of the prompt depends upon it. I also have a prezto-based version that doesn't rely on any special stuff, but haven't had a chance to publish yet. Short version is, the prompt in its current form probably works best if you have OMZ installed.

@Linuus I am also getting the color mismatch when using, but not using iTerm2. Hope that helps...

rue commented Oct 16, 2012

Similar problem to that of @Linuus, except the special chars are white; the segment arrows, the x for nonzero exit etc. I’ll have to grab a shot of it tomorrow. Ideas, @agnoster? Might be some weirdness with iterm2/solarized, but both should be newest versions…

rue commented Oct 17, 2012

And here, different scheme showing that the colors work somewhat:

rue commented Oct 17, 2012

…And solved, it was the contrast setting. Have to have it set to minimum contrast in iterm2.

rdrey commented Oct 21, 2012

@rue Thanks, I must have also messed with the contrast setting. Now it's pretty! :D

lmorency commented Nov 1, 2012

Same problem here in iTerm2 under OS X 10.8 with Menlo font, ZSH and OH My ZSH ! The 1st and 3rd glyphs are not showing.

achikin commented Nov 17, 2012

Hi! Commands like sudo, kill and others are not shown in green for me. Please have a look what I mean

achikin commented Nov 17, 2012

PS. I use iTerm2 with the latest Solarized.

I know how to fix 1st and 3rd glyphs issue: iTerm2 - Preferences - Profiles - YOUR_PROFILE - Colors - Minimum Contrast - set to Low.

lenpr commented Nov 26, 2012

the last update messed up the theme and replaced the local settings with one of the developers… I am talking to you ~/carlos user ;p

boxofrox commented Dec 2, 2012

Anyone find a way to get Powerline to work on xTerm/uxTerm under Linux?

boxofrox commented Dec 2, 2012

Meh, forgot to mention. I installed "Menlo for Powerline" font in my ~/.fonts. The segment arrow appears in GVIM, but not in uxTerm :/

kalkin commented Dec 2, 2012

First of all i have to thank you. After seeing your prompt i finally started to write my own.

If you want to improove the performance, do it the right way ;). Use vcs_info and conditions in the prompt. I have no performance problems and i have a big config. See also for the prompt.

dorafmon commented Dec 6, 2012

can I have the hex value of the background thanks

dorafmon commented Dec 6, 2012

Also can I have the item 2 profile

Question: how do you get the binary to color in green ? Is it in the theme (if so I do not understand where) or is it an extra plugin ?

I can't get the ✘ to show up when an command fails. It just prints 127 in red. Thoughts?

shellbj commented Dec 21, 2012

@cunningham: If you are using the stock OMZ theme of the same name it is different from the gist version. The ✘ was removed in favor of the error codes you are now seeing. You can create a custom theme to add it back.

marr commented Jan 13, 2013

When in low contrast mode using solarized, all the comments disappear in vim. Im using Menlo for Powerline for my iTerm2 fonts. Also in your twitter screenshot you have white inside the blue path area, mine is more like the screenshots above but i'd like to use white there.

marr commented Jan 13, 2013

With contrast turned up a little so I can see comments:
And the comment problem with the contrast all the way down:

The comments are the same color as the background in solarized vim, I have no clue how to fix this.

Don't know if anyone else have this problem, but when I try to use auto complete my cursor jumps around. I have created a fork where I fixed this.

I added a simple function to show code to spec ratio. I'm very new of zsh, so tips are greatly appreciated.

prompt_rspec_stats() {
  if [[ (-a config/application.rb) ]]; then
    local app=`wc -l app/**/*.rb | grep -oE "[0-9]+" | tail -n 1`
    local spec=`wc -l spec/**/*.rb | grep -oE "[0-9]+" | tail -n 1`

    prompt_segment cyan black "$app:$spec"

I tried showing the actual ratio, but I wasn't able to figure out how to round the float.

One great condition for git is if told how long since last commit. I remember using a diff. theme that offered that functionality, especially useful when it changed colors from green to yellow to red as the time since last commit increased.

Updated it to look for app/spec folders and vary background colors based on ratio.

prompt_rspec_stats() {
  if [[ (-d app && -d spec) ]]; then
    local app=`wc -l app/**/*.rb | grep -oE "[0-9]+" | tail -n 1`
    local spec=$((`wc -l spec/**/*.rb | grep -oE "[0-9]+" | tail -n 1`))+0.01
    local ratio=`printf "%.2f\n" $((spec/app))`

    [[ ratio -ge 0.75 ]] && prompt_segment cyan black "$ratio"
    [[ ratio -ge 0.5 && ratio -lt 0.75 ]] && prompt_segment yellow black "$ratio"
    [[ ratio -lt 0.5 ]] && prompt_segment red black "$ratio"

Ping @agnoster.

Anrock commented Feb 20, 2013

Can't make it work with urxvt - it shows boxes instead of 2b80(first) and 2b60(third) symbols. Works fine with gnome-terminal, though. I suppose it's the urxvt-specific problem. Did someone make it work as it should be?

deiga commented Mar 8, 2013

I don't quite understand the reasoning behind this theme. Couldn't one just use powerline? Or are there some serious pros to using this? What would the cons be?

eailfly commented Mar 20, 2013

Hi,guys.I think I found a way to show 2b80(first) and 2b60(third) in xterm, just use "xterm -cjk_width".For other term,see if your term support CJK characters.

dpsk commented Apr 4, 2013

Can't make it work on os x with the patched fonts, 1st and 3rd symbols are looking messy :( Any hints?

it doesn’t work anymore with the newest version of powerline. also, one should rather use fontconfig instead of patching fonts: that’s both easier and more future-proof (if e.g. a new source code pro version is realeased, you don’t have to update your patched version manually)

ploddi commented May 20, 2013

Can you add support for remote branch status? Function added in pull request robbyrussell/oh-my-zsh#253

Gets really bad with tmux or gnu screen

I noticed commenters on bad glyphs. I'm on Linux/urxvt with that issue. Powerline changed code points - see the red warning box at

So any powerline font patches using code points lower than U+E0A0 is now stale. E.g. the article and git sources from
...has glyphs messed up this way, with the same (wrong) code points as here, U+2B80 and U+2B60 I think.

If some people with offerings on github still use older patched fonts (i.e. wrong code points), then it would explain a lot. The test from flying-sheep just above is correct.

I wonder also on Macintosh/Linux mismatch. Much powerline stuff comes from Mac people. I'm unclear what encodings they post on github. Sometimes I see 7-bit, sometimes UTF-8, etc. A linguist wrote helpful tools for inspecting encodings in detail (straight C with no outside dependencies),

atuttle commented Jul 5, 2013

Latest iTerm update seems to have broken the glyphs. Was fine until the update. OSX 10.7.5. Any thoughts?

xbot commented Jul 6, 2013

Arrow symbols are displayed as boxes in rxvt-unicode, gnome-terminal works fine, but I only love rxvt-unicode, I am very very sad.

@atuttle same problem here. did you manage to fix it?

bbshih commented Jul 7, 2013

@atuttle @NicosKaralis I deleted and reinstalled the powerline fonts and then selected the powerline font as the Regular and Non-ASCII font. It works now. It seems to have separated it out the powerline sybmols into the Non-ASCII font setting.

@atuttle and @bbshih i just updated my file agnoster.zsh-theme the file i had on my computer had 172 lines, the latest version has only 115

this fixed my problem

ce6n commented Jul 8, 2013

For me it was the change of codepoints, as @DaveC0DE mentioned.
I had to change line 29 and 82 in the agnoster.zsh-theme file.

kzahel commented Jul 10, 2013

@NicosKaralis Also seeing the broken glyphs. I'm seeing agnoster.zsh-theme still has 172 SLOC. My remote origin is github robbyrussel/oh-my-zsh.git, where is the updated oh-my-zsh? I tried updating some powerline fonts but that didn't do the trick.

gabetax commented Jul 12, 2013

I'm using Monaco, and the newer patched font available at Lokaltog/powerline-fonts#16 works for me with the changes to powerline and the corresponding changes in this theme.

However, I was using RPROMPT='%*' (timestamp), and the last two characters of the RPROMPT are wrapping onto the second line when I'm in a git repo. I'm suspecting that by moving the locations of these glyphs, something is no longer counting them as characters when determining where to place the RPROMPT. Any ideas?

atuttle commented Jul 18, 2013

Updating my agnoster.zsh-theme fixed it for me, no need to muck with fonts.

my $USER@$HOSTHAME is still showing up. everything else is working fine! any ideas on how to fix this?

@notbieber If you set this in your ~/.zshrc file, it will remove the user@host prefix:

export $DEFAULT_USER="my_username"

If you want the theme to show the prefix only when on a remote server, add a line using this conditional instead:

[[ -n "$SSH_CLIENT" ]] || export DEFAULT_USER="my_username"

Thanks @bbshih, setting the non-ascii font to the same as the regular font fixed my glyph encoding issue

On Mountain Lion, updating to latest agnoster theme (115 LOC version) fixed the glyph issues for me.

Hi @davertron. I aslo use the Mountain Lion 10.8.4 with the 172 LOC version and it works. But the 115 LOC version seems out of work. Like the 1st and 3rd glyph issues. But echo -e "\ue0a0\ue0a1\ue0a2\ue0b0\ue0b1\ue0b2" works out.

Thanks, @blackrobot

export $DEFAULT_USER="my_username"

might be

export DEFAULT_USER="my_username"

Changed the line 29 (verison 172 lines) to SEGMENT_SEPARATOR='⮀' (see source code at page begin) worked for me, a box was displayed instead of the arrow...

juanfe commented Sep 22, 2013

For Debian, I use Oh-my-zsh [0], I install fontconfig package, and follow the instrucction on [1], downloading 10-powerline-symbols.conf from the repo [2], and after that I change the line 66 where say black, y change by yellow, and is awesome! If I change something else, may be I will make a new branch!


If you still want to add RVM to this prompt, I wrote this some days ago to know instantly if I was using my default ruby or one set up by RVM:

prompt_rubyver() {
  if [[ -n "$RUBY_VERSION" ]]; then
    RUBY_VER=`echo $RUBY_VERSION | cut -d'-' -f2`
    prompt_segment red black "v"$RUBY_VER
# Call it from build_prompt in your preferred order.

Result when going to a folder with a .rvmrc file


  • I use RUBY_VERSION because it's set by the .rvmrc when cd-ing and applies to subfolders too. Looking up recursively in parents folder for a .rvmrc was just too much.
  • If you have a RUBY_VERSION in you classic env, the ruby version will be displayed all the time.
  • I only got one folder using a custom ruby, so I'd like for people who use dozens of ruby at the same time to correct anything that's wrong with this approach.

andion commented Nov 4, 2013

@joshleaves you can also use rvm-prompt

"$(~/.rvm/bin/rvm-prompt i v p g s)"
  • If you use the s option it will return 'system' if you are using your system ruby.
  • It also returns a unique one-unicode-char representation of the ruby you are using with the u option (Useful to make a compact prompt if you have a long list of installed rubies :)

bcbcarl commented Nov 5, 2013

No 256-color under Cygwin.

JonDum commented Nov 10, 2013

Is there anyway to basename the working directory prompt? I have very nested structures and the prompt takes 80% of my window.

I see how it's making it in the prompt_dir() function, but I don't know how the ~ is expanding into the pwd, nor do I understand how I would encapsulate the basename

Edit: nevermind figured it out. I changed '%~' to '%2d' to show only 2 directories worth of context.

oli commented Nov 19, 2013

re: the changes after updating to the latest version of this theme, for me L29 → SEGMENT_SEPARATOR='\ue0b0' and L82 → echo -n "${ref/refs\/heads\//\ue0a0 }$dirty" did the trick.

I customized the final prompt to add a newline:

%% '

However, a deeply nested folder’s path will cause the first line of the prompt to wrap, and the rest of this line to inherit the prompt’s background color (blue, or the repo status color). I tried adding %{$reset_color%} in various places but had no luck. If any zsh pros can give me some advice:

  • How can I reset the background color for a multiline prompt?
  • How would I trim the path in the center to prevent it being longer than the window width? For example, ~/Sites/…/parent-directory/present-working-directory, where replaces one or more sections of the path to keep the prompt from wrapping?


I use Terminator on Arch Linux and already installed a Powerline patched font, but the arrow symbols are still displayed as boxes :

Vim with Powerline color scheme in Terminator :

lzdhlsc commented Dec 9, 2013

@wenLiangcan try "Inconsolata for Powerline" for none ascii.

@wenligancan I had the same issue on Arch some time ago.
Installingttf-powerline-fonts-gitand using this fork worked for me.

The glyphs / fonts work fine for me on iTerm 2, what doesn't show up for me is parts of the interface, i.e. the "arrowish bars".

Basically the bars are just straight with no arrows. All the glyphs do however print out when I do the test above.

deKilla commented Jan 21, 2014

If you're having Problems with the "⮀" not showing, you might want to edit the ~/.oh-my-zsh/themes/agnoster.zsh-theme.

In line 29 there is the SEGMENT_SEPARATOR ... that showed the same weird symbol that i had in the shell (logically) so by replacing it with the desired arrow, i got it to work. You can use the arrow I pasted - works just fine for me.

Hope this helps anybody :)

EDIT: on second view i saw some other wrong symbols as well, so you might just replace the whole zsh-theme with this:

I started using this theme today and I noticed some problems with tab-completion, that seem to be related with the prompt:

More specifically, assume I have a variable BLAH="/usr/blah/blah".

When, from my prompt I type

cd $BLAH/[tab]

the line becomes the following:

cd $BLAH//usr/blah/blah

instead of

cd /usr/blah/blah

This was not happening before. Any idea how I can fix this?

Is it possible to have a symbol that indicates if there are stashed items? I keep forgetting there's something in the stash, meaning having to waste time figuring out if the changes are still needed a few days later...

Thank you very much, this theme is awesome!
But i have some trouble, then my git working directory is clean, it still show ± instead of branch symbol.
The rest works fine.
Can somebody help me with this?

P.S echo "<2b80> ± <2b60> ➦ ✔ ✘ ⚡" works correctly, OS Kubuntu 13.10.

cdarken commented Feb 26, 2014

I have the same problem as sarkisn, I'm on LinuxMint 16. It doesn't work with konsole, terminator. It works on my laptop in Ubuntu 13.04.

Thanks to @NicosKaralis, my problem solved. @cdarken just replace your agnoster.zsh-theme file, with this.

@agnoster, in your screenshot you ssh milly. Do you have your remote server set up with zsh/oh-my-zsh/agnoster-theme or how do you get a prompt like that?

elauqsap commented Apr 8, 2014

I cant seem to get the same color scheme in iTerm2, any ideas or could someone link me to the iTerm presets that he is using?

Thanks in advance!

Love this theme. Just merged a pull request to add git visualization for merging, rebasing, and bisecting modes.
Here are the new identifiers:

<B> signifies Bisecting Mode
>M< signifies Merging Mode
>R> signifies Rebasing Mode

Pull request: robbyrussell/oh-my-zsh#2633

In Ubuntu 14.04, using the default terminal, I had to copy paste the first and third special characters in the theme file because they weren't recognized properly (rectangle and chinese character). Hope this help!

Guys i use iTerm2 with Solarized color sheme. Bat i have a problems with this theme. I install neccesary fonts and turn it in iTerm profile (mensch-Powerline)

What did I do wrong?

nmn commented May 6, 2014

I have the same problem

Dietr1ch commented May 8, 2014

I think you can drop the machine name when you are on your machine.

Regarding fonts, the thing being left out and might be confusing people is that you have to choose the font for your term emulator.

The link that @MarcoSero provided has a great collection of patched/modded fonts.

Just download the main zip file, extract, and copy the fonts to ~/.fonts (make it if necessary).
Then simply run 'fc-cache' and you should have it working just fine.

I fixed the two glyphs to match the current powerline font encodings (as have several folks above), but here it is as a fork of this gist:

lfilho commented Jun 3, 2014

@digitalformula it does work on prezto (but you probably wanted to hear that sometime sooner than 2 years after your comment, right? 😄 )

Thanks for this gist, @agnoster. Using it :) But maybe you could think about organizing it a bit more like jeremyFreeAgent's one? His looks reallys extensible and configurable! 😍

@ifilho This works on prezto? I get an error prompt_git:4: command not found: parse_git_dirty

I've gone through all the comments from the past 2 years and I still have this problem:

alt text

  • I have downloaded and installed many different powerline fonts from many repositories.
  • I have replaced the agnoster.zsh-theme file with this one and others that have been suggested.
  • I'm using iTerm2 on Mac OSX 10.9.3.
  • Solarized theme installed.

What's going on? Does anyone have an up to date run down of all the different components that work together? I mean, is it a specific combination or something?

@igneosaur: I use the same setup, and it works for me, finally. The gotcha you need to look out for, is to set up iTerm2 to use the Powerline-font as both the Regular Font and Non-ASCII Font.

Hope this helps! :)

FYI, I created a fork of this theme allowing to display remote tracking branch infos (commits ahead/behind remote tracking branch)

Fork is there

Screenshot : agnoster-fcamblor

Hello, I've created a theme based heavily on this one and jeremyFreeAgent's adding the ability to configure all the components via ~/.zshrc flags as well as these additional ones:

  1. rvm-prompt
  2. time
  3. more git info



Check it out here

@igneosaur I have a same problem as you. Have find a way out? The way to use the Powerline-font as both the Regular Font and Non-ASCII Font same like not very helpful.


agnoster commented Aug 25, 2014

I just updated the theme to work with the latest version of the Powerline fonts and pointed to the correct versions. There are a few other minor changes that should make the theme a little faster.

What I'd like to have longer-term is the ability for different plugins to hook in so you can essentially configure your prompt to show a series of independent modules. That might help with all the forks to do one specific thing differently ;-)

You you also update the theme to work with Mercurial I get a bunch of weird characters instead of the nice powerline ones. :(

@MunchyYDL: your tip already made my day. Thanks a lot

@mgbellaire you can comment the line prompt_context at the very end

daidais commented Feb 20, 2015

For Ubuntu users you need to install powerline

sudo apt-get install powerline

@MunchyYDL Your comment helps me a lot! Thanks ^_^

I created another Powerline-based theme, based on agnoster's work with a number of updated features and speed improvements. Check it out, here:

I love this theme! Is it possible to only print the current directory name instead of the full path? This becomes a mess with long path names... :)

vgorloff commented May 8, 2015

Seems ok .) iTerm2 + Menlo for Powerline (from here on OS X.

Dammit. Even after looking through this thread, it's still displaying $USER@$HOSTHAME. Anyone get this resolved?

Yeah, for me this line works: [[ -n "$SSH_CLIENT" ]] || export DEFAULT_USER="username"

First to the author and the supporters, if any, thank you for providing awesome open source software. Your efforts are appreciated. Please anyone correct me if I'm wrong. I may be hallucinating, but I thought that the
'X' that appears when the prompt is first delivered at the time the terminal opens was always apparent. I realize this is counter intuitive, but its been a long year! Any comment would be appreciated. I see the screen shots do not have the "X" following command execution.

I'm not entirely sure what I'm doing wrong, but I'm not getting the prompt that is show in all the screenshots. I'm running Mac OSX 10.10.4 (14E26a) and that is in iTerm 2. This is what mine looks like:



If anyone wants chruby ruby version here's an easy way. It'll show if chruby has been used, and hide if it's fallen back to the system ruby.

install the chruby plugin.

zgen oh-my-zsh plugins/chruby

then add this:

prompt_chruby() {
  local ruby=`current_ruby`
  if [[ -n "$ruby" ]] && [[ $ruby != "system" ]] && prompt_segment cyan $PRIMARY_FG " $ruby "

and modify the prompt_agnoster_main() from this gist to add it in:

## Main prompt
prompt_agnoster_main() {

chruby prompt

@adriandeveloper Seems that you missed this:

Optionally set DEFAULT_USER in ~/.zshrc to your regular username to hide the “user@hostname” info when you’re logged in as yourself on your local machine.

I've installed the fonts but when running the echo test some character is missing:

echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
 ±  ➦ ✘ ⚡ ⚙

Any idea? Thanks... :)

I'm facing the same problem here too.

solved! After instaling Powerline-patched font (as sugested) and change font to "Anonymous Pro for Poweline" in my terminal application fix the problem!

I fixed my iTerm2 setup. The font needs to be set in the Prefs > Profiles > Text > Non-ASCII Font


I added a new file into my custom directory that said

prompt_dir() {
  prompt_segment blue $PRIMARY_FG ' %2d '

But I still get the very long working directory prompt instead of the last 2 directories.

Anyone figure out how to change this without editing the theme itself?

BTW %2~ is better than %2d if you want to see ~ instead of ahogan (or your username) when you are at ~

Loved the theme. very nice

@ccharlton 's solution works for me

fcpwiz commented Aug 28, 2015

For some reason, when I'm connected to a server via SSH, no colors or special formatting is used. How do I fix this?


jurf commented Aug 30, 2015

@agnoster Could you please optimize your theme a bit for solarized light? E.g. setting the font colour in the prompt by the bg would help a lot. If you want, I can make a PR for this.


I'm using zsh with agnoster theme on my OSX.

On my Windows, i've ssh-ed in to OSX machine i got this error. (I've tried ssh to an Ubuntu server with zsh and agnoster theme also but everything work fine)

Both of oh-my-zsh has been updated to latest version!


I may have found a bug on line 69 of your theme
the -n "$SSH_CLIENT" part of the if statement ( in the function prompt_context() ) will not be reached as as both root and my own user account $DEFAULT_USER empty
this will cause "$USER" != "$DEFAULT_USER" to always be true

I found this as I was trying to make the prompt different for a SSH login. I am still debating if I should add a character or a different color for the user/machine name.

Eriner commented Sep 30, 2015

small patch to remove the use of backticks. The syntax $(COMMAND) is much preferred.

diff --git a/agnoster.zsh-theme.orig b/agnoster.zsh-theme
index 9304556..e2cc83a 100644
--- a/agnoster.zsh-theme.orig
+++ b/agnoster.zsh-theme
@@ -69,7 +69,7 @@ prompt_end() {

 # Context: user@hostname (who am I and where am I)
 prompt_context() {
-  local user=`whoami`
+  local user=$(whoami)

   if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CONNECTION" ]]; then
     prompt_segment $PRIMARY_FG default " %(!.%{%F{yellow}%}.)$user@%m "

isae commented Sep 30, 2015
This is a proper font, now theme started to work. OSX Yosemite 10.10.5, iTerm 2 + Solarized Dark

I have some problem when i am connected as root or as ssh : i have a basic prompt without color and effect. Anyone know an issue ?

viix commented Oct 11, 2015

Great work, any one knows the meaning of the GEAR indicator for git ?
screen shot 2015-10-11 at 11 40 36 am

Thats not related to git, the gear means that you are executing some background process, type fg and enter to return the process to the foreground to examine what is that process doing.

So do I need to install powerline AND the powerline fonts?

Really great theme. I just installed "oh my zsh" and then grabbed your theme and the powerline font. Big respect. I like it.

I forked this(well, the version shipping with OMZ) and made some modifications adding nvm/rvm/ support as well as a timestamp in a right prompt. It doesn't seem to cluttered to me, and ZSH handles the RPROMPT pretty well when you need the space back to type. All modules fail gracefully in my testing so far if not present, if you find any issues don't hesitate to let me know =] Here's a screenshot
and a link to the fork -

edit - went ahead and updated my version to be in line with version instead of the one shipping with OMZ

mdrmike commented Oct 20, 2015

Ubuntu 14.04 with manually installed powerline fonts (e.g., download zip, copy font folder(s) to ~/.local/share/fonts/powerline/) and working off idea similar to @ccharlton

I customized guake & gnome terminal by changing default font to use Ubuntu Mono derivitive Powerline.

screenshot_editingprofile default _099

iTerm2 folks, see comment from @MunchyYDL . You need the Non-ASCII font selected as a Powerline font

@ccharlton thank you! Setting ascii font to a different variant fixes symbol font display problem. OS X iTerm2

I have my Ubuntu installed these fonts too. However, I still got this..


Any suggestions?

Here is my locale, does that matter?

Lastly, the zsh theme I tried to use is af-magic and I have set the font to be "Hack"


OK, I solved it...

The trick is to enable Unicode under terminal

menu->terminal->set character encoding

is it OK that I just made a PR by borrowing your code?

DONSA commented Feb 25, 2016

It's possible to style the numbers on the left?
A different background would be nice.

screen shot 2016-02-25 at 23 49 40

dzlab commented Mar 3, 2016

I'm on osx el capitan, I've the long working directory starting from home, something like ~/dir1/dir2/dir3/currentdir! How I can print just the current directory, tried to modify in prompt_dir to put %d instead of %~ but now I get the whole directory structure!!

V-Go commented Mar 7, 2016

osx el capitan issue that i've had since yosemite . End of line on a windowed zsh iTerm causes the next line to behave strangely.

After that several things happen: next character disappears, backspace causes letter duplicated and aliasing, any resizing of screen which have long prompts cause prompt to sometimes break.

It seems to be an issue with agnoster, zsh behaves fine when theme isnt set.

spicy bruh

This doesn't work with grml-zsh-config. I've put prompt off and than inner text of this file in /etc/zsh/zshrc.local. As a result I only get $(prompt_agnoster_main) and nothing else. Could someone help?


You need to add setopt promptsubst to the end of this file. This would work even without prompt off.

gartz commented Apr 13, 2016

Is there a way to not display the full path to working directory and only the name of the current directory?

There's a small issue with Fira Code. See this one.

siwka commented May 17, 2016

When set Powerline for Non-ASCII font my lighting "\u26a1" lost color. Lighting lost light!
If I use other font, e.g. Monaco - lighting is back (but of course other fonts are not recognized :-( ). Any suggestions?

2016-05-18 11 52 25

There is no the icon of the brach.
How can I deal with this problem?

In had a similar problem on Mac OSX using Iterm2, it has been sorted by changing the terminal font config to use any of the powerline fonts for non-ascii characters.

I have a segment issue of the theme.
If I enter a git directory, the segment colour becomes white.

I use iTerm2 v3.0.2 + Solarized Dark
Any suggestion?

hugohil commented Jul 21, 2016

The thing that worked for me was to disable the "Use different font for non-ASCII text" option in iTerm settings.
Hope this helps ( @petertom51 maybe ?)


@petertom51 Maybe you need to change the contrast.

+1 for contrast 👍

nbraud commented Aug 9, 2016

@agnoster I think this is missing a setopt PROMPT_SUBST

Hi agnoster ..the theme is awesome ......I am trying to add remote url of the repo.Is there a space for contribution

my ansi colors look different, am i doing something wrong?

schermafbeelding 2016-09-04 om 18 12 57

Hello! I don't see the custom root, when used "sudo -s". How to resolve this? Its Arch, gnome-terminal.

allansun commented Oct 6, 2016

@petertom51 you should tick this box


tkisme commented Oct 8, 2016

virtualenv promot needed

bbuivn commented Oct 13, 2016

Hi there, still looking for the ability to show the time into the left prompt :)

azat-io commented Jan 19, 2017

@quoniammm How did you solve your problem?

I've the same
screenshot from 2017-01-19 20-23-24

When I try to update my agnoster theme to show only the current directory: prompt_segment blue black '%d' doesn't work... it shows again the full path. Any ideas?

To show only the current folder this worked for me:

prompt_dir() {
  prompt_segment blue black '%c'

You should change print -Pn to print -n on line 100 ( to avoid getting pwned by

xu3352 commented Mar 20, 2017

after change iTerm2->Profiles->Text:Font and Non-ASCII Font, it's work for me

any link how to use agnoster.zsh-theme. i am newbie

I'm a almost new with agnoster, I would like to know if I can add a symbol to show if there are stashed items to the prompt, just to know it without the need to run git stash list.
If no, can you help me to customize it by myself?

Opening the terminal I see a red cross, how to remove it?
2017-09-29 18 59 19

cschell commented Nov 17, 2017

Just dropping the link to the GitHub Repository of this theme, since all the development and discussions seem to take place there:

himanshuxd commented Nov 26, 2017

@gHashTag Commet out the line in /home/username/.bash/themes/agnoster-bash/agnoster.bash that has $RETVAL

prompt_status() {
    local symbols
    #[[ $RETVAL -ne 0 ]] && symbols+="$(ansi_single $(fg_color red))✘"
    [[ $UID -eq 0 ]] && symbols+="$(ansi_single $(fg_color yellow))⚡"
    [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="$(ansi_single $(fg_color cyan))⚙"

    [[ -n "$symbols" ]] && prompt_segment black default "$symbols"

See the bold line it is commented to prevent that cross.

Hi guys, i just got my new macbook its on Sierra and after installing theme the terminal didnt changed color and when i go to profiles i dont see anything added there... Any help?

@alexandar87 are u using iTerm 2 and Zsh? It should be works with additional font installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment