Coffee & Beer

Rantings and Ravings of the technical sort

Vim Trick of the Day

So, we have lots and lots of puppet manifests and some of them are cleaner to read than others. I fnd myself re-indenting things all the time, and though, hmm, must be a better way. So, after a bit of searching, I added this to my ~/.vimrc

1
autocmd BufWrite,FileReadPre   *.pp    :normal gg=G

Now, whenever I open, or save a puppet manifest, the whole buffer is re-indented. So, if I’m editing some previously written file, or myself am sloppy, it all gets cleaned up as son as I open/save the file.

Win

Comments