DISCLAIMER:
These are my notes for quick reference and not meant to be an exhaustive VSCode + NeoVim cheatsheet. Refer to VSCode, NeoVim and vscode-neovim documentation for the latest details.
- Install NeoVim 0.10.0+ and VSCode.
- Install vscode-neovim plugin in VSCode.
- Enable system clipboard in NeoVim's
init.lua
--- Set clipboard to global clipboard vim.opt.clipboard:append("unnamedplus")
- Configure vscode-neovim plugin to start NeoVim with
--clean
option to avoid interfering NeoVim plugins -"vscode-neovim.neovimClean": true,
- (Optional) Configure vscode-neovim plugin to use composite keys for escape -
"vscode-neovim.compositeKeys": { "jj": { "command": "vscode-neovim.escape", }, "jk": { "command": "vscode-neovim.lua", "args": [ [ "local code = require('vscode')", "code.action('vscode-neovim.escape')", "code.action('workbench.action.files.save')", ], ], }, },
Keys | Action |
---|---|
Ctrl + Shift + p OR F1 |
Open Command Palette |
Ctrl + Shift + e |
Open Explorer |
Ctrl + Shift + f |
Open Search |
Ctrl + Shift + g |
Open Source Control |
Ctrl + Shift + d |
Open Debug |
Ctrl + Shift + x |
Open Extensions |
Ctrl + Shift + u |
Toggle Output |
Ctrl + Shift + m |
Toggle Problems |
Ctrl + Shift + y |
Toggle Debug Console |
Ctrl + ` |
Toggle Terminal |
Ctrl + b |
Toggle Primary Side Bar Visibility (Has to be in focus!) |
Ctrl + j |
Toggle Panel Visibility (Has to be in focus!) |
Ctrl + k z |
Toggle Zen Mode |
Ctrl + k Ctrl + o |
Open Folder |
Ctrl + o |
Open File or Folder (Depends on the context) |
Ctrl + k f |
Close Folder |
h , j , k , l |
Move between Selections |
Ctrl + n , Ctrl + p |
Move between Selections |
Keys | Action |
---|---|
a |
New File |
r |
Rename File |
v |
Open to Side |
d |
Delete File |
y |
Copy File |
x |
Cut File |
p |
Paste File |
A |
New Folder |
R |
Refresh File Explorer |
Keys | Action |
---|---|
:w |
Save Editor |
:wa |
Save All Editors with Changes |
:q |
Close Editor |
:q! |
Close Editor & Discard Changes |
:wq |
Save and Close Editor |
:xa |
Save and Close All Editors |
ZQ |
Close Editor & Discard Changes |
ZZ |
Save and Close Editor |
Ctrl + p |
Quick Open |
gf |
Open File whose name is under Cursor |
Ctrl + w n |
New Editor |
Ctrl + w q |
Close Editor |
Ctrl + w s |
Split Editor Horizontally |
Ctrl + w v |
Split Editor Vertically |
Ctrl + w = |
Make Editor Widths Even |
Ctrl + w + |
Increase Editor Height |
Ctrl + w - |
Decrease Editor Height |
Ctrl + w > |
Increase Editor Width |
Ctrl + w < |
Decrease Editor Width |
Ctrl + w k OR Ctrl + w Up |
Move to Editor Above |
Ctrl + w j OR Ctrl + w Down |
Move to Editor Below |
Ctrl + w h OR Ctrl + w Left |
Move to Editor on the Left |
Ctrl + w l OR Ctrl + w Right |
Move to Editor on the Right |
Ctrl + w Ctrl + k OR Ctrl + w Ctrl + Up |
Move Editor to Group Above |
Ctrl + w Ctrl + j OR Ctrl + w Ctrl + Down |
Move Editor to Group Below |
Ctrl + w Ctrl + h OR Ctrl + w Ctrl + Left |
Move Editor to Group on the Left |
Ctrl + w Ctrl + l OR Ctrl + w Ctrl + Right |
Move Editor to Group on the Right |
Ctrl + w Shift + k OR Ctrl + w Shift + Up |
Move Active Editor Group Above |
Ctrl + w Shift + j OR Ctrl + w Shift + Down |
Move Active Editor Group Below |
Ctrl + w Shift + h OR Ctrl + w Shift + Left |
Move Active Editor Group on the Left |
Ctrl + w Shift + l OR Ctrl + w Shift + Right |
Move Active Editor Group on the Right |
gT |
Move to Previous Editor in Group |
gt |
Move to Next Editor in Group |
Ctrl + w o |
Join All Editor Groups |
Keys | Action |
---|---|
"+y |
Copy Selection to + register |
"+P |
Paste from + register before Cursor |
"+p |
Paste from + register after Cursor |
Keys | Action |
---|---|
% |
Jump to next parenthesis or curly brackets |
0 |
Jump to first character in Line |
^ |
Jump to first non-blank character in Line |
gg |
Jump to the first Line |
G |
Jump to the last Line |
NG |
Jump to the Nth Line |
N$ |
Jump to the end of Nth Line |
H |
Jump to the top of Screen |
L |
Jump to the bottom of Screen |
M |
Jump to the middle of Screen |
zt |
Scroll Current Line to the top of Screen |
zb |
Scroll Current Line to the bottom of Screen |
zz |
Scroll Current Line to the middle of Screen |
Ctrl + u |
Scroll upwards by half a Window |
Ctrl + d |
Scroll downwards by half a Window |
Ctrl + w p |
Jump to the previously Active Window |
:marks |
List all the current marks |
m{a-z} |
Set mark {a-z} at Cursor for moving within File |
m{A-Z} |
Set mark {A-Z} at Cursor for moving between Files |
'{a-z} |
Jump to mark {a-z} within File |
'{A-Z} |
Jump to mark {A-Z} in the File where it is set |
:delmarks {a-zA-Z} |
Delete specified list of marks from {a-zA-Z} |
'"" |
Jump to the position when last editing the File |
'.. |
Jump to the position of the last change in the File |
'' |
Jump to the position before the last jump |
Ctrl + Space |
Trigger Suggestions |
gO |
Go to Symbol under Cursor |
gh |
Show Hover for Symbol under Cursor |
gd |
Reveal Definition for Symbol under Cursor |
gD |
Peek Definition for Symbol under Cursor |
Ctrl + w gd |
Reveal Definition Aside Symbol under Cursor |
gf |
Reveal Declaration Symbol under Cursor |
gF |
Peek Declaration Symbol under Cursor |
Ctrl + w gf |
Reveal Declaration Aside Symbol under Cursor |
gH |
Peek References Symbol under Cursor |
Alt + Shift + h |
Show Call Hierarchy |
Tab |
Switch between Peek Editor and References List |
Alt + Left |
Jump back to Symbol after Reveal Definition/Declaration |
z= |
Open Quick Fix |
/{pattern} |
Search {pattern} Forward |
?{pattern} |
Search {pattern} Backward |
n |
Repeat last Search |
N |
Repeat last Search in the opposite Direction |
Keys | Action |
---|---|
F2 |
Rename Symbol |
R |
Start Replace Mode |
= |
Format Selection |
== |
Format Line |
gq{motion} |
Format Lines within {motion} |
gu{motion} |
Convert Lines within {motion} or Current Line to Lowercase |
gU{motion} |
Convert Lines within {motion} or Current Line to Uppercase |
g~{motion} |
Swap case of Lines within {motion} or Current Line |
gc OR Ctrl + / |
Comment Selection |
gcc OR Ctrl + / |
Comment Line |
O |
Add Line Above |
o |
Add Line Below |
Alt + Up |
Move Line Above |
Alt + Down |
Move Line Below |
Alt + Shift + Up |
Copy Line Above |
Alt + Shift + Down |
Copy Line Below |
Ctrl + Alt + Up |
Add Cursor Above |
Ctrl + Alt + Down |
Add Cursor Below |
:reg |
List all the current registers |
"{a-z} |
Use register {a-z} for the next yank/delete/put |
q{a-z} |
Start recording a macro in register {a-z} |
q{A-Z} |
Start recording a macro and append to register {a-z} |
q |
Stop recording a macro |
Q |
Replay last recorded macro |
N@{a-z} |
Execute macro in register {a-z} for N times |
N@@ |
Execute previous @{a-z} for N times |
Ctrl + R {register} (Insert mode only) |
Insert the content of a register |
Ctrl + w (Insert mode only) |
Delete word before the Cursor |
Ctrl + u (Insert mode only) |
Delete all entered characters or all characters on the Line before the Cursor |
Ctrl + t (Insert mode only) |
Add indent on the Current Line |
Ctrl + td (Insert mode only) |
Delete indent on the Current Line |
>{motion} |
Indent {motion} right |
<{motion} |
Indent {motion} left |
J |
Join Lines in the Selection |
gJ |
Join Lines in the Selection without Space |
]p |
Paste after Cursor but adjust indent to Current Line |
[p |
Paste before Cursor but adjust indent to Current Line |
gp |
Paste after Cursor and leave Cursor after the pasted text |
gP |
Paste before Cursor and leave Cursor after the pasted text |
Nr{char} |
Replace N characters with {char} |
:%s/{pattern}/{string}/gc |
Search and Replace {pattern} with {string} in File (asking for confirmation on each match) |
& |
Repeat previous Search and Replace on Current Line without asking for confirmation |
Nyy |
Yank N Lines |
Ncc |
Change N Lines |
Ndd |
Delete N Lines |
Nu |
Undo last N changes |
NCtrl + R |
Redo last N undone changes |
N. |
Repeat last change N times |
Use these with an operator like v
, c
, d
, or y
Keys | Action |
---|---|
aw |
Full Word with leading or trailing Space |
iw |
Full Word without leading or trailing Space |
aW |
Full Word or several until and including leading or trailing Space |
iW |
Full Word or several until a leading or trailing Space |
as |
Full Sentence with leading or trailing Space |
is |
Full Sentence without leading or trailing Space |
aB |
From [{ to }] |
iB |
Within [{ and }] |
ab |
From [( to )] |
ib |
Within [( and )] |
at |
From Start Tag to End Tag e.g. <div> to </div> |
it |
Within Start Tag and End Tag |
a> |
From < to > e.g. <div> |
i> |
Within < and > |
a' |
Entire Single Quoted String |
i' |
Within a Single Quoted String |
a" |
Entire Double Quoted String |
i" |
Within a Double Quoted String |
a` |
Entire Backward Quoted String |
i` |
Within a Backward Quoted String |