Quick Tip: Ensuring proper indentation in vim


Quick tip: You can add vim configuration options in source code comments, and vim will load them when it loads the file. For instance, I tend to put
// vim: et ts=4
at the top of my source files, to ensure that tabs are always expanded to four spaces.

3 thoughts on “Quick Tip: Ensuring proper indentation in vim

  1. It’s also very useful to add sw=4 to ensure shifting is also moved by 4. Ex. for indentation modifiers “<>” and the autoindent “g=”.

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 )

Facebook photo

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

Connecting to %s