RSS feed
<< Master Lock Rocks | Home | Wish List for 2010 >>

Colorize OS X's BASH & VI

Quick tip for Terminal color

Here are some quick ways to add some color to BASH and VI in OS X. The below will edit the global files for all users and use just some quick color options. If you want to do this, you can probably figure out how to do this on a per-account basis and do some custom colors too. This has only been tested (so far) with Mac OS X 10.6, but it likely works with 10.5 and even 10.4.

Why do this? If you've ever used virtually any Linux distribution on the planet, you'll see these options are enabled by default. I find colorized directory listings helpful. Seeing code colorized in VI is extremely helpful because you can spot simple typos quickly. I have no idea why after six generations of OS X (I don't count 10.0 as an OS, yuk!) Apple never made this default.

BASH
  1. Edit your /etc/bashrc file.
  2. Add these two lines to the end:
    export CLICOLOR=1
    export TERM=xterm-color
  3. Save.
The default settings are: exfxcxdxbxegedabagacad

Color options are:
a     black 
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background
The directory color order is:
  1. directory
  2. symbolic link
  3. socket
  4. pipe
  5. executable
  6. block special
  7. character special
  8. executable with setuid bit set
  9. executable with setgid bit set
  10. directory writable to others, with sticky bit
  11. directory writable to others, without sticky bit
VI
  1. Edit your /usr/share/vim/vimrc file.
  2. Add these two lines to the end:
    :set term=builtin_xterm
    :syntax on
  3. Save
Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!



Add a comment Send a TrackBack