If you've been wanting to try out and learn vim, but don't want to leave the comforts of VS Code behind, this tutorial is for you. In this tutorial, I will show you how to achieve (what I consider to be) the best of both worlds when it comes to using these tools together.
Installation
First, we'll start off by adding the Neovim extension for VS Code. Once that extension is installed, we're going to need to point the extension at an instance of neovim. It's very important that we use v0.5.0 instead of anything v0.4 or lower. If you do, you'll experience a hard time with this extension.
Once you download and install the Neovim v0.5.0, you're going to want to point your Neovim extension at this installation.
Configuration
I like to turn the ctrl keys for insert and normal mode off. This means you can still use ctrl + c all the other vs code keybindings will work as expected.
I also like to double-tap j while in insert mode to escape into normal mode. You can add the following snippet to your keybindings.json
if you'd like:
{
"command": "vscode-neovim.compositeEscape1",
"key": "j",
"when": "neovim.mode == insert && editorTextFocus",
"args": "j"
}
Conclusion
I hope you enjoy learning VIM from the comfort of your VS Code editor! Here's a great VIM cheat sheet I have bookmarked with a bunch of great and useful keyboard shortcuts for VIM.