Skip to content

slhsxcmy/vscode-double-line-numbers

Repository files navigation

Double Line Numbers

This is a Visual Studio Code extension that allows you adjust the display of line numbers to a combination of absolute and relative settings.

This should be helpful if you use one of the Vim plugins VSCodeVim, or are learning Vim like me.

The Visual Studio Code API doesn't support a great way to display anything on the left of the built-in line numbers. Therefore, "gutterIcon" is used to display the left line numbers as SVGs.

Any feedback or ideas are appreciated. If you find any bugs, please let me know through issues!

Installation

  • Install Double Line Numbers in the Extentions Marketplace
  • Optional: You can customize the left line numbers appearance by going to Settings > Extentions > Double Line Numbers.

Commands

Open the command palette (Cmd/Ctrl + Shift + P) and run one of the following commands:

  • Double Line Numbers: Absolute + Relative - show absolute line numbers on the left and relative line numbers on the right.

  • Double Line Numbers: Relative + Absolute - show relative line numbers on the left and absolute line numbers on the right.

  • Double Line Numbers: Absolute - only show absolute line numbers, essentially setting the built-in setting editor.lineNumbers to on.

  • Double Line Numbers: Relative - only show relative line numbers, essentially setting the built-in setting editor.lineNumbers to relative.

  • Double Line Numbers: Off - turn off all line numbers, essentially setting the built-in setting editor.lineNumbers to off.

Known Issues

  1. Displaying gutter icons hides breakpoints. If you need to use breakpoints, you can do either of the following:

    • Turn off the left line numbers temporarily
    • Use the Relative + Absolute setting. The currently selected line does not have any gutter icon, so you can select the line first, then toggle the breakpoint.
  2. The gutter width cannot be adjusted, so if the left line number has more than 4 digits, the digits become really squeezed and slim. Hopefully your not editing such a long file... Related issues:

Acknowledgment

License

Links