Sunday, January 22, 2012

Vim Tweaks

I do enjoy programming in Vim, but one thing I thought was odd was the default of tabs being ~8 spaces.  A quick google search found out how to change this.  It also makes it so that it uses space characters rather than a tab character.

Using spaces makes it so formatting for things like comments, or for loop indentation is more likely to be the same across text editors.

To make it so that vim inputs spaces, add the following to your vimrc file ( usually /etc/vim/vimrc ):

   set smartindent
   set tabstop=4
   set shiftwidth=4
   set expandtab
Another interesting tweak is set number (and its twin set nonumber) to display    line numbers.  

No comments:

Post a Comment