Tyler Cipriani

TYLER CIPRIANI

Gentleman, Scholar, Web Hacker

Junkfood theme in git directory

My ZSH (and bash) prompt

Posted on: December 18, 2012 by Tyler H.T. Cipriani

In order to become a card-carrying Linux user, I feel like you need to have spent a truly astounding amount of time fiddling with your dotfiles.

Me? I’ve gone way beyond the point of diminishing returns. Past the point where anyone who loves me can even feign interest. And now I’m quaffing the sweet nectar of victory, and that victory nectar is sweet. Oh yes, that’s right: my insanely customized prompt is now a part of Bobby Russell’s Oh-My-ZSH

I’m feeling the pride, joy, and anxiety that can only come from watching my little utf-8 baby move beyond my home directory and march deep into the uncharted home directories of what I can only assume are BILLIONS of users.

All your Oh-My-ZSH are belong to us! *

…or it will when you update your theme. See, cause, oh-my-zsh uses themes to specify how your prompt looks. You can define what theme you’d like to use in your ~/.zshrc file. On or around line 8 you’ll want to update the line that starts with ZSH_THEME=… to look like this:

1 # Set name of the theme to load.
2 # Look in ~/.oh-my-zsh/themes/
3 # Optionally, if you set this to "random", it'll load a random theme each
4 # time that oh-my-zsh is loaded.
5 ZSH_THEME="junkfood"

Almost, not quite…

Like any good dotfile obsessive, I’ve continued to make changes to this prompt since I made my pull request to ole Robby! I’ve modified the prompt to show the same sort of branch information about SVN repos that it currently displays for git repos (e.g., current branch name and local modifications). That little code chestnut is available over on my fork of the oh-my-zsh build.

Bash Junkfood theme

I also have a version of this prompt for Bash that I’ve made in preperation for the undoubted overwhelming demand that I expect to begin any time now:

 1 # An extravagent PS1 http://blog.bigdinosaur.org/easy-ps1-colors/
 2 function prompt {
 3   # 30m - Black
 4   # 31m - Red
 5   # 32m - Green
 6   # 33m - Yellow
 7   # 34m - Blue
 8   # 35m - Purple
 9   # 36m - Cyan
10   # 37m - White
11   # 0 - Normal
12   # 1 - Bold
13   local BLACK="\[\033[0;30m\]"
14   local BLACKBOLD="\[\033[1;30m\]"
15   local RED="\[\033[0;31m\]"
16   local REDBOLD="\[\033[1;31m\]"
17   local GREEN="\[\033[0;32m\]"
18   local GREENBOLD="\[\033[1;32m\]"
19   local YELLOW="\[\033[0;33m\]"
20   local YELLOWBOLD="\[\033[1;33m\]"
21   local BLUE="\[\033[0;34m\]"
22   local BLUEBOLD="\[\033[1;34m\]"
23   local PURPLE="\[\033[0;35m\]"
24   local PURPLEBOLD="\[\033[1;35m\]"
25   local CYAN="\[\033[0;36m\]"
26   local CYANBOLD="\[\033[1;36m\]"
27   local WHITE="\[\033[0;37m\]"
28   local WHITEBOLD="\[\033[1;37m\]"
29   export PS1="$WHITEBOLD# $GREEN\u$WHITEBOLD. $BLUE\h$WHITEBOLD. $YELLOW\d$WHITE at $PURPLE\@$WHITEBOLD. $CYAN\w\n  $WHITE"
30 }
31 prompt

Prompt Inspiration

Most of the inspiration for moving to ZSH and for creating this extravagant (to borrow a phrase) prompt came from a blog post written by Mr. Steve Losh called, “My Extravagant ZSH Prompt”.


← View Weblog
comments powered by Disqus