Vim Basics

A list of commands for getting started.

Tags:

🌱 Created: 28/07/2022

✏️ Updated: 31/07/2022

Author: Dante Mogrim


Copy

  • Current line: yy

Delete

  • Current line: dd
  • Two words: d2w
  • Unwanted character: x

Exit

  • :q
  • All instances: :qa
  • Without saving: :q!

Open

File: $ vim target.txt Vimtutor: $ vimtutor

Modes

  • Insert: I
  • Normal: <Esc>
  • Visual:
  • Bottom: L
  • Down: j
  • Left: h
  • Right: l
  • Top: H
  • Up: k

Paste

  • p

Rename

Replace

  • Current character: r + <desired character>

Save

  • And exit: :wq
  • Current file: :w
  • Current file as: :sav filename.ext

Select

  • All: ggVG

Undo

  • u