You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text-objects are used in visual or operator-pending mode.
w for instance stands for the text-object word. When you are in operator pending mode, for instance right after pressing d for delete, pressing w (so dw) will delete from the cursor position to the end of the word. Two modifiers exist to create more powerful text-objects: a (for around) and i (for inner). The former will act on the text-object on its right plus its surroundings delimiters (for a word, it’s basically the whitespaces). The latter, i, will apply the operation only inside the text-object. For a word, it means just the word, ignoring the whitespace around it.
With this, you can do really powerful editing. For instance, if you have this HTML code:
<div class="stuff">I like cookies</div>
And you want to change I like cookies to I love pasta, you can simply put your cursor anywhere in that text, and press cit, which translates to:
c = change
i = inner
t = tag
t is a text-object native to Neovim that can recognize “tags” of the filetype you are editing (here, HTML tags). So that command will change the text inside the tag. If you wanted to completely replace the whole tag with another one, you could have pressed cat, which would have removed the surroundings (i.e. the
and
).
The text was updated successfully, but these errors were encountered:
text-objects are used in visual or operator-pending mode.
w for instance stands for the text-object word. When you are in operator pending mode, for instance right after pressing d for delete, pressing w (so dw) will delete from the cursor position to the end of the word. Two modifiers exist to create more powerful text-objects: a (for around) and i (for inner). The former will act on the text-object on its right plus its surroundings delimiters (for a word, it’s basically the whitespaces). The latter, i, will apply the operation only inside the text-object. For a word, it means just the word, ignoring the whitespace around it.
With this, you can do really powerful editing. For instance, if you have this HTML code:
And you want to change I like cookies to I love pasta, you can simply put your cursor anywhere in that text, and press cit, which translates to:
c = change
i = inner
t = tag
t is a text-object native to Neovim that can recognize “tags” of the filetype you are editing (here, HTML tags). So that command will change the text inside the tag. If you wanted to completely replace the whole tag with another one, you could have pressed cat, which would have removed the surroundings (i.e. the
The text was updated successfully, but these errors were encountered: