Home

Awesome

AgnosterJ

This is a Zsh theme optimized for people who use:

For Mac users, I highly recommend iTerm2 + Solarized Dark.

AgnosterJ is apjanke's fork of agnoster's Agnoster Zsh Theme. Development on the original Agnoster seems to have stalled as of about 2018, so I decided to make a fork and pull in pending PRs from over there, and add some of my own enhancements.

The original Agnoster Theme, while not minimal, tried to stay small, supporting just the most common features. AgnosterJ is more expansive, providing additional prompt segment types, more customizability, and some silly stuff thrown in.

Requirements

Powerline fonts

If you are using iTerm2, then Powerline support is built in. To enable it, find your profile in Settings > Profiles, select the Text tab, and turn on "Use built-in Powerline glyphs". This is easier than installing a special font!

NOTE: If you are not using iTerm2, you will need to install a "Powerline-patched font" for this theme to render correctly. There’s a couple places you can get these easily:

(Note: Installing the fonts-powerline Debian package does not work!)

To test if your terminal and font support Powerline, 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

If you get placeholder squares for the first and third characters, then you are not correctly using a Powerline-patched font.

What does AgnosterJ show?

Example

Screenshot

Installation

Regular installation

Download the files in this repo somewhere, and have your ~/.zshrc source the agnosterj.zsh-theme file.

# This goes in your ~/.zshrc

source ~/path/to/agnosterj-zsh-theme/agnosterj.zsh-theme

Installation under Oh My Zsh or Prezto

See the User Guide for instructions.

Configuration

AgnosterJ can be configured by setting various environment variables. For example:

See the User Guide for details on all configuration variables.

You can call the agnoster_setopt function to see what the current variables affecting AgnosterJ are set to.

Customizing your prompt

By default, the prompt has these segments in this order:

If you want to add, remove, or reorder some segments of the prompt, you can use the array environment variable named AGNOSTER_PROMPT_SEGMENTS. There are also agnoster_add_segment and agnoster_remove_segment functions to help you do this.

There are many prompt segments available that are not enabled by default. See the source code or User Guide for options!

Optional segments include:

Examples

echo "${(F)AGNOSTER_PROMPT_SEGMENTS[@]}" | cat -n
agnoster_add_segment aws
agnoster_add_segment 1 aws
agnoster_add_segment 5 aws
agnoster_add_segment 5 aws gcp azure
agnoster_remove_segment 5
agnoster_remove_segment aws gcp azure
agnoster_setopt

A small demo of a dummy custom prompt segment, which has been created with help of the prompt_segment() function from AgnosterJ:

# prompt_segment() - Takes two arguments, background and foreground.
# Both can be omitted (by passing an empty argument), rendering 
# default background/foreground.

customize_agnoster() {
  prompt_segment 'red' '' ' ⚙ ⚡⚡⚡ ⚙  '
}

Customization demo

Future Work

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.

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. At least nowadays iTerm2 has Powerline icon support built in.

License

The AgnosterJ licensing situation is a little unclear. This is because the upstream Agnoster Zsh Theme does not have a license. But it’s clearly meant for public consumption, so I’m assuming that making this fork is fine, and it's okay to redistribute that code.

The AgnosterJ additions to Agnoster are licensed under the MIT License.

If Agnoster gets around to choosing a particular open source license, I will add dual-licensing to AgnosterJ so it is covered under that license as well.

Author

Agnoster was originally written by Isaac Wolkerstorfer (agnoster on GitHub). Thanks to Isaac for writing this neat tool!

The AgnosterJ fork is maintained by Andrew Janke (apjanke on GitHub).