Helix’s various text objects
Now that we understand the distinction between inner and around, let’s explore what match mode can select.
Each of the text objects below has an inner and an around variant. If you
read (, that means you can use mi( for the inner variant and ma( for the
around variant.
(— text captured by parentheses —)also works[— text captured by square brackets —]also works{— text captured by curly braces —}also works<— text captured by angle brackets —>also works"— text captured by double quotes'— text captured by single quotes`— text captured by backticksw— a wordW— a WORD (anything up to the next whitespace)p— a paragraph
There’s a lot of them! Thankfully, they are mostly intuitive — if you’re
targeting a quoted string, you use ", and if you’re targeting the text
inside some parentheses, you use (. When pairs are nested, match mode picks
the closest one around the cursor.
Let’s practice. In the editor, you’ve got some text that is full of places to use these text objects. Work through the checklist below, combining them with the actions we learned earlier.