Nerd Notes

/dev/brain: no space left on device

Archive for the ‘vim’ Category

Making vim syntax highlighting usable

with 13 comments

Someone says vi vi vi is the editor of the beast. He’s right. That’s why I use vim, which is a modern editor, backwards compatible with vi and full of bells and whistles. But, most of all, vim gets things done for me. I’m in love with vim.

On some modern linux distributions, vim comes with syntax highlighting enabled by default. Since you’re a die-hard nerd like me, your terminal window colors scheme is like god meant it to be: with a black background. And, if you really feel nostalgic like me, you may even have gone one step further and you’ve setup green as the foreground color. That’s great, but there’s one thing that makes vim syntax highlighting suck on such a color scheme: it was meant by default to work on a light (read white) background.

My colleagues hate vim’s default color highlighting and they’re tempted all the time to use the old beast: vi, just because it has no color syntax highlighting which makes comments unreadable to say the least. This should get fixed. Enter the gay world with: set background=dark That means, while in vim, enter command mode and type the above command.

Great! The world has suddenly become clearer and you feel an urge to dance to the rhythm of Village People’s YMCA. That is, until you close vim and open it again. Then you’re into Robert Smith mode again. Too bad. We’ve got to fix that too. The recipe is as easy as editing your ~/.vimrc or, better yet, making the change system wide by editing the /etc/vim/vimrc file and adding a couple lines:

syntax on
set background=dark

That’s it. Now, where’s my biker dress?

Advertisements

Written by Mirko Caserta

October 27, 2006 at 7:48 am