This is my vim cheat sheet 🚀
Basics Link to heading
Syntax of commands is broken into number + verbs + nouns. So for example 2dw means, delete two words:
2 for two 
d for delete 
w for word 
Basic verbs Link to heading
| Basics | Verbs | 
|---|---|
| hjmovekaroundl | ddeletecchange<>indentvVvisual select *yyank | 
* : the latter (
V) selects whole lines.
* :uUto lower/upper case selection in visual mode.
* :oin visual mode will move the cursor from beginning to end.
Basic Nouns (movements) Link to heading
| Horizontal Movements | Vertical Movements | 
|---|---|
| wWforward 1 word *bBbackwards 1 word *eEto last character in current word *gegEto end of previous word *0$front and end of line^first non-whitespace char in line%to matching brace, bracket, etc… | ggGbeginning/end of doc{}up/down 1 paragraph<c-u><c-d>up/down ½ page*#to next/previous instance of the same wordf<?>F<?>go on top of next/prev<?>**t<?>T<?>go to next/prev<?>**;,next/previous go to | 
* : the latter (
W,B,E,gE) use whitespace as boundaries.
** :<?>can be any character.
Add, Copy, Paste, Cut, Delete Link to heading
| Add | Copy/Paste | Cut/Delete | 
|---|---|---|
| iinsertIinsert start of lineainsert after cursorAinsert end of lineoinsert on new line belowOinsert on new line above | ylyank charywyank wordyyYyank lineppaste after current linePpaste before current line | dldelete chardwdelete worddddelete linexdelete char (same asdl)Xdelete char before cursor | 
Note: Deletions always work like cut, that is, deleted object is put into a register so that it can be pasted later.
Change, Replace, Undo, Repeat Link to heading
| Change | Replace | Undo/Repeat | 
|---|---|---|
| clchange charcwchange wordccchange lineCchange from cursor to end of lineslchange charSchange line | rreplace single charRreplace until stop typing~change char case | uundoUundo current line<c-r>redo.repeat command | 
More Nouns Link to heading
| Nouns / Movements | 
|---|
| iwinner word (select whole word)itinner tag (select inside tag)ipinner paragraphi"i'inner quotesa{brackets and everything inside | 
Note: Use
ainstead ofiin these examples to include whitespaces or surrounding symbol.
Note: Doing these outside selected pair will jump to next one. For example doing
vi(outside a()pair will jump to the next(and select everything inside those brackets. Doingva(will include the brackets.
Commands Link to heading
Find, Save, Quit Link to heading
| Find | Save/Quit | 
|---|---|
| /?search forwards/backwardsnnext hitNprev hit | :wsave:qquitZZsave and quit | 
Replace/Delete Link to heading
| Command | 
|---|
| :s/<old>/<new>replace old with new on selected lines:%s/<old>/<new>/greplace old with new globally:%s/<old>/<new>/gcreplace old with new with confirmation:s/\(\d\+\)/number \1using regex capture groups:g/<pattern>/ddelete line matching pattern | 
Bash Link to heading
| Command | 
|---|
| :!grep "find this string" % | 
Note: The file you have opened is
%in this example!
Macros Link to heading
| Create | Apply | View | 
|---|---|---|
| qrstart recording *do anything when recording qin normal mode to finish | @rapply macro | :reg rlook at r register:reglook at all registers | 
* : You can use any letter
atozinstead ofr, these are just register names!
Clipboard & Buffers Link to heading
| Clipboard | Buffers | 
|---|---|
| "+ppaste from clipboard *"+yyyank line to clipboard * | :lslist buffers:b <?>switch buffer **:bd <?>close buffer ** | 
*: The clipboard is the
+register. To access a register you start with".
**:<?>is optional and can be a number or part of name.
Cursor Link to heading
| Multicursor edit | Cursor Position | 
|---|---|
| e.g. commenting out 4 lines would be: 0go to beginning of line<c-v>enter visual block mode3jalso select next 3 linesIinsert at beginning//add comment<ESC>exit insert mode | HMLmove cursor to top/middle/bottom of screenztzzzbscroll so cursor is on top/middle/bottom | 
Windows Link to heading
| Create | Manipulate | Navigate | 
|---|---|---|
| <c-w>ssplit (horizontally)<c-w>vsplit vertically<c-w>oclose others<c-w>cclose | <c-w>H<c-w>Jmove window<c-w>Karound<c-w>L<c-w>xswap positions | <c-w>h<c-w>jmove cursor<c-w>karound windows<c-w>l<c-w>wmove to next | 
Misc Link to heading
| Netrw | Misc | 
|---|---|
| :Exopen netrw%create file in netrw | :sosource open file<c-a>increment number | 
Plugins Link to heading
Kickstart your nvim configuration with kickstart.
| Commands | 
|---|
| :Telescope keymapssearch in keymaps:GenTocGFMgenerate markdown toc:Masonlist tools (ito install) | 
| Navigation | 
|---|
| <leader>sfsearch files<leader>sggrep filessjump forward/backward/to other windows | 
Note: Jump commands come from the Flash plugin.
| Code | 
|---|
| gdgo to definition *grgo to references *gc<motion>comment out selection=auto indent selection, i.e.=ap,=GKDisplay symbol info | 
* : Select up and down with
<c-p>and<c-n>.
Quick lists Link to heading
Quick lists are useful when searching for a word in your project, and get a list of all the files containing that word.
You can open up quick list of all the files in your project containing foo by opening up telescope, searching for foo and pressing <c-q>.
Then replace foo with bar by running :cdo s/foo/bar/ | update. Close all buffers opened by this command by running :cfdo bd.