Vsvim: relativenumbers

Created on 31 Jan 2017  ·  10Comments  ·  Source: VsVim/VsVim

Hi,

I'm quite a fan of the vim option "relativenumber". Somebody implemented it separately in this extentensioon https://marketplace.visualstudio.com/items?itemName=BrianSchmitt.RelativeNumber&showReviewDialog=true to work with VsVim.

Problem is, while it's working great, I think this is a functionality that VsVim should have, and that it should react like vim does regarding theses configuration variables :

number
relativenumber

When you set number, you get normal line numbering. If you set only relative number, you get relative line number from the current cursor line (with this line being line 0)

With both variable set, you get the absolute line number on the curent line, and relative numbers on other lines.

Just an idea, it would be a neat feature to support. ^^"

feature request

Most helpful comment

@brianschmitt What do you say to the idea of making https://github.com/brianschmitt/relativenumber part of VsVim? The idea is apparently wildly popular!

All 10 comments

@brianschmitt What do you say to the idea of making https://github.com/brianschmitt/relativenumber part of VsVim? The idea is apparently wildly popular!

YES! I always install both plugin together

If nobody started working on it yet and @jaredpar doesn't have objections - I'll take this task. I've made some perf improvements over the original relativenumber plugin (It was rebuilding the whole margin almost every time the code changes even if the margin itself doesn't need to be updated) on my machine and could incorporate it into VsVim.

@oxilumin I'm pretty sure no one is working on this and many users are eager for it to be implemented, so please continue the work to integrate the feature into VsVim. I'm glad you are looking into performance because a poor implementation could be very costly and yet only be noticeable on slow machines or large files.

@oxilumin hey, if you can take the time to do this, please do! 👍

I'm definitely not working on it right now either so go for it :smile:

I've finished the code for the feature itself. It seems that it's ~20-30% faster than built-in absolute line numbers margin, so there should be no performance impact.

I wanted to discuss some settings before making a PR:

1) Do we want to be able to use custom colors/font? Right now it's bound to the formatting defined for "line number" classified text (as in default line numbers margin).

2) Do we want to interact with the native line numbers margin (like hiding it when relative numbers are on)? I think we should not because somebody else might depend on/modify status of native margin or it could change in future releases of VS, so for now - we need to once disable it manually in VS settings.
On the other hand - if we replace the native margin - we get by-language customization for free. So whenever the native margin is disabled for some language - so would relative lines margin be.

I currently use a relative numbers plugin that is separate from VSVIM. If VSVIM supports it, I will remove the plugin I have. That plugin supports showing both the native line numbers and the relative line numbers and I really like having both. Here is an example of what I see.

[cid:[email protected]]

Thanks for working on this!

Jerry

From: Alex notifications@github.com
Sent: Wednesday, January 2, 2019 1:52 PM
To: jaredpar/VsVim VsVim@noreply.github.com
Cc: Subscribed subscribed@noreply.github.com
Subject: Re: [jaredpar/VsVim] relativenumbers (#1909)

I've finished the code for the feature itself. It seems that it's ~20-30% faster than built-in absolute line numbers margin, so there should be no performance impact.

I wanted to discuss some settings before making a PR:

  1. Do we want to be able to use custom colors/font? Right not it's bound to the formatting defined for "line number" classified text (as in default line numbers margin).
  2. Do we want to interact with the native line numbers margin (like hiding it when relative numbers are on)? I think we should not because somebody else might depend on/modify status of native margin or it could change in future releases of VS, so for now - we need to once disable it manually in VS settings.
    On the other hand - if we replace the native margin - we get by-language customization for free. So whenever the native margin is disabled for some language - so would relative lines margin be.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/jaredpar/VsVim/issues/1909#issuecomment-450981391, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAvlI696sZ0T_NfUXzYJ5iUczQyo7L2Kks5u_RvtgaJpZM4Ly6Nn.

@oxilumin

Do we want to be able to use custom colors/font?

Delegating any addition formatting of the line numbers to Visual Studio is compatible with the current version of VsVim, does the "right thing" for almost all users, and yet still permits users to customize it.

Do we want to interact with the native line numbers margin (like hiding it when relative numbers are on)?

My preference would be to replace the existing line numbers. My reasoning is that the existing :set number VsVim setting already controls the default line numbers margin and the vim setting :set number relativenumber does not show two line number margins but a single one with the current line annotated with its non-relative number.

The alternative of supplementing the default line numbers margin requires either forcing the user to manually adjust Visual Studio to achieve compatibility with vim, or adding yet another vim-incompatible option (like :set vsvim_bothlinemargins in order to fully control the behavior from VsVim while providing a super-set of vim functionality.

Although not ideal, if a user (like @jnothstine) really wants both margins, continuing to use a separate extension to provide non-vim-compatible behavior seems like a reasonable trade-off.

First iteration is here: #2452

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elrob picture elrob  ·  6Comments

kalebpederson picture kalebpederson  ·  6Comments

ArnisL picture ArnisL  ·  5Comments

iamkarlson picture iamkarlson  ·  7Comments

prat0088 picture prat0088  ·  4Comments