Vim 9 cheatsheet

Vim 9: Editing text

13 common Vim 9 tasks.

Delete a character

Delete the character under the cursor.

x

Delete a line

Delete the current line into the register. Prefix a count to delete several.

dd

Delete a word

Delete from the cursor to the start of the next word.

dw

Delete to the end of the line

Delete from the cursor to the end of the line.

D

Change a word

Delete the word under the cursor and start typing.

ciw

Change text inside quotes

Replace everything between the surrounding double quotes.

ci"

Replace a whole line

Delete the line's contents and start typing.

cc

Replace one character

Replace the character under the cursor with another.

rx

Join lines

Join the current line with the next one.

J

Indent or unindent a line

Shift the line right or left by one shiftwidth.

>>  <<

Re-indent the whole file

Auto-indent from the first line to the last.

gg=G

Repeat the last change

Repeat the last editing command at the cursor.

.

Increment a number

Add one to the number under or after the cursor. Ctrl-x subtracts one.

Ctrl-a

Was this page helpful?