Indenting code

Code indentation is a good idea (although probably not as good an idea as the Python people think), so Vim will indent your code for you.

First, put filetype plugin indent on in your .vimrc to enable the smart language-specific indentation algorithms (and other fancy features). If you don’t you’ll be using the simple old-vi-compatible indentation.

That’s mostly it. As you edit, vim will indent.

If you need to reindent an entire file, goto the first line and type =G in non-insert mode.

Leave a Reply

Your email address will not be published.