cpea2506 / relative-toggle.nvim

Toggles smoothly between number and relative number, supports various number combinations
MIT License
31 stars 1 forks source link

feature: add option to also automatically enable and disable `number` #7

Closed luiz00martins closed 1 year ago

luiz00martins commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, you need to have the option set number enabled for the functionality of relative-toggle to work.

Describe the solution you'd like

Add an option to also automatically enable/disable the number option together with relativenumber.

Describe alternatives you've considered

\<none>

Additional context

No response

cpea2506 commented 1 year ago

So to be clear, you want to flexibly enable/disable the number via the setup function:

require("relative-toggle").setup({
    set_number = true | false, -- set number | set nonumber
}

or do you just want it to always enable the number when relative-toggle is active?

luiz00martins commented 1 year ago

More options is always better :)

I'd go for the first one.

cpea2506 commented 1 year ago

More options is always better :)

I'd go for the first one.

Thanks, let me think about it. Please let me know if you have any better ideas or if you can even make your own PR, I am always open to it. 😁

luiz00martins commented 1 year ago

Actually, I think I wasn't clear in my original message. What I'm looking for is the syncronization of number and relativenumber.

Currently in my setup, I have relativenumber and nonumber, as I don't like the "current-line-only" behaviour of both of them together. However, I like the concept of the plugin of enabling it on certain occasions/unused buffers.

Currently, the plugin would force me to enable number, which results in the current focused buffer to display the current line's number, which I don't like (I prefer the 0).

Here's the behaviour that I would like:

cpea2506 commented 1 year ago

The latest update is available now. I came up with a decision to not let users call any redundant setup and this should be a default behavior.

Thanks for your suggestion! Please let me know if you see something unexpected happen. 😄

luiz00martins commented 1 year ago

I've got a small bug, which I think was introduced by #8, although I'm not sure.

Basically, my dashboard (and other buffer types which are naturally nonumber and norelativenumber) is made to show numbers when it's unfocused:

https://user-images.githubusercontent.com/43142209/226119090-7a844be7-4a65-40ee-8e72-4aefd5a67581.mp4

Perhaps buffers which are nonumber and norelativenumber should be left alone by default? I don't know if that would break some current behaviour.

cpea2506 commented 1 year ago

I've got a small bug, which I think was introduced by #8, although I'm not sure.

Basically, my dashboard (and other buffer types which are naturally nonumber and norelativenumber) is made to show numbers when it's unfocused:

I just notice this bug. 🥲

Perhaps buffers which are nonumber and norelativenumber should be left alone by default? I don't know if that would break some current behaviour.

That is why we have to check if a buffer set vim.o.number in the first place. I have reverted all of the changes made before and will try to find another approach in the future, sorry 😭

cpea2506 commented 1 year ago

I have just pushed a new fix that ignores those buffers which set nonumber and norelativenumber by default, I just need to make sure relative number are always set when first enter main buffer. Sorry for the unexpected result you have 🥲

luiz00martins commented 1 year ago

Yep, it's working!

Thank you for the fix, and thank you for the great plugin 😄