← Back to Upcase

Current line's absolute number when using relativenumber


(Geoff Harcourt) #1

@jyurek, I saw in your vim text objects screencast that your editor shows the absolute line number of the current line rather than “0”, and that it is indented differently to set it off. I dug through your vimrc on github, but couldn’t find the line responsible for that behavior, and the Goog is not being helpful, but did turn up a discussion of including that functionality in a future patch. How are you controlling that through your personal configuration?

Thanks,
Geoff


(Geoff Harcourt) #2

Answered my own question. Wasn’t able to use @jyurek’s config to do it, but if you upgrade to the latest vim using homebrew (I was using the version included with OSX), and you have this setting in your vimrc:

set number relativenumber

Then you will end up with the current line showing the absolute number, aligned to the left, and the other lines showing relative numbers aligned to the right of the left side gutter.


(Jon Yurek) #3

Honestly? I have no idea. :smile:

Ok, that’s not entirely true. I lost that functionality recently and so, spurred by your post here, I did some digging to try to get it back. In my vimrc I have “set number” and “set relativenumber”, and I have them in that order. Having both in the vimrc makes it work. If you try to set them manually in command mode it doesn’t work.

I should note that my numbering setup is occasionally finicky and sometimes does not behave consistently, so keep that in mind. Actually, I’ve stopped using relativenumber as my default, because I didn’t find it was helping me.

Hope that helps!


(Geoff Harcourt) #4

Thanks, very much appreciated. The vim developers had a huge argument over whether this was good or bad functionality, looks like it was merged in this spring.


(Kevin McGladdery) #5

It looks like the option of having the current line show 0 still exists, depending on whether number is turned on or not. A little table of different line number setting configurations is at :help number_relativenumber


(Patrick Hereford) #6

I had to upgrade my version of vim to 7.4 (was on a rather old version of 7.3) in order to get relativenumber working.


(Geoff Harcourt) #7

Yeah, the 7.4 version is a requirement. Vim is one of those things where I hadn’t noticed any problems using the OSX-delivered version up until this particular problem.