• Stars
    star
    3,972
  • Rank 10,986 (Top 0.3 %)
  • Language
    Shell
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A ZSH theme designed to disclose information contextually, with a powerline aesthetic

agnoster.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

Compatibility

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 (โšก)

Screenshot

Customize your prompt view

By default prompt has these segments: prompt_status, prompt_context, prompt_virtualenv, prompt_dir, prompt_git, prompt_end in that particular order.

If you want to add, change the order or remove some segments of the prompt, you can use array environment variable named AGNOSTER_PROMPT_SEGMENTS.

Examples:

  • Show all segments of the prompt with indices:
echo "${(F)AGNOSTER_PROMPT_SEGMENTS[@]}" | cat -n
  • Add the new segment of the prompt to the beginning:
AGNOSTER_PROMPT_SEGMENTS=("prompt_git" "${AGNOSTER_PROMPT_SEGMENTS[@]}")
  • Add the new segment of the prompt to the end:
AGNOSTER_PROMPT_SEGMENTS+="prompt_end"
  • Insert the new segment of the prompt = PROMPT_SEGMENT_NAME on the particular position = PROMPT_SEGMENT_POSITION:
PROMPT_SEGMENT_POSITION=5 PROMPT_SEGMENT_NAME="prompt_end";\
AGNOSTER_PROMPT_SEGMENTS=("${AGNOSTER_PROMPT_SEGMENTS[@]:0:$PROMPT_SEGMENT_POSITION-1}" "$PROMPT_SEGMENT_NAME" "${AGNOSTER_PROMPT_SEGMENTS[@]:$PROMPT_SEGMENT_POSITION-1}");\
unset PROMPT_SEGMENT_POSITION PROMPT_SEGMENT_NAME
  • Swap segments 4th and 5th:
SWAP_SEGMENTS=(4 5);\
TMP_VAR="$AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[1]]"; AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[1]]="$AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[2]]"; AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[2]]="$TMP_VAR"
unset SWAP_SEGMENTS TMP_VAR
  • Remove the 5th segment:
AGNOSTER_PROMPT_SEGMENTS[5]=

A small demo of the dummy custom prompt segment, which has been created with help of the built-in prompt_segment() function from Agnoster theme:

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

customize_agnoster() {
  prompt_segment 'red' '' ' โš™ โšกโšกโšก โš™  '
}

Customization demo

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.

More Repositories

1

duplicator

TCP proxy that also duplicates traffic to a secondary host
JavaScript
214
star
2

git-dropbox

The easiest way to use a Dropbox for git repositories
Shell
125
star
3

base32-js

Base32 encoding for JavaScript, based (loosely) on Crockford's Base32
JavaScript
116
star
4

ansi2html

Convert text with ANSI escape sequences to styled HTML
JavaScript
32
star
5

literapi

Literate testing for HTTP APIs using markdown
JavaScript
21
star
6

nodeready

[DEFUNCT] A one-step installer for a fully-functioning node.js development environment
Shell
10
star
7

nosey

Node CI -> nosey. It doesn't get any simpler.
JavaScript
7
star
8

elekk

[DEFUNCT] Elekk is a Ruby gem that provides an interface to data for Blizzard's highly popular MMORPG, World of Warcraft. It currently uses data both from Blizzard's official Armory website at wowarmory.com, as well as the popular community database, WoWhead.com. Future versions may make use of additional sources of information.
Ruby
6
star
9

markdownstream

Streaming markdown parser that allows round-tripping and patching
JavaScript
4
star
10

weshareabrain

Shared todolist for small groups that live together (aka households)
Ruby
4
star
11

jsonexp

RegExp for JSON - powerful, expressive pattern matching for data structures
JavaScript
4
star
12

bumper

Simple release management for npm packages with git
JavaScript
3
star
13

node-uberblic

[DEFUNCT] A wrapper for the uberblic.org API
JavaScript
3
star
14

disputandum

The game of civil discourse
3
star
15

unitology

Easy conversions between units
JavaScript
3
star
16

yanc

A command-line client for the nodester platform
JavaScript
3
star
17

bitcoder

[DEFUNCT] A streaming Node.js addon for encoding/decoding byte streams to alternate bases natively (C++)
C++
2
star
18

ratio

Rational numbers (fractions) for node.js
JavaScript
2
star
19

wunderlist

The awesome and free GTD Tool wunderlist
JavaScript
2
star
20

homebrew-synergykm

Homebrew cask for http://synergykm.com
Ruby
2
star
21

hoboku

Deploy apps locally to Vagrant, Heroku-style.
Ruby
1
star
22

mementropy

A client-side XKCD936-compliant password generator. Easy to remember, hard to crack.
1
star
23

enumtree

Data structure for representing lists with fast insert, remove, and lookup from element to index.
JavaScript
1
star