Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to show signs next to the relative line numbers in Vim? Currently with set rnu I have:

2
1
0
1
2

I'd like it to look like one of the following (either is fine):

-2
-1
 0
 1
 2
-2
-1
 0
+1
+2

Thank you!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Though there is a sign column left of the number column, you would have to write very complicated code to keep the signs in sync with the displayed relative numbers. There are some plugins (e.g. RltvNmbr from Dr. Chip) that emulate the relative number feature (again, using the sign column). It might be easier to modify those, but be aware that they don't work perfectly (that's why the feature was introduced into core Vim).

If you really want this, you'd have to patch the Vim source code and compile your own Vim version. It's unlikely to ever be included in Vim, though, because the relative numbers should help with addressing jumps and motions, and those (e.g. using j and k) are always positive counts, so showing a negative sign doesn't make much sense. Best just accept the status quo and get over this idea!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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