I recently moved to Vim from Sublime Text 2. I love Vim and been slowly converting all the usual ways of doing things in Sublime Text 2 into the Vim way. I’ve converted almost all my shortcuts except one, expand selection to indentation. This is incredibly useful for reindenting malformed lines or changing entire code bodies. After a lot of looking I finally found Vims equivalent vim-indent-object.
Say your cursor is at that arrow, how would you change everything inside the if statement? With vim-indent-object you can just type
cii, this will [c]hange [i]nside the [i]ndentation.
An other example, say you just pasted some code and it is horribly indented. You can fix the indentation with
With vim-indent-object you can easily delete objects spanning over multiple lines. The
tileMap variable can be deleted by typing
daI, delete indentation including the top (a) and bottom (I). You can just remove the top by typing
Unforunately the plugin looks inactive with the last commit in March 2011. It’s still a great plugin and I think every give it a try.