vimtricks.wiki Concise Vim tricks, one at a time.

How do I select text inside angle brackets?

Answer

vi<

Explanation

The vi< command selects the text inside angle brackets (< >). This is useful for HTML/XML attribute editing and template syntax.

How it works

  • v enters visual mode
  • i< is the "inner angle brackets" text object
  • Selects everything between < and > without the brackets

Example

<div class="main">

With the cursor inside the brackets, vi< selects div class="main".

Tips

  • va< includes the brackets in the selection
  • ci< changes inside angle brackets
  • di< deletes inside angle brackets
  • Useful for editing HTML tags and generic type parameters
  • Works with nested angle brackets

Next

How do you yank a single word into a named register?