I’m Derek. This is my blog.

vimrc

March 4th, 2008 · No Comments

This post is incredibly nerdy. Just putting that out there up front.

Here’s my vimrc file.

Here’s what it looks like in OS X terminal with white text on black.

Here’s some of the things I’ve customized that have proven useful in my workflow:

  • ,t (that’s comma-t) for a new tab; ,< for moving to the previous tab, and ,> for moving to the next tab. The comma comes from the mapleader variable, so you can switch it to whatever; I prefer comma because it’s right next to > and sharing the < key which makes tab switching fast.
  • F7 toggles paste mode (vim won’t change the formatting or indentation of the text you’re about to type in insert mode; it assumes you’re pasting from a source that already has that).
  • CTRL-N in normal mode will toggle highlighting from search on and off.
  • I’ve got some template files for common filetypes (.php, .rb, .py, etc) that get inserted for me when I edit a brand new file of that type.
  • I work with a few languages in vim and like omni-completion support on some of them, but not others (it’s really wonky in PHP). So I use a function when pressing tab in insert mode: if it’s a filetype that has omni support, omni support is used, unless the filetype is in an exclusion list. If the filetype doesn’t have omni support, or is in the exclusion list, it uses regular keyword completion. If completion doesn’t apply when pressing tab (like you’re in the middle of whitespace), you get a tab.
  • ,y “yanks” or copies to the OS X clipboard in visual mode. ,p “puts” or pastes from the OS X clipboard in normal mode. This makes it easy to work with the regular clipboard.
  • When working with PHP, :make should tell you about syntax errors and let you move through them with the usual vim error-navigating stuff (:cnext, etc).

If you are also a gigantic nerd and like some of the stuff here or have suggestions, I’d love to hear about it.

Tags: Miscellaneous

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment