/vscode-relative-line-numbers

Implementation of relative line numbers for vscode

Primary LanguageTypeScriptMIT LicenseMIT

NOTE: THIS IS NOW DEPRECATED WITH VSCODE 1.6

Use the editor.lineNumbers setting with the value of relative for a better experience

See Visual Studio Code 1.6 Release Notes for more details.


vscode-relative-line-numbers

demo

vscode-relative-line-numbers is a simple Visual Studio Code extension that adds relative line numbers to Visual Studio Code.

This is useful if you are using one of the VIM plugins - ie, VSCodeVim

Install

  • Open the command palette in Visual Studio Code (Ctrl-Shift-P or Cmd-Shift-P)
  • Select Install Extension and search for 'Relative line numbers'

Commands

Relative Line Numbers: Disable (extension.relativeLineNumbersDisable) - turn off relative line numbering. This is useful when debugging or in other situations where other gutter icons need to be visible.

Relative Line Numbers: Enable (extension.relativeLineNumbersEnable) - turn relative line numbering back on.

Use Control+Shift+P to open the command palette and run the commands.

Source

Github

Issues

The Visual Studio Code API doesn't support a great way to add this functionality. It does expose a way to add 'gutter images', which is how this plugin adds the relative line numbers, but it breaks other functionality that uses the gutter images.

It'd be great to at least minimize the issues in other scenarios - for example, only enabling this in non-debug modes. Any feedback or ideas are appreciated.

The images are generated using phantomjs by a the generate-images.js file. You can modify that file to change the styling, and run npm run generate-images to generate a new set of images.

License

MIT License