Vim

Types of mode

  • insert mode
  • replace mode
  • visual mode
    • visual line
    • visual block
  • command line mode

Starts with normal mode

Normal mode -> insert mode : press i

Normal mode -> replace mode : press r

Normal mode -> visual mode : press v

Normal mode -> visual mode : press shift +v

Normal mode -> visual mode : press ctrl +v

Normal mode -> command line mode : press :

any mode -> normal mode : <esc>

normal mode

movement keys

  • h : left
  • j : down
  • k : up
  • l : right
  • w : move forward by one word
  • b : move backward by one word
  • e : end of the word
  • 0 : beginning of the line
  • $ : end of the line
  • ^: non first empty character line
  • ^U: move up
  • ^D: move down
  • G: move all the way down (case sensitive)
  • gg: move all the way up (case sensitive)
  • L: Lowest line on screen (case sensitive)
  • M: Middle line on screen (case sensitive)
  • H: Highest line on screen (case sensitive)
  • f<char>: jump forward to the first occurance of <char> (case sensitive)
  • F<char>: jump backward to the first occurance of <char> (case sensitive)
  • t<char>: jump forward to <char> just before it. (case sensitive)
  • T<char>: jump backward to <char> just before it. (case sensitive)

editing

  • x : delete
  • o : Creates new line just below the current line and changes to insert mode (case sensitive)
  • O : Creates new line just above the current line and changes to insert mode (case sensitive)
  • / : search
  • a : append
  • . : repeat previous taks
  • d<movement key>: delete a char in the direction of <movement key>
  • c<movement key>: replace a char in the direction of <movement key>
  • dd: deletes the whole line
  • cc : deletes the whole line and puts to edit mode
  • u: undo
  • ^r: redo
  • y: copy
  • paste:
  • ~: change case
  • di( or di[`: delete inside paranthesis
  • ci( or ci[`: change inside paranthesis

repeating commands

  • <num><command>: the <command> will be done <num> time(s)

insert mode

replace mode

visual mode

movement keys

  • h : left
  • j : down
  • k : up
  • l : right
  • w : move forward by one word
  • b : move backward by one word
  • e : end of the word
  • 0 : beginning of the line
  • $ : end of the line
  • ^: non first empty character line
  • ^U: move up
  • ^D: move down
  • G: move all the way down (case sensitive)
  • gg: move all the way up (case sensitive)
  • L: Lowest line on screen (case sensitive)
  • M: Middle line on screen (case sensitive)
  • H: Highest line on screen (case sensitive)
  • f<char>: jump forward to the first occurance of <char> (case sensitive)
  • F<char>: jump backward to the first occurance of <char> (case sensitive)
  • t<char>: jump forward to <char> just before it. (case sensitive)
  • T<char>: jump backward to <char> just before it. (case sensitive)

command line mode

  • quit , q : quit
  • w: write
  • `help : help for