Vim configuration

There are many different ways to customize Vim and depending on the tasks you are working on, different plugins can be used. My .vimrc, the plugins i use and other tweaks are customized to help me with the tasks i preform most frequently:

  1. Use mutt/vim to read/write emails
  2. Write C code under GNU/Linux, usually with glib, gobject, gstreamer
  3. Browse/Read C source code
  4. Work with Python, Ruby, Ruby on Rails or Bash scripts
  5. Develop web applications with HTML, Javascript, CSS mostly

I Launch vim without the graphical interface in a terminal under Gentoo GNU/Linux or Mac OS X and most of the times within a GNU screen. To get this working with UTF-8 and 256 colors can be  bit of a struggle, see System setup below.

All plugins and my .vimrc can be easily installed from my google code repository with the following commands:

svn co http://joeldotfiles.googlecode.com/svn/trunk/ joeldotfiles

And then create a symlinks that looks something like this:

~/.vim -> joeldotfiles-read-only/.vim
~/.vimrc -> joeldotfiles-read-only/.vimrc

System configuration

Since i use the same .vimrc for all my systems, I need to setup the applications I use to handle 256 colors. For me this means I’m using urxvt under Linux and iTerm under Mac OS X, both of these can handle 256 colors. To get Vim working as i want i have done a some tweaks to my system.

Visual Setup

First up, you need to setup your terminal correctly, i recommend urxvt for Linux or iTerm if you are on Mac OS. You need to build urxvt with 256 color support and when compiled it should look something like this:

urxvt -help 2>&1 | head -2
rxvt-unicode (urxvt) v9.07 - released: 2009-12-27
options: perl,xft,styles,combining,unicode3,
encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,
fade,transparent,tint,XIM,frills,selectionscrolling,
wheel,slipwheel,cursorBlink,pointerBlank,
scrollbars=plain+rxvt+NeXT+xterm

Also make sure you edit your .vimrc to handle 256 colors

set t_Co=256
colorscheme xoria256

To test the colors, download 256color2.pl and see if you succeeded. The result from a urxvt with 256 color support should look something like this:

Screenshot, 256 colors test with rxvt-unicode and Linux

Screenshot, 256 colors test with rxvt-unicode and Linux by tilljoel

Screenshot, Monaco 9 font, Vim, rxvt-unicode and Linux

Screenshot, Monaco 9 font, Vim, rxvt-unicode and Linux by tilljoel

Screenshot, 256 colors test with rxvt-unicode and Linux

Screenshot, 256 colors test with rxvt-unicode and Linux by tilljoel

Screenshot, Monaco 12 font, Vim, iTerm and Mac OS

Screenshot, Monaco 12 font, Vim, iTerm and Mac OS by tilljoel

Helper applications

Install the ctags and cscope tools to allow easy code navigation, the bindings are available in my .vimrc. You should also get the text formatting tool par, it’s awesome for reformatting stupid emails that has overly long lines that not conform to RFC 2822, see Dan’s Mail Format Site.

Since my vim configuration is something that constantly evolving, I hope this page will do the same and the configuration will probably never be finished :)

Here is a short list of the stuff i installed, changed or configured that is yet not described at this page: GNU/screen, UTF-8, keyboard bindings, compile vim with correct flags, vimspell files

Vim plugins

This section has links to all the plugins I currently use:

  • Taglist is a source code overview plugin, it uses ctags to display tags in a split. The script can be found on vimscripts
  • Cscope is also used to browse source code
  • Std_c is a Vim C syntax file is that helps to develop portable Standard C code
  • CRefVIM is a C-reference manual especially designed for Vim, like ‘man’
  • Blogit is an awesome WordPress plugin for Vim, use it to list, edit post to you wordpress blog from within Vim

All my flickr photos tagged with vim:

Creative Commons License

Get Adobe Flash playerPlugin by wpburn.com wordpress themes