vimviemu

Highlighting a code block using viEMU


May I know how do I highlight a code region say for example

public void foo()
{
blah();
blah1();
blah2();
}

where my cursor is at 'b' of first blah(), how can I highlight the whole code region using viEmu or VIM per se?


Solution

  • In Vim, that's va{ (or va}, or vaB as synonyms). The v enters visual mode, and a{ is a text object that selects a Block. If you don't want the curly braces included, use i{ (inner Block) instead. And if you want to operate (e.g. delete) on the block, you can skip visual mode and just use a command that takes a motion, e.g. da{.