Normal mode (Default)

Default mode when you open a file.

Moving around

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

  • ctrl+d: page down
  • ctrl+u: page up

  • gg: going to the top
  • G going to the bottom

  • b jump one word back
  • w jump one word forward

  • /text searches for text
  • n go to next search
  • N go to previous search
  • # backward search on word under cursor
  • * forward search on word under cursor

  • $ jump to end of line
  • 0 jump to start of line

Visual mode v

Used for Selecting. Press esc to go back to normal mode.

  • d delete/cut
  • y copy
  • u undo
  • p paste

Insert mode i, I, a, A

Press esc to go back to normal mode.

Command mode :

  • :12 jump to line

Exitting

  • :wq Save and exit
  • :q! Exit without saving

Running commands :!

:!pwd Find current working directory

Vim configuration

Add these to ~/.vimrc

set hlsearch
set incsearch
set autoindent
set smartindent

set ruler
syntax on
filetype plugin indent on