About vim
Movement
- h/j/k/l left/down/up/right
- 0/^ to first/last non-space symbol
- $/g_ to start/end of line
- w/e word forward (stop at work start/end)
- b/ge word backward (stop at work start/end)
- (/{/)/} sentence/paragraph forward/backward
- ’[/’] to start/end last change
- ’</’> to start/end last selection
- ’. to last edit
- % to matching symbol (parenthes, etc)
Visual mode
- gv restore the last selection
- aw (iw) select word (word inside)
- as/ap/at/a[/a(/a</a{/a”/a’/a` select sentence, paragraph, tag, parenthes, quotes
Marks
- m{a-zA-Z} set mark
- '{a-zA-Z} go to mark (a-z - in current file, A-Z0-9 - in all files)
- '. go to last edit
- '[/’] to start/end last change
- '</’> to start/end last selection
- :marks show marks
Registers
- 0 last copy
- 1-9 last 9 deletions (stack)
- a-z named; copy to ‘A’ appends value to ‘a’
- . last insert
- +/* clipboard (primary/secondary)
- / last search
- _ “black hole”
Implicit register set - use ", e.g. "ayy = copy current line to register ‘a’.
Misc
Later ‘[]’ = movement commands
- g8 show hex value of a symbol under cursor
- g^ go to leftmost nonspace
- g_ go to rightmost nonspace
- g~[] change case
- gu lowecase
- gU uppercase
- f/F{} go to N-th symbol ‘{}’ (N should set before command)
- ; repeat last ‘f/F’
- , repeat last ‘f/F’ in the reverse direction
- z update screen