Vim is WriteRoom Level 2

I'm participating in NaNoWriMo this month and the absolutely critical tool for someone with Internet-fueled ADD like myself is a suite for distraction free writing that will isolate a writer from their busy computer environment.

The traditional choice on Mac OSX has been WriteRoom, an application that will take the user into a very minimalist fullscreen writing mode. Perfect for the aspiring author.

Unfortunately, to a Vim user, WriteRoom is nice, but isn't really a tolerable solution. Luckily, using MacVim combined with a small startup script, we can reproduce the WriteRoom interface and get the best of both worlds.

set lines=50
set columns=80
colorscheme koehler

set guifont=Monaco:h10
set guioptions-=r
set fuoptions=background:#00000000
set fu

" green normal text
hi Normal guifg=#B3EA46
" hide ~'s
hi NonText guifg=bg

" wrap words
set formatoptions=1
set lbr

" make k and j navigate display lines
map k gk
map j gj

Save this as a *.vim script (e.g. focus.vim) and source it in using MacVim's mvim command: mvim -S focus.vim <file to edit>. I personally use set an alias for it as well: alias vif='mvim -S focus.vim'.

As you can see, we get an interface nearly indistinguishable from the one offered by WriteRoom, and with the full power of Vim. Outstanding!

Vim masquerading as WriteRoom

Fig. 1: Vim masquerading as WriteRoom

Posted on November 7, 2010 from Calgary

Newest Articles

About

My name is Brandur. I'm a polyglot software engineer and part-time designer working at Heroku in San Francisco, California. I'm a Canadian expat. My name is Icelandic. Drop me a line at brandur@mutelight.org.

Aside from technology, I'm interested in energy and how it relates to our society, travel, longboarding, muay thai, symphonic metal, and the guitar.

If you liked this article, consider finding me on Twitter.