Sublime Forum

Relative line numbers for Vintage mode

#1

Lots of vim commands make you go up/down x number of lines so a relative line number is very useful. Is there any way to change the gutter line numbers to be relative to the current line?

0 Likes

#2

+1. I’d love to see a relative line numbers option or an API hook. I’ve looked through the API reference trying to find a way to draw line numbers, which could be used to build a relative line number plugin, but no luck. Am I missing something? Is this even possible? Thanks.

0 Likes

#3

It’s not currently possible

0 Likes

#4

Bump to see if this is possible now or in the foreseeable future.

0 Likes

#5

+1 This is very useful feature.

0 Likes

#6

This might do it for you:

github.com/tmanderson/VintageLines

0 Likes

#7

[quote=“tmanderson”]This might do it for you:

github.com/tmanderson/VintageLines[/quote]

Can someone give me few good examples, what should i use this for?

EDIT:

15j

0 Likes

#8

With relative line numbers you don’t need to calculate in your head how many lines you need to jump. You just look the number of the line you want to go and use it to prefix your movement command.

0 Likes

#9

I’ll just copy my post from https://sublimetext.userecho.com/topics/3943-relative-line-numbers/

Looks like I’m digging up a very old post, but VintageLines is way too limited to be a final solution… Most of the issues are related to the fact that it uses .png files instead of native line numbers. For instance, it doesn’t go above 999 (I know, no file should exceed that… but welcome to reality!), also, it doesn’t integrate well with GitGutter and similar plugins, etc. So it would be great if either Sublime would support that feature natively, OR, if VintageLines could have access directly to the native lines numbers instead of having to use a hack.

Other link I saw after reading this post: Relative line numbers, because plugins can't properly do it

0 Likes

#10

I just made a new little plugin for this: https://github.com/bicarlsen/vintage_relnums

It’s my first plugin, so would love suggestions on how to improve it.

0 Likes