Bill Agee's blog

🤔 Reflections on test infrastructure, with a twist of user empathy.

How to set up the Solarized color scheme for vim and iTerm2

Solarized Vim Screenshot

When you stare at a display full of text for hours at a time, a nice looking color scheme is worth the time it takes to set up.

Enter Solarized, a great option for improving your overall text-editing life.

My officemate Kevin has been evangelizing Solarized for a while, so today I took the plunge and set it up, and man do I wish I had done this a while ago. Much of the content described below is straight from his setup - I definitely owe him.

The set of software I'm currently using with Solarized is:

  • iTerm2 (since in my experience it handles Solarized better than Terminal.app)
  • The command-line vim that ships with OSX
  • pathogen.vim (for easy installation of vim plugins)
  • The Solarized config files for iTerm2 and vim
  • NERDTree (a tree explorer for vim)

For future reference, here's how I set everything up:

  1. Download the stable version of iTerm2 from iterm2.com

  2. Download and unzip the latest version of the Solarized .zip file (it contains the iTerm2 preset files you'll need)

  3. In iTerm2, open iTerm2 > Preferences > Profiles > Colors, and click Load Presets... to load the Solarized color schemes (light and dark) that are found in the .zip in solarized/iterm2-colors-solarized/

    For more info see the iterm2-colors-solarized README.

  4. Follow these instructions from the pathogen github README to install pathogen. In the next step, we'll be using pathogen to install more bits.

  5. Install solarized.vim using pathogen:

    (For more info see http://ethanschoonover.com/solarized/vim-colors-solarized)

    cd ~/.vim/bundle
    git clone git://github.com/altercation/vim-colors-solarized.git
    

    In the parent directory of vim-colors-solarized:

    mv vim-colors-solarized ~/.vim/bundle/
    
  6. Install NERDTree:

    (See also http://programming34m0.blogspot.com/2011/04/nerd-tree-file-explorer-with-mac-vim.html)

    cd ~/.vim/bundle
    git clone git://github.com/scrooloose/nerdtree.git
    
  7. Set up your .vimrc appropriately - here's mine:

    set ruler
    set cursorline
    call pathogen#infect()
    syntax on
    
    filetype plugin indent on
    
    syntax enable
    
    " Solarized stuff
    let g:solarized_termtrans = 1
    set background=dark
    colorscheme solarized
    
  8. OPTIONAL: A nice choice for a terminal font is Inconsolata-dz - you can download it here, and configure iTerm2 to use it:

    http://nodnod.net/2009/feb/12/adding-straight-single-and-double-quotes-inconsola/

Comments