Show Menu
Cheatography

VSCode Vim Cheat Sheet (DRAFT) by

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­}{m­otion} 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 charac­ter­-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 increa­singly bigger blocks of text
gb
Adds an additional cursor
{motio­n}{­ope­rator} In visual mode first you specify the motion to select text and then you apply the operator

Vim Surround

ds{exi­sting}
Delete {existing} surround
cs{exi­sti­ng}­{de­sired}
Change {existing} surround to {desired}
ys{mot­ion­}{d­esired}
Add {desired} surround to text defined by {motion}
S{desired}
Surround selection when in visual mode

VSCode Keybin­dings

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}
<le­ade­r>tt
Create new tab
<le­ade­r>tc
Close tab
<le­ade­r>to
Close all tabs but the current one
<le­ade­r>tl
Move tab to the right
<le­ade­r>th
Move tab to the left
<le­ade­r>tn
Move the tab to the group on the right
<le­ade­r>tp
Move the tab to the group on the left
<le­ade­r>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
<le­ade­r>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
<le­ade­r>j
Join lines
gcc
Toggle line comment
gC
Toggle block comment
yyp
Duplicate line
ddp
Swap lines
xp
Swap characters
=
Format
.
Repeat last command
{opera­tor­}{c­oun­t}{­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
{opera­tor}gn
Apply {operator} on next match
Ctrl + n
Clear highli­ghted text
{pattern} is a regex

Find Character

f{char­acter}
Jump to next occurrence of {chara­cter}
F{char­acter}
Jump to previous occurrence of {chara­cter}
t{char­acter}
Jump to before next occurrence of {chara­cter}
T{char­acter}
Jump to after previous occurrence of {chara­cter}
;
Repeat previous f, t, F or T
,
Repeat previous f, t, F or T backwards

Vim Easymotion

<le­ade­r><­lea­der­>w
Start of words
<le­ade­r><­lea­der­>b
Start of words backwards
<le­ade­r><­lea­der­><l­ead­er>bdw
Start of words everywhere
<le­ade­r><­lea­der­>e
End of words
<le­ade­r><­lea­der­>ge
End of words backwards
<le­ade­r><­lea­der­><l­ead­er>bde
End of words everywhere
<le­ade­r><­lea­der­>j
Beginning of lines
<le­ade­r><­lea­der­>k
Beginning of lines backwards
<le­ade­r><­lea­der­>f{­cha­racter}
Find {chara­cter}
<le­ade­r><­lea­der­>F{­cha­racter}
Find {chara­cter} backwards
<le­ade­r><­lea­der­>t{­cha­racter}
Until {chara­cter}
<le­ade­r><­lea­der­>T{­cha­racter}
Until {chara­cter} backwards
<le­ade­r><­lea­der­>s{­cha­racter}
Search {chara­cter} 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 parent­heses
dab
Delete text and parent­heses
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
{opera­tor­}a{­tex­t-o­bject} Apply operator to all {text-­object} including space after o before it
{opera­tor­}i{­tex­t-o­bject} 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/{pa­ttern}
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