How do I select all text inside square brackets?
Answer
vi[
Explanation
The vi[ command selects the text inside square brackets without including the brackets themselves. It works from any position inside the brackets.
How it works
venters visual modei[is the "inner square brackets" text object- Selects everything between
[and] - Handles nested brackets correctly
Example
array[index + offset]
With the cursor inside the brackets, vi[ selects index + offset.
Tips
va[includes the brackets in the selectiondi[deletes inside bracketsci[changes inside bracketsvi]is a synonym forvi[- Nest with other text objects: select inside nested brackets