Saturday, October 23, 2010

vim indentation

Some useful lines for configuring the indentation behavior of vim.
These commands can be executed inside vim, all preceded by a colon (:), or added to ~/.vimrc.

This changes the display width of the tab (to save precious screen space):
  set shiftwidth=3
  set tabstop=3

and adding this, replaces the tabs with spaces
  expandtab
  set softtabstop=3

To indent (or re-indent) a block of code, first select some lines with Shift-V, and then press =

Sources:
http://vim.wikia.com/wiki/Indenting_source_code
http://tedlogan.com/techblog3.html

No comments:

Post a Comment