Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Indent object plugin for Vim

📅 2013-Mar-04 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ indent object, plugin, vim ⬩ 📚 Archive

Being able to visually select all the lines of code that are at the same indentation level and belong to the same block can be useful. For example, it can be used to comment out all those lines or to increase or decrease their indentation level. This is especially useful in languages like Python that have no braces to indicate opening and closing of blocks of code.

The indent object plugin for Vim sets out to aid in visually selecting all lines of code that belong to the same indentation block. It can be installed for Pathogen by cloning its Github repository.

Go into visual mode (Shift-V) on any line in the block and press ii. All of the lines in the block will be selected and ready for any operation you want to perform on them.

Tried with: Vim 7.3