tris203 / precognition.nvim

💭👀precognition.nvim - Precognition uses virtual text and gutter signs to show available motions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Support for "0" and "g_" motion

dawnandrew100 opened this issue · comments

Since you already have ^ and $ support, it would definitely be nice to also have 0 and g_ support!
0 motion

To the first character of the line. exclusive
motion.

g_ motion

To the last non-blank character of the line and
[count - 1] lines downward inclusive.

I need to think about multibyte characters and how they would display

0 is simple enough

But, with g_ how do you think it should display if the line end was directly under where the underscore would be placed

Additionally how would I make it clear it was a two character motion and not g and _ next to each other

I guess the answer is to apply different colours to the hints that could overlap

I'll give this some thought and would appreciate any input

Another option could be adding an additional virtual line for overlapping motions, but not sure it that would be better.

I think the best way to display multicharacter motions would be to just give them a new colour.
Choosing a new character to signify that the g and _ are together and not separate like quotes, parentheses or square brackets would be confusing since they're already used in motions in some other way.
Plus, $ and g_ usually take you to the same place, so if they would take you to the same place, you can just give $ priority over g_ and if $ would occupy the space where the _ of g_ would be then you could just give g_ priority (assuming that most people would prefer to jump to the last non-blank character instead of the white space just after).

I also do like the addition of another virtual line idea so that if there are multiple motions that take you to almost the same place but have some sort of overlap (which is really only the case in multicharacter motions), you can see all of the options that are available to you.
And the new line might be beneficial if you ever wanted to add other multicharacter motions like ge for example.

0 is now supported

Multichar motions will come at a later date