Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

How to smart indent VIM with comment indenting

Vim tends to do nice indenting but wants to leave comments without one by default. This makes code look bad. This is a short reminder on how to make it right.

Configuration file

Set following to your ~/.vimrc :

filetype indent on
set autoindent

And that's it :)

Indent a non-indented file

If you've got a file that needs re-indenting open it with vim and issue following command :


And you've just indented the file.

Comments and suggestions

If you find bugs above please comment below. Also feel free to rate.

 stars  from 0 votes

Leave a comment

Enter your comment:

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line