I have relative numbering turned on. There's no immediate way of telling which direction I want to move, however. For example, sometimes I see line number "7" and move 7j (7 lines down) when I really wanted to move 7k (7 lines up).

Is there a way to colour line numbers above the current line differently to line numbers below? This way I could very quickly determine whether I should move up or down.

I'm aware I could look at the surrounding numbers to determine the direction I should move, but colours convey meaning more quickly.

  • 1
    I'm guessing this isn't possible. Having trouble understanding how what you describe is a problem. Does your cursor line standout from other lines in any way? Because knowing where it is relative to a relative line number should be an instant tip-off as to whether 7j or 7k is the right choice.
    – B Layer
    Commented Dec 25, 2017 at 23:26
  • It does, but I've found I make this mistake sometimes. I would argue this means it's not as obvious (to me) which direction I should move as it could be. If I don't get an answer here I'll try making the cursor line stand out more- but having an especially contrasting cursor line could be quite unpleasant.
    – mkingston
    Commented Dec 26, 2017 at 16:04
  • Well, you could :set scrolloff=999 which will ensure the cursor line is always exactly in the middle of the window...then you'll know the right choice simply by whether the line in question is in the top half or bottom half of the window. ;)
    – B Layer
    Commented Dec 26, 2017 at 16:21
  • Hah! I'm, uh, not sure that's for me!
    – mkingston
    Commented Dec 26, 2017 at 16:44
  • :) Yeah, an extreme measure for sure though some people like it. Personally I just use set cursorline and have both 'number' and 'relativenumber' enabled and find that that nicely sets the cursor line + number apart (plus I like having absolute line number at the cursor line rather than "0"). A wise choice of colorscheme helps, too. Clearly you would like something more conspicuous, though. I'll keep it in mind and get back to you if I think of anything else.
    – B Layer
    Commented Dec 26, 2017 at 17:42

1 Answer 1


Starting from vim 8.1.2229 there are

  • LineNrAbove
  • LineNrBelow

you can use to have different colors above and below current line:

hi LineNrAbove guifg=red ctermfg=red
hi LineNrBelow guifg=green ctermfg=green

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.