../𝚂𝚃𝚇
source

vim language quick reference

Published 2018-05-06, last edit 2020-08-04

Example command di" (| is the cursor below):

somefunc("here is a |string") --> somefunc("") 

The general form is <action> <operator> <text object>, or as I like to think, <action> <verb> <noun>. Verbs modify nouns.

So, for di" above:

Verbs are optional depending on the noun, but with this outline there are many commands you compose.

1. Actions #

action mnemonic meaning
c change delete and enter insert mode
d delete delete
g go movement/jump to
p paste paste
r replace replace
v visual enter visual mode
y yank copy

2. Verbs #

verb mnemonic meaning
a around inclusive of noun selector
i inside exclusive of noun selector
f find forward to character, inclusive
F   backward to character, inclusive
t till forward to character, exclusive (character is the verb)
T   backward to character, exclusive

3. Nouns #

noun mnemonic meaning
b block blocks of surrounding ([{ (implicit)
p paragraph paragraph
s sentence sentence
t tag <tags> pairs of </tags>
w word word
%   matching [{( under cursor, inclusive
/   forward to search result
<,>   <tags> pairs of </tags>
?   backward to search result
', ", `   surrounding "'` pairs
(, [, {, }, ], }   surrounding ([{ pairs

You can install plugins to get more nouns and nice contextual actions. For example with tpope’s commentary you get a gc action for commenting in whatever programming language you are in – which you can compose with any of the above nouns and verbs!