You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.6 KiB
2.6 KiB
VIM Cheat Sheet
Split
<ctrl-w>sor:spor:splitsplit with line running horizontally<ctrl-w>vor:vspor:vsplitsplit with line running verticall<ctrl-w>arrowmove to pane<ctrl-w>cclose split<ctrl-w>oclose all other splits:qclose tab:tab splitmove split to new tab:sp | b1create new split with buffer 1
Buffers
:b[num]use buffer[num]:bnnext buffer:[num]bdunload buffer[num]
Tabs
gtgo to next tabgTgo to next tab[num]gtgo to tab[num]:tabnewopen new tab:tabcclose tab:tabeedit file in new tab
Auto Complete
<ctrl-x><ctrl-o>omni completion<ctrl-y>,emmet<ctrl-]>abbreviations<ctrl-n>word completion
Navigation
Cursor
hjkl- movew- move to next wordb- mve to previous wordHmove to top of screenMmove to middle of screenLmove to bottom of screen
Screen
<ctrl-f>page down<ctrl-b>page up<ctrl-d>half page down<ctrl-u>half page up<ctrl + y>to move the screen up one line.<ctrl + e>to move the screen down one line.zzto move the current line I'm on to the center of the screen.ztto move the current line I'm on to the top of the screen.zbto move the current line I'm on to the bottom of the screen.
Editing
dwdelete forward to end of worddbdelete backward to beginning of wordDdelete to end of lined^delete to beginning of linedvbdelete backward to beginning of word including current charxdelete current charXdelete previous char
Search
:vim a *.*- search for 'a' in all files in dir:copen/ccloseopen quickfix list to view matches of:vim/findnfind next matchNfind previous match:nohstop search highlight:%s/wordtochange/changedvalue/gcsearch/replace
Copying
"+ycopys visual selection to clipboardyycopys entire line[num]yyyank[num]linesybyank previous wordywyank next word
Formatting
=auto indent selection/linegg=Gauto indent entire bufferJjoin current line with next line
Comments
\c<space>- Nerdcommentor<ctrl-v>then select block. Then<shift-i>to enter insert. Enter text and hitEsc
Selection
vvisual characterVvisual line<ctrl-v>visual block<option-click>visual block, highlight from start to click point
Commands
:%s/\s\+$//etrim ending whitespace:%retab!convert spaces to tabsNERDTreeopen up nerd tree file explorer
NERDTree
rrefresh tree