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 :w FileName.txt # When start new document with no name :wq & exit :q exit :w! force to write :q! to quit Ctrl-w c 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 8gg to to line 8 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 :%s/ENRIQUE/Enriquito/gc ask if replace 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 :10,19s/ENRIQUITO-TO/Enriquito/gc ask if replace 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 :sp :split :vs :vsplit :10sp .bashrc open file with 10 lines :help splits Ctrl-w v vertical split Ctrl-w s horizontal split Ctrl-w c to quit Ctrl+w & arrow to move between documents Ctrl+w x change windows' positions Ctrl+w o only active window Ctrl+w r rotate windows 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 Ctrl+w H change split to vertical Ctrl+w K change split to horizontal :set splitright :terminal :sp | terminal open a terminal beside vim window :vs | :terminal :terminal :e new_doc.txt open new document :resize 20 :resize +15 :resize -5 :res -10 :vertical resize +10 :vertical resize -5 :resize go back to normal :res Ctrl+w = equal all windows Ctrl+w _ maximize window Ctrl+w + add line to window Ctrl+w > add line Ctrl+w 5> add 5 lines Ctrl+w - subtract line from window Ctrl+w < subtract Ctrl+w 5< subtract 5 lines Ctrl+w | maximize width of window Ctrl+w o only active window Ctrl+g shows file name Ctrl+w r rotate window Ctrl+w shift k move top Ctrl+w shift j bottom Ctrl+w shift l right Ctrl+w shift h left Tabs vim -p file1.txt file2.txt file3.txt opens all files on tabs Ctrl+w shift t puts windows on tabs gt moves between tabs 2gt go to tab 2 g shift t moves between tabs back :tabnew :tabedit ~/.bashrc :tab help :tab split :0tabnew open new tab 0 position :tabnext or gt :tabprevious or gT :tabfirst :tablast :tabmove :tabmove 0 :tabmove +- :tabmove +2 :tabmove -2 :tabs shows each file on its tab :tabonly closes all tabs open files or buffers shows all buffers :buffers :ls :ba restore all buffers :b1 switch to buffer 1 :1b :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 :view NewFile.txt open file on readonly :vie NewFile.txt Ctrl+6 switch to last buffer Ctrl+g shows file name 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 Find files :find *.txt :find Doc+tab :find Documents/*.txt :e . + enter go to file manager :e Documents/. enter % = Shift+5 create a new document Shift+5