.vimrc Tweaks

I’ve recently made the plunge and standardized all my text editing needs around vim. That is to say vim when in local or remote terminal sessions and macvim when editing local files.

Since this has lead me to tweak my .vimrc file, I figured I’d post its current incarnation for posterity.

set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
set nowrap
set ruler
syntax on
filetype indent on
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType c set omnifunc=ccomplete#Complete

Here’s what it means:

  • tabs config: I like my tabs to be real tabs, but show as 4 columns/spaces wide, not 8
  • nowrap: most of my edits involve code and I don’t like soft text wrapping in that context. I just use set wrap when I need it instead
  • ruler: displays the current cursor’s position (line/col) at the bottom right, which means I don’t need line numbers displayed and save some screen real-estate
  • syntax: I like pretty colors when editing code :)
  • filetype indent: cursor remains at the same tab stop when editing indented code and going to a new line.
  • autocmd: sets code completion (AKA: Omni Completion) via ctrl-xo for PHP, Javascript, HTML, CSS, XML, Python and C

Those are the only configs I’ve found myself needing at the moment, but they made a huge difference in my daily productivity. Maybe they will for you too.

3 thoughts on “.vimrc Tweaks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.