Vim Cheatsheet

Thankfully I remember most of these but all of them are great :)

  • MD to PDF and MD to HTML are custom.
ShortcutFunction
g + tNext tab
g + TPrevious tab
z + zCenter on this line
Ctrl + [, Ctrl + ]Previous or next tab
Ctrl + w + sHorizontal split
Ctrl + w + vVertical split
Ctrl + w + qClose
Ctrl + w + wSwitch splits
Ctrl + j, h, k, lMove around
<leader> + NToggle number
<leader> + rShortcut to replace, press * on word then type replacement
<leader> + p + pMD to PDF
<leader> + p + hMD to HTML

How to macro

To enter a macro, type: q<letter><commands>q

To execute the macro number of times (once by default), type: <number>@<letter>

So, the complete process looks like:

CommandWhat happens
qdstart recording to register
...your complex series of commands
qstop recording
@dexecute your macro
@@execute your macro again

Insert text into multiple lines at once

Press Ctrl + v to enter into visual block mode.

Use / / j / k to select multiple lines.

Press Shift + i and start typing what you want.

After you press Esc, the text will be inserted into all the lines you selected.

Plugins

Telescope

ShortcutFunction
leader + f + fFind files
leader + f + gLive grep
leader + f + kList key-maps and search
Ctrl + xOpen in vertical split
Ctrl + vOpen in horizontal split

FzF

ShortcutFunction
:FilesSearch files.
:GFiles?Git files (git status).
:BuffersOpen buffers.

LSP

ShortcutFunction
g + lCheck message on the side.
g + DGo to declaration.
g + dGo to definition.
KHover message.
g + rGoto references.
:lua vim.lsp.buf.formatting_sync()Format code.