Join my Laravel for REST API's course on Udemy 👀

Relative line numbers in Visual Studio Code

April 8, 2021  ‐ 1 min read

The Vim extension in Visual Studio Code is one of the extension I use most pleasurably. Especially in with the Neovim Integration enabled. However, in (neo)vim I prefer to use relative line numbers. It makes jumping and using commands that span multiple lines much easier.

Luckily, using relative line numbers in Visual Studio Code doesn't require you to install another extension. It is supported in VS Code itself.

Open up the settings with Ctrl+, or via Preferences > Settings. In here look for the setting called "Editor: Line Numbers" and set it to "relative" for relative line numbers.

Visual Studio Code command palette

If your prefer to change the settings in the settings.json you can do so by adding the following line.

{
  ...
  "editor.lineNumbers": "relative",
  ...
}

That is all :).