Mouseless Code Editing with VS Code

alpha2phi
5 min readAug 21, 2021

Code faster in Visual Studio Code using Vim emulation.

VS Code + Vim

Overview

I use both VS Code and Neovim for coding. VS Code mostly at work and Neovim for personal projects. One thing in common is I prefer to use a modal editor to code.

For VS Code, to support modal editing, there are mainly 2 extensions we can use — VSCodeVim and vscode-neovim. vscode-neovim embeds a Neovim instance inside VS Code whereas VSCodeVim is a Vim emulator (Neovim integration is still experimental).

For beginners, you should start with VSCodeVim as it is much simpler to configure. This article explores how to improve productivity using VSCodeVim and its supported plugins. It is an introductory guide to modal editing, but basic Vim knowledge is still required.

Sensible Defaults

Here are few sensible defaults that you can customize to fit your workflow. Open File|Preferences|Settings (or Ctrl|Cmd ,), and select Extensions|Vim.

Highlighted Yank

With this setting enabled, whenever you yank/copy a selection, the region is highlighted temporarily. This is helpful for you to validate the selection is correct.

Highlighted Yank

Smart Relative Line Numbers

Enable this setting to show relative line numbers while editing.

Smart Relative Line Numbers

Leader key

It makes sense to set the Leader key to Space.

Map Home Row Keys to Escape

I prefer to map jk to Escape. You can use either Insert Mode Key Bindings Non Recursive or Insert Mode Key Bindings to achieve this.

Key Bindings in Insert Mode

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.