Cheatography
https://cheatography.com
VSCode Vim custom shortcuts.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Basics
h |
Move left |
j |
Move down |
k |
Move up |
l |
Move right |
i |
Insert mode |
jj |
Normal mode |
gh |
Mouse hover |
{count}{motion} Repeat {motion} {count} times
Horizontal Movement
0 |
Jump to the start of the line |
$ |
Jump to the end of the line |
_ |
Jump to the first non-blank character of a line |
g_ |
Jump to the last non-blank character of a line |
Vertical Movement
gg |
Go to the first line of the document |
G |
Go to the last line of the document |
{line}gg |
Go to {line} |
} |
Jump to next paragraph |
{ |
Jump to previous paragraph |
) |
Jump to next sentence |
( |
Jump to previous sentence |
% |
Jump to matching (), [], {} |
gd |
Go to definition |
gD |
Open definition aside |
gf |
Go to file under the cursor |
H |
Jump to top of screen |
M |
Jump to middle of screen |
L |
Jump to bottom of screen |
Ctrl + e |
Move screen down one line |
Ctrl + y |
Move screen up one line |
Ctrl + d |
Jump forward 1/2 a screen |
Ctrl + u |
Jump back 1/2 a screen |
Word Movement
w |
Jump to the beginning of the next word |
W |
Jump to the beginning of the next WORD |
e |
Jump to the end of the next word |
E |
Jump to the end of the next WORD |
b |
Jump to the beginning of the previous word |
B |
Jump to the beginning of the previous WORD |
ge |
Jump to the end of the previous word |
gE |
Jump to the end of the previous WORD |
Insert Mode
i |
Insert before cursor |
I |
Insert at the beginning of the line |
a |
Insert (append) after the cursor |
A |
Insert (append) at the end of the line |
o |
Insert a new line below the current line |
O |
Insert a new line above the current line |
ea |
Insert (append) at the end of the word |
Ctrl + h |
Delete character before the cursor during insert mode |
Ctrl + w |
Delete word before the cursor during insert mode |
gi |
Go to last place you left insert mode |
jj |
Exit insert mode |
Visual Mode
v |
Go into character-wise visual mode |
V |
Go into line-wise visual mode |
Ctrl + v |
Go into block-wise visual mode |
aw |
Select a word |
iw |
Select inner word |
ab |
Select a block with () |
ib |
Select inner block with () |
aB |
Select a block with {} |
iB |
Select inner block with {} |
at |
Select a block with <> tags |
it |
Select inner block with <> tags |
o |
Move to other end of marked area |
O |
Move to other corner of block |
y |
Yank selected text |
d |
Delete marked text |
u |
Changed selected text to lowercase |
U |
Changed selected text to uppercase |
af |
Select increasingly bigger blocks of text |
gb |
Adds an additional cursor |
{motion}{operator} In visual mode first you specify the motion to select text and then you apply the operator
Vim Surround
ds{existing} |
Delete {existing} surround |
cs{existing}{desired} |
Change {existing} surround to {desired} |
ys{motion}{desired} |
Add {desired} surround to text defined by {motion} |
S{desired} |
Surround selection when in visual mode |
VSCode Keybindings
Ctrl + p |
Open command palette |
> |
List every command |
@ |
List every local symbol |
Ctrl + Shift + . |
Open local symbol list |
# |
List every global symbol |
Ctrl + Shift + ñ |
Create new terminal |
Ctrl + ñ |
Toggle terminal |
Ctrl + PageDown |
Focus next terminal group |
Ctrl + PageUp |
Focus previous terminal group |
Alt + DownArrow |
Focus next terminal in group |
Alt + UpArrow |
Focus previous terminal in group |
Tabs
gt |
Move to next tab |
gT |
Move to previous tab |
{number}gt |
Move to tab {number} |
<leader>tt |
Create new tab |
<leader>tc |
Close tab |
<leader>to |
Close all tabs but the current one |
<leader>tl |
Move tab to the right |
<leader>th |
Move tab to the left |
<leader>tn |
Move the tab to the group on the right |
<leader>tp |
Move the tab to the group on the left |
<leader>te |
Even tabs widths |
|
|
Editing
r |
Replace a single character |
R |
Replace until ESC is pressed |
x |
Delete a character |
X |
Delete character before the cursor |
s |
Delete character and substitute text |
d |
Delete up to {motion} |
dd |
Delete line |
<leader>dd |
Delete to void |
D |
Delete to the end of the line |
c |
Change up to {motion} |
cc |
Change a line |
C |
Change to the end of the line |
y |
Yank (copy) {motion} |
yy |
Yank a line |
Y |
Yank a line. (= yy) |
p |
Paste |
P |
Paste before the cursor |
~ |
Switch case |
g~ |
Switch case up to {motion} |
g~~ |
Switch case of a line |
gu |
Switch to lowercase up to {motion} |
gU |
Switch to uppercase up to {motion} |
> |
Shift text right |
< |
Shift text left |
<leader>j |
Join lines |
gcc |
Toggle line comment |
gC |
Toggle block comment |
yyp |
Duplicate line |
ddp |
Swap lines |
xp |
Swap characters |
= |
Format |
. |
Repeat last command |
{operator}{count}{motion} Apply {operator} on {motion}
Search
/{pattern} |
Search for {pattern} |
?{pattern} |
Search for {pattern} backwards |
/ |
Repeat last search forwards |
? |
Repeat last search backwards |
n |
Go to next match |
N |
Go to previous match |
{operator}gn |
Apply {operator} on next match |
Ctrl + n |
Clear highlighted text |
Find Character
f{character} |
Jump to next occurrence of {character} |
F{character} |
Jump to previous occurrence of {character} |
t{character} |
Jump to before next occurrence of {character} |
T{character} |
Jump to after previous occurrence of {character} |
; |
Repeat previous f, t, F or T |
, |
Repeat previous f, t, F or T backwards |
Vim Easymotion
<leader><leader>w |
Start of words |
<leader><leader>b |
Start of words backwards |
<leader><leader><leader>bdw |
Start of words everywhere |
<leader><leader>e |
End of words |
<leader><leader>ge |
End of words backwards |
<leader><leader><leader>bde |
End of words everywhere |
<leader><leader>j |
Beginning of lines |
<leader><leader>k |
Beginning of lines backwards |
<leader><leader>f{character} |
Find {character} |
<leader><leader>F{character} |
Find {character} backwards |
<leader><leader>t{character} |
Until {character} |
<leader><leader>T{character} |
Until {character} backwards |
<leader><leader>s{character} |
Search {character} everywhere |
Text Objects
diw |
Delete inner word |
daw |
Delete a word |
dis |
Delete inner sentence |
das |
Delete a sentence |
dip |
Delete inner paragraph |
dap |
Delete a paragraph |
dib |
Delete inside parentheses |
dab |
Delete text and parentheses |
diB |
Delete inside braces |
daB |
Delete text and braces |
di[ |
Delete inside brackets |
da[ |
Delete text and brackets |
di" |
Delete inside quotes |
da" |
Delete text and quotes |
dit |
Delete inside tag |
dat |
Delete text and tag |
{operator}a{text-object} Apply operator to all {text-object} including space after o before it
{operator}i{text-object} Apply operator to {text-object}
'dib' = 'di(' | 'diB' = 'di{'
Can be use with other operators (E.g: ciw)
Folding
zf{count}j |
Create a fold from the cursor down {count} lines |
zf/{pattern} |
Create a fold from the cursor to {pattern} |
za |
Toggle fold at the cursor |
zo |
Open fold under cursor |
zO |
Open all folds |
zc |
Close fold under cursor |
zM |
Close all folds |
zd |
Delete fold at the cursor |
zE |
Delete all folds |
Split Windows
Ctrl-w + s |
Open same file in a horizontal split |
Ctrl-w + v |
Open same file in a vertical split |
Ctrl + h |
Move to the window on the left |
Ctrl + j |
Move to the window below |
Ctrl + k |
Move to the window above |
Ctrl + l |
Move to the window on the right |
Undo and Redo
u |
Undo last change |
Ctrl + R |
Redo last undo |
U |
Undo last changed line |
|