Journal Archives About Books Talks

Move faster in Vim with relative line numbers

Jeff Kreeftmeijer:

Since 7.3, Vim has a setting called relativenumber (you can set it up with :set relativenumber or :set rnu), which is a lot like the number setting you’re probably using to have line numbers already. But, instead of showing the absolute line numbers from the top of the file, it shows them relative to the line you’re currently on. That means the line below the current one is marked with 1, as is the line above. Now it’s quite easy to find out how many lines you need to jump up or down.

I've been trying out relative line numbers and I agree, it makes it simpler to get around in normal mode. Jeff has released a plugin to add some smart toggling based on Vim's focus state and mode.


# Shared on