Vim - Text Command

> Integrated development environment (ide) > Text Editor - Vi (VIM)

1 - Management

/SearchTem

1.2 - Copy/Paste

Command Description Mode Note
p Paste the last copy or deletion Normal
Advertising

1.3 - Text manipulation

1.3.1 - Words

Command Description Mode Note
W Next word at the beginning Normal
E Next word at the end Normal
B Previous word Normal
dw Delete word Normal
dnw Delete n word Normal Example: d2w deletes 2 words.
de Delete from the cursor to the end of word Normal
2w, 3w, … nw to move the cursor n words forward. Normal
2e, 3e, … ne to move the cursor to the end of the n word forward. Normal

Motion:

  • e to the end of the current word
  • w until the start of the current word
Advertising

1.3.2 - Character

Command Description Mode Note
x Delete a character Normal Throwback of the old days of the typewriter, when you deleted things by typing xxxx over them.
i*<Esc> Insert one or many character at the cursor Insert You go in insert mode i, type what ever text * you want and then exits insert mode ESC
A*<Esc> Insert one or many character at the end of the line Normal Type A, what ever text * you want and then exits insert mode ESC
J Deleting a line break Normal ie join two lines together
r+char Replace the next character with char Normal Example: re will replace the next character with an e.

1.3.3 - Line

Command Description Mode Note
A*<Esc> Insert one or many character at the end of the line Normal Type A, what ever text * you want and then exits insert mode ESC
o Creates a new, empty line Normal below the cursor and puts Vim in Insert mode.
0 Go to the start of the line Normal
U Undo line Normal It undoes all the changes made on the last line that was edited. Typing this command twice cancels the preceding U.
dd Delete a line Normal
dnd Delete n line Normal Example: d2d deletes two lines.
d$ Delete the end of the line from the cursor Normal
J Deleting a line break Normal ie join two lines together
n$ Go to the end of the n line Normal Example : 2$

Motion:

  • $ to the end of the line
Advertising