How to use vi(m)

Vim has three modes. Insert mode, command mode and visual mode.

VIM is case sensitive!!

To quit, you should be command mode. Just type esc! and type this.


If you want to save the text, type this.


If you want to quit, but doesn't save,


And, you want to save and quit,


When vim is in command mode, you can move the cursor via h,j,k and l commands

  • h - left
  • j - down
  • k - up
  • l - right

You can also move through the words

  • w - jump word forward at first
  • e - jump word at last
  • b - jump backword

You can go to some lines

  • gg - go to ground(end) line.
  • G - go to start line.
  • #G - go to # line. # is number.

You can modify the text.

  • i - changed to insert mode. you can insert text.
  • a - changed to insert mode, after current cursor.
  • r - change a character.
  • o - add a line after cursor.
  • O - add a line before cursor.

You can change mode by esc key.

If you want to undo, type u.

  • getting_started/vi.txt
  • Last modified: 2019/07/16 15:53
  • by tony.hong