VIM Simple Vim VSCode VsVim
Cheat sheet for Simple Vim in VSCode
https://marketplace.visualstudio.com/items?itemName=jpotterm.simple-vim
Move around
1Ctrl+b page up
2Ctrl+f page down
3$ end of line
4% matching bracket
5[{ previous bracket or next: ]}
6* or # Jump to next/prev occurrence of word under cursor
7A Move to end of line and enter Insert mode.
8I Move to beginning of line and enter Insert mode.
9dd Delete current line.
10dw Delete current word.
11c Delete current character.
Selection
1c Delete range and enter insert mode.
2ggVG Select all
3< or > Intent, repeat with .
Comment out block
10 go to start of line
2ctrl + V enter select vertical mode
3j go down
4shift + I put cursors
5// to select
https://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim
Copy paste
1yy Yank current line.
- Select characters: v or V (whole line)
- Press d to cut or y to copy
- Press P to paste before the cursor or p to paste after*
d stands for delete in Vim, which in other editors is usually called cut y stands for yank in Vim, which in other editors is usually called copy Source: http://vim.wikia.com/wiki/Copy,_cut_and_paste
Macro
1qa Record macro to 'a'-register
2_ Jump to beginning of line and do what macro will do
3jq Jump down to next line and end macro recording
4
5@a play macro
65@a play macro on next 5 lines
Source: https://stackoverflow.com/questions/11784408/vim-multiline-editing-like-in-sublimetext
Recursive macro
1qq4f,lr[Enter]@qq
2
3qq starts a new macro called q.
44f, finds the forth ,
5l moves to the right of it
6renter replaces the space with an enter
7@q calls the macro you have just made to recursively call it
8q to finish recording
9
10Then simple @q to format it.