Vim tip: The best line number config (current + relative line numbers)

Vim tip: The best line number config (current + relative line numbers) Thumbnail image

Everyone has their own preferences for config/.vimrc options, but for me I think that having the current line number and relative line numbers is the most useful way to use Vim.

The current line number is always shown in the left gutter, along with the relative line numbers above/below.

This is useful when wanting to move a to a certain line above/below the current line. You can use keyboard shortcuts (e.g. to move 5 lines down: 5j

See the screenshot above to make sense of what I'm trying to say, if it isn't clear.

This is the config to add to your .vimrc to get it working:

  1. :set relativenumber
  2. :set number
  3. :set number relativenumber

Subscribe to my spam free newsletter for other Laravel updates like this

I never spam, and only email when I have a good in-depth post published on my site (mostly about Laravel). You can also follow me on social media to get updates.

webdevetc profile pic
webdevetc

I'm a late 20's web developer, specialising in Laravel, but work with other PHP frameworks and associated technologies (such as JS). I mostly write about PHP here. Contact me here. Need to hire or work with a contract PHP software developer in London, UK (or freelance)? Contact me and check my availability.

Leave a Comment