edit (insert mode) i before character I beginnig of line a next character A end line s delete character S delete line o next new line O previous new line cw delete word c$ delete line C delete rest of line d$ delete rest of line with no insert Ctrl+g shows file name at the bottom Esc exit insert mode navigate hjkl h5 j10 k5 l10 gj gk next word begining w 3w 4w 10w W 3W ignore ,.( end e 3e 4e 10e E 3E 4E 10E ignore ,.( before b 3b 4b 10b B 3B 4B 10B ignore ,.( look for next letter ti before next "i" fi on next "i" fC on next "C" Look for previous letter Ts after previous "s" on line Fl on previous "l" % look for "(" in line save :w :wq & exit :q exit :w! force to write :q! to quit mark (yank) V line V & arrow down lines 5V, 10V group of lines yw word yy line 4Y several lines y$ from cursor to end of line yi{ in curly braces paste p after line 2p repeat paste 2 times P before line :set paste for not indent on paste delete x character 2x, 10x dw word d2w 2 words d$ rest of line dd line 5dd, 10dd, 20dd D to the end of line 5D, 10D 20D C to the end of line & go to insert mode di{ in curly braces dip in paragraph change word cw from cursor ciw all word insert mode . any word ahead ci" in quotes ci( in parentheses add text to the end of line A & insert mode undo u 5u 10u redo Ctrl+r go to gg top of document G bottom ge end of previous word 2ge two words previous (end of word) 0 beginning of line $ end of line 10G line 10 w next word 2w next 2 words W next word ignoring special characters "({['"&%", etc 2W b previous word 2b previous 2 words B previous word ignoring special characters "({['"&%", etc 2B e end of word 2e end of 2 words 2+ up arrow 5+ down arrow 10+ right arrow 5+ left arrow page Ctrl+f forward (down) Ctrl+d 1/2 down 3Ctrl+f 3 down Ctrl+b backwards (up) Ctrl+u 1/2 up 4Ctrl+b 4 up Shift+h top of screen Shift+l bottom Shift+m middle scrolloff :set scrolloff=0 :set scrolloff=5 lines before top/bottom screen :set scrolloff shows the setting :set scrolloff=999 cursor always in the middle of screen replace r+o with "o" ce with new word & Esc c$ type new line & Esc search ahead * on word to search # on word to search backwards / and n for next N for previour Ctrl+o go back ? backwards n repeat search N repeat search backwards /\cdatabase Database/database /\CDatabase Database /\ " in " alone /\/\*\* "/**" q/ shows search history q? :q quit search history search & replace on entire document :%s/Enrique/ENRIQUE/g :%s/ENRIQUE/Enriquito/g replace between lines :6,10s/don/DON just first instance in line :10,19s/ENRIQUITO-TO/Enriquito/g in all line :4,13s/don/DON/gi case insensitive (don't/Don't) :4,13s/don/DON/gI case sensitive (don't/Don't) :4,13s/don/DON/gic case insensitive & ask if replace & ask to change :10,19s/ENRIQUITO-TO/Enriquito/gc run a command in vim :!ls :!pwd ask what command to run :w Ctrl+d :e Ctrl+d split window vertical split: open a document and then type :vsplit /path-to-document/document :vs :vsp :sp new_doc.txt :split /path-to-document/document open specified document, split screen Ctrl-w v Ctrl-w s split Ctrl+w & arrow to move between documents Ctrl+w x change windows' positions Ctrl+w r rotate windows Ctrl+w t goto top left window Ctrl+w b goto bottom right window Ctrl+w p goto previous window :set splitright :terminal :sp | terminal open a terminal beside vim window :e new_doc.txt open new document :resize 20 :resize 15 :resize -5 :vertical resize +10 :vertical resize -5 Ctrl+w = equal all windows Ctrl+w _ maximize window Ctrl+w | maximize width of window Ctrl+w o only active window Ctrl+g shows file name open files or buffers shows all buffers :buffers :ls :ba restore all buffers :2ba open buffer 2 :vert ba :vert 2ba :vsp | b3 open buffer 3 :help ctrl-w shows all ctrl-w commands :ve version of vim :set number shows line numbers :set nu :set nonumber :set nonu :e NewFile.txt open new file :edit NewFile.txt :w NewFile.backup save as a backup & keeps workin on same file Ctrl+g shows file name :view NewFile.txt open file on readonly :vie NewFile.txt shows line numbers with cursor on 0 line :set relativenumber :set rnu :set norelativenumber :set nornu repeat commands . q: shows command history :q quit command history highlight search :set hlsearch :set nohlsearch :noh :set incsearch :set noincsearch