Posts | About

Higher Level Editing with Vim Text Objects

vimcheat-sheetworksheetvideo

Posted on 2024-11-24 by Matt.

Try it Yourself!

curl https://blog.1-800-rad-dude.com/assets/vim-word-motions-and-text-objects-worksheet.txt | vim

or

download this worksheet

Cheat Sheet

text object selection docs or :h text-objects

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