color me, color you

September 18, 2011

linux

In the xoria256m post, I introduced my xoria256 like color scheme. Again, inspired by solarized, I extended this to other applications. So now I use this in the following apps:

  • vim (see that previous post);
  • mutt (idem);
  • zsh;
  • dircolors;
  • git (a bit).

zsh

See this file to setup the colors. Then in my prompt I have stuff like:

PS1=$'${vcs_info_msg_0_}$FG[067]%(1j.$myjobs% $FX[reset].$FX[reset])$FG[179]%#$FX[reset] '
RPS1="$RPSL%$MAXMID<...<$mypath$RPSR$FG[239]$FX[bold]$__ZH$FX[reset]${vcs_info_msg_1_}"
RPSR=$'$FX[reset]$FG[009]%(0?.$FG[reset]. $E)$FX[reset]'

For zsh I have two files that make up my prompt:

  • zprompt, primary prompt setup;
  • zvcs, version control vcs_info stuff.

Also see this older blog post on this setup. This leads to a prompt looking like this (click for larger):

The normal prompt is very plain. Almost nothing is shown, left the prompt % and on the right the PWD ~:

When logging in to a remote server, the hostname appears on the right:

When a program ends abnormally the exitcode is shown, in words (-INT) and red when it isn’t zero:

When you background an app. the number of bg jobs appear in blue. The one with the + is the current job. Multiple jobs are separated with commas:

When you enter a git/svn/hg directory, the right side shows the type (git, svn, hg) and on the left you get the current branch.

dircolors

Modified from Solarized, not quite finished, but certainly looks nice (IMHO). See this dircolors file, I use it like:

eval $(dircolors ./dircolors)

git

The alias section from my .gitconfig:

[alias]
        st = status
        ci = commit
        br = branch
        co = checkout
        df = diff
        lg = log -p
        pl = pull
        ps = push
        timeline = log --graph \"--pretty=format:%C(192)%h%Creset by %C(bold 239)%an%Creset (%ar)%C(182)%d%Creset%n%s%n%b\" --all

The colors are selected with %C(number).

Zsh