pedr0
pedr0

Reputation: 3011

VIM use % to select range

I am used to seek for the closing bracket of a function pressing the '%' + '}' keys and it works fine but I am not able to use this way to select a range.

I would like to press the keys and then get something like :11,31

So I could enter the command to execute on that range,I have the feeling I am missing a small bit, do I ?

Thanks,

Upvotes: 0

Views: 383

Answers (1)

Luc Hermitte
Luc Hermitte

Reputation: 32966

Have you tried to type (when the cursor is on a bracket)

V%:YourCommand

V to enter the visual mode, line-wise, % to jump to the other bracket, and : to execute a command on the selection.

(Or Vi%:/Va%: if the cursor is not on a bracket, but within a pair of brackets-like characters)

Upvotes: 6

Related Questions