Reload configuration after change: :so $MYVIMRC
navigate:
- hjkl: <v^>
- w: advance to beginning of next word
- b: rewind to beginning of next word
- e: advance to end of next word
- Ctrl-o: exit INSERT mode for one and only one command, then get back at it
- gd: Go to Definition
- gg: Go to the first line
- G: Go to the last line
- ma: set mark a
- 'a: go to mark a
^or_to go to the first non-whitespace character of a line$to go to the last non-whitespace character of a linef$cto go to the next$cof the line (for examplef?to move the curstor to the next?)F$cto go to the previous$cof the line (for examplef?to move the curstor to the previous?)
verbs:
- v: visual,
- c: change,
- d: delete,
- s: delete and switch to insert mode,
- x: delete character,
- y: yank/copy.
- p: put (P: put without yanking)
- q: format (e.g. restrict to 80 column)
modifiers:
- i: inside,
- a: around,
- t: till..finds a character,
- f: find..like till except including the char,
- /: search..find a string/regex
objects:
- w: word,
- s: sentence,
- p: paragraph,
- b: block/parentheses,
- t: tag (works for html/xml).
Sentences:
diw- delete the current wordciw- change current wordccorS- change linecis- change current sentenceci”- change a string inside quotesc/foo- change until next occurrence of ‘foo’ctX- change everything from here to the letter Xvap- visually select this paragraphd$- cut from here to the end of lineya(- yank around the enclosing parenthesis29j- Go down 29 timesdb- delete word backwardVp- Select line and replace by default registerV"0p- Select line and replace by the previous register (the one you paste no the one you replaced before)yiw- yank wordviwp- select whole word and paste (to replace a word with default register)viwP- select whole word and paste (to replace a word with default register without modifying the default register)
:%s/\s\+$//g
word
viw
from space to space:
viW
paragraph
vip
in the whole buffer:
:%s/foo/bar/g
with confirmation (add c)
:%s/foo/bar/gc
with confirmation starting at cursor to the end of the file
:.,$s/foo/bar/gc
in selection:
:'<,'>s/foo/bar/g
case insensitive: use \c anywhere in the search term
/cop\cyright
*- Forward search word under cursor#- Backward search word under cursor.- Repeat the last action (verb)A-f- CoC Autofix
Copy to clipboard:
"+y