Posted on 2024-11-24 by Matt.
curl https://blog.1-800-rad-dude.com/assets/vim-word-motions-and-text-objects-worksheet.txt | vim
or
text object selection docs or :h text-objects
<operator>i<text object motion>
to operate on the inner boundary of the text object.<operator>a<text object motion>
to operate on the entire text object.operator-command-motion | result |
---|---|
yiw |
yank inner boundary of word |
yaw |
yank word and surrounding space |
daw |
delete a word and its surrounding space |
daW |
delete a Word (will include punctuation) and its surrounding space |
vis |
visually select inside a sentence |
vas |
visually select a sentence |
dip |
delete contents of a paragraph |
dap |
delete a paragraph and following linebreak |
ci" |
change inside a pair of double quotes |
ca" |
change a pair of double quotes |
ci' |
change inside a pair of single quotes |
ca' |
change a pair of single quotes |
ci` |
change inside a pair of backticks |
ca` |
change a pair of backticks |
vib |
visually select inside a pair of parens |
vi( |
visually select inside a pair of parens |
vi[ |
visually select inside a pair of square brackets |
vi{ |
visually select inside a pair of curly braces |
vi< |
visually select inside a pair of angle brackets |
cit |
change contents of an opening and closing tag |
cat |
change an opening and closing tag and its contents |