A plugin to display relative line numbers on IDEA-based IDEs.
-
If the line numbers are enabled (Settings > Editor > General > Appearance > Show line numbers), then you should be able to see the relative values immediately.
*You may need to reopen your files for the plugin to take effect.
-
As of version 1.1 you may also display the original (absolute) values next to the relative ones. To enable it, go to Settings > Editor > Line Numbers and enable the "Absolute values" checkbox. Changes should apply immediately after saving.
Displays line numbers relative to the caret's position. Optionally, you can enable the original values as well, showing both at the same time.
It can be useful to know how many lines you need to scroll up or down before you do. This plugin is a simple lightweight solution for that.
Why not IdeaVim?
If you like VIM, then yes, go ahead and use IdeaVim. It does the same and much more! However, if you don't need or want to use all other features of Vim, this plugin offers a lightweight alternative to the relative line numbers feature in particular.
This plugin was inspired by @vayafulano's plugin.
Despite being outdated and not searchable via the IDE, you can still install it by downloading the JAR file directly and installing it manually. However, this solution uses annotations to display the line numbers, which has several implications, including the following:
- Regular and relative line numbers may both be displayed simultaneously but only as an unintentional side effect, outside the plugin's control.
- The relative line numbers may conflict with other annotations (e.g. VCS) and closing annotations will unintuitively remove the relative line numbers as well, causing confusion.
To address these issues, this plugin uses modern IntelliJ Platform SDK features to replace line numbers with relative values. This should also improve performance (not measured) while avoiding conflicts with annotations.