Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get both absolute and relative line numbers in ideavim for IntelliJ?

I am using IntelliJ IDE for my projects and just installed ideamvim plugin. In the .ideavimrc I added this property

set rnu

with this property I get relative line numbers in my files in intellij which is amazing. But can I ALSO get absolute line numbers? In my vscode, I have both absolute line numbers and relative line numbers, so I was wondering if it was possible to get the same behavior in intellij?

I am fine even if I have to install a new plugin in Intellij for this feature to work.

Thanks

like image 217
theprogrammer Avatar asked May 08 '20 14:05

theprogrammer


People also ask

What is IdeaVim plugin?

Included In IdeaVim Bundle. Vim emulation plugin for IntelliJ Platform-based IDEs. IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing, marks, registers, some Ex commands, Vim regexps, configuration via ~/. ideavimrc, macros, Vim plugins, etc.

How do I enable relative line numbers in IntelliJ?

Put the relative-line-numbers.jar file into Contents/plugins folder Restart your IntelliJ or Android Studio (or other JetBrains IDEs) Find the Relative Line Numbers plugins in the bundled plugin area Just enable it! more ... Loved this plugin.

How to show absolute number instead of relative number in Vim?

Use RltvNmbr.vim to display the relative numbers, and use Vim to display the absolute ones: Show activity on this post. Vim 7.4 (Patch 7.3.787) will show the absolute line number instead of "0", when both "relativenumber" and "number" are set. When setting this option, 'number' is reset.

What is hybrid line numbering in Vim?

If you’re on Vim 7.4 or newer, and you have both absolute line numbering enabled and relative numbering, then you’ll get hybrid line numbering. That is, the number on your current line will be its absolute line number, instead of 0.

How do I Turn on ideavim?

You can turn it on through the standard vim commands: You can also set these in your ~/.ideavimrc file, which you need to create if it doesn't already exist. Thanks! I actually figured it out (sorry for not updating over here) but you IdeaVim actually has a vimrc.


2 Answers

You can do both set relativenumber and set number. This will give you absolute line number for the current line, but relative line numbers for everything else. You can't have two sets of numbers side by side.

like image 185
citizenmatt Avatar answered Sep 18 '22 12:09

citizenmatt


You can download and install manual this plugin: https://plugins.jetbrains.com/plugin/7414-relative-line-numbers/versions

And:

  1. Download the latest jar from here
  2. Open Application folder, find the IntelliJ or Android Studio (or other JetBrains IDEs)
  3. Put the relative-line-numbers.jar file into plugins folder
  4. Restart your IntelliJ or Android Studio (or other JetBrains IDEs)

It worked at IntelliJ IDEA 2021.2.2 and windows 11 https://i.stack.imgur.com/Z4mBp.png

like image 29
Nguyễn Thái Duy Avatar answered Sep 17 '22 12:09

Nguyễn Thái Duy