• there are four main modes in the vim
    • normal mode - where you can navigate and check the code
    • insert mode - where you can type
    • visual mode - where you can highlight the code and check
    • command mode - where you can enter commands

normal mode

we are mainly using following keys to navigation

  • H - right
  • J - down
  • K - up
  • L - left

  • W - move word by word forward
  • B - move word by word backward

also you can use the numbers to jump around lines. for example if you need to go four lines up, you can use 3K or for down 3J

you can use there keys to undo an action or delete a line

  • dd - for delete a line
  • uu - undo what you have done

Insert Mode

entering the insert mode
  • I - insert before the cursor
  • A - insert after the cursor
  • O - insert in a new line

visual Mode

pressing V will move you to the visual mode

all the navigations in normal mode can be used in here. its just keep high lighting everything.

  • y - for copying the highlighted area
  • p - for pasting what you have been copied

pressing shift + V will goes to the visual line mode . in here you can copy and past the whole line a new line.

command Mode

  • : for entering the command mode
  • :W - save everything
  • :Q - quit everything
  • !Q - quit without saving