nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.69k stars 830 forks source link

How to show relative line numbers on picker #1696

Open aareman opened 2 years ago

aareman commented 2 years ago

Is your feature request related to a problem? Please describe. I'm using vim with voice commands, and I find telescope prompts to be awesome to limit the amount of "typing" that I need to do.

Describe the solution you'd like Is there a way to show choice numbers on the list image so that I could say "down 5" and jump to the choice I want. (being able to use relative line numbers would be even better).

numbers should recalculate as the query is changed, also recalculate for moving up and down the list of choices (if relnumber is being used).

Describe alternatives you've considered I've tried customizing telescope, but I haven't been able to figure out this "odd" usecase

Additional context Add any other context or screenshots about the feature request here.

Telescope is fantastic though, so props guys!

l-kershaw commented 2 years ago

This isn't exactly what you are asking for, but maybe telescope-hop might fit your use case? (I haven't used it, but it seems similar)

aareman commented 2 years ago

Thank you @l-kershaw that does look interesting. I'll check it out.

thomastthai commented 3 weeks ago

This is not an "odd" use case! Vim does relative numbers this way to quickly jump to some lines above or below the current line.

The same principle should be implemented in the picker window. Currently, while in the picker window, I can be on a line and do 3j and the cursor jumps 3 lines down. When the window is filled with many lines, it's a guessing game about what line to jump to or repeatedly smashing j or k to go down or up. telescope-hop is an option but it's not maintained and not quite the Vim way.

In the attached image below, an implementation would replace the > with 0 and put relative numbers in front of the glyphs.

Screenshot 2024-09-19 at 3 28 49 PM