Basic vim commands

The most basic vim commands

Cursor navigation
w/b: move forward/backward by a word 0: start of line ^: first non-blank character of line $: end of line gg: start of file G: end of file ^u/^d: len xuong 1/2 page ^f/^b: len xuong 1 page :f: hien thi ten file va dong hien tai

Edit
i/a: insert mode (before/after) I: insert at the beginning of line A: append at the end of line O/o: insert blank line (before/after) d$/D: delete the characters under the cursor until the end of the line dG: delete from the current line to the end of file 5dd: delete five lines u: undo

Copy/Paste
yy: yank (copy) a line 2yy: yank 2 lines p: paste the clipboard after cursor P: paste before cursor

Paste mode
To turn off auto-indent function of vim :set paste (paste text) :set nopaste

Visual mode
vGx: delete from cursor to the end of file vy: yank (copy multilines easily) CtrlV --> select block --> I --> type # --> ESC

File explorer
Open integrated file explorer :Sex   Split window and open integrated file explorer :Sex! Same as :Sex but split window vertically :cd.. Move to parent directory :args  List files

Windows splitting
:split filename Split the window and open filename ctrl-w up arrow Puts cursor in top window ctrl-w ctrl-w  Puts cursor in next window ctrl-w_        Maximize current window vertically ctrl-w|        Maximize current window horizontally ctrl-w=        Gives the same size to all windows :vsplit file   Split window vertically :sview file    Same as :split in readonly mode :hide          Close current window :­nly           Close all windows, excepted current