Skip to content

Vim Cheatsheet

Antoniy Chonkov edited this page Dec 28, 2019 · 1 revision

Vim Wiki

Splits

Folding

Custom Cmd Description
<leader>z open a fold and close all other folds
Command Description
zr reduces fold level throughout the buffer
zR opens all folds
zm increases fold level throughout the buffer
zM folds everything all the way
za toggle open/close a fold your cursor is on
zA toggle open/close a fold your cursor is on recursively
zc close a fold your cursor is on
zC close a fold your cursor is on recursively
za open a fold your cursor is on
zA open a fold your cursor is on recursively
:h fold-commands get detailed information on each of the above

Markdown

Bindings

Binding Description
<leader>tf mapping to invoke :TableFormat
<leader>l create a link from the word bellow the cursor
<leader>md start markdown live preview server: localhost:8090
ge open the link under the cursor in Vim for editing.
gx open the link under the cursor in the same browser link
]] go to next header
[[ go to previous header
][ go to next sibling header
[] go to previous sibling header
]c go to curren header
]u go to parent header

Commands

Command Description
:TableFormat using tabular plugin - format ascii table
:HeaderDecrease decrease level of all headers in buffer
:HeaderIncrease increase level of all headers in buffer
:Toc create a quickfix vertical window for navigation
:Toch same as :Toc but in horizontal window
:Toct same as :Toc but in new tab
:h vim-markdown manual for the main markdown plugin
:h instant-markdown manual for the markdown live preview plugin
:h markdown-folding manual for the auto folding plugin used

Comments

via a plugin vim-commentary

General use: <number>gc<text-objext>

  • [num]gcc:Comment a line. if num is specifid - do it num times.
    • 5gcc: comment current line and 4 lines bellow
  • gc[num]<motion>: Comment num times using motion as direction.
    • gc10j: comment current line + 10 lines below
  • gc<obj>: Comment a text object.
    • gcip: comment in paragraph
    • gcap: comment around paragraph
  • :h commentary: Plugin manual.

Plugins

vim-surround

Binding Description

tabular

Formats ASCII tables. Useful for use in markdown formatting.

Command Description
;h tabular plugin manual
`:Tabulize / `

Clone this wiki locally