zf- create foldzd- delete foldzo- open foldzc- close foldzj- next foldzk- previous foldzM- close all folds in filezR- open all folds in file
w - inside word
W - everything that is not white space
i - inside
ex. viw - select inside word
a - all
p - paragraph
ex. dap - delete entire paragraph
c- delete + enter insert mode
Jump list - see all "big movements" inside the file
:jumpCTRL+O- go to previous jumpCTRL+I- go to next jump in history
When viewing list of options:
CTRL+N- go nextCTRL+D- go previous
G- end of filegg- start of file$- end of linezzcenter file{ }- jump between paragraphs[m/]m- move to next opening block, ex.{}in JS%- jump between bracket pairs
^- start of linef- find character- + SHIFT - reverse order
t- find up to the character- + SHIFT - reverse order
;- move to next occurence,- move to prev occurence
When in visual selection press : to search in that selection
/<search query>- runs the search querys/<search>/<replace>- runs search and replace (single line)%s/<search>/<replace>- search & replace in entire file:nohls- clears highlighted results
Quickfix list has two types of results:
-
entries - actual line that matched the search
-
file - file that contained the result
-
:copen- opens quickfix list -
:cdo- apply commands on all entries in quickfix list- Run macro on all results and update file:
:cdo execute "norm @q" | update
- Run macro on all results and update file:
-
:cfdo- apply commands on all files in quickfix list- Run search and replace on every file and update:
:cfdo s/v2/v3/ | update
- Run search and replace on every file and update:
Reference
Open qfl from buffer contents
:cexpr join(getline(1,'$'), "\n")Macros record every key stroke, and replay them
q<letter>- start recording macro- Ex.
ga- assigns macro to lettera
- Ex.
@<letter>- runs assigned macro- PROTIP: Macro can be replayed several times, ex.
5@a
- PROTIP: Macro can be replayed several times, ex.
CTRL+W(reffered as<W>) - enter window mode<W> + CTRL+O- close all other windows except the focused one<W> + CTRL+V- open new window in horizontal mode
In esence they are key -> value store
:reg- view all registers
Types of registers:
"- recent yank0-9- yank and deletion history<letter>- arbitrary registers saved by us (incl. macros)%- path to the current file
To re-run whatever was saved in register we can use " + key of register + some motion
Example: "ap - will paste everything from register a
- In visual mode:
o- jump between start and end of selection CTRL+A- increase number by 1 inside selection (or cursor)D- remove everything after the cursorCTRL+^- go to previous fileCTRL-C=<Esc>set conceallevel=2- hide Markdown syntax (like `):verbose imap <remap>- check if a remap is already used in config or by plugin