command: Add capability to use relative numbers in goto#2985
command: Add capability to use relative numbers in goto#2985JoeKar merged 2 commits intomicro-editor:masterfrom
Conversation
3e1ed36 to
c047463
Compare
|
This breaks the feature added in #1691 (changes the semantics of the minus sign), right? |
|
🤦♂️ From normal ruler point of view it maybe makes sense, although it's kind of static respective counted from a fixed position. |
|
If you are suggesting to make the BTW, the current I don't need either of these features myself, so it don't know what makes sense and what doesn't. But apparently both features have their users. (I guess it's vim users that are used to "relative goto", and nano users that are used to "wrapped goto".) And there are no technical obstacles for us to provide both features, independently of each other and without limitations. Just need to come up with a nice interface allowing that. For example, maybe just add a separate command for relative goto? Name it |
|
Ok, to don't break the current interface/functionality it's then, as you mentioned, better to expose it on a separate way.
Hm, I'm no friend of having to functions for the same base functionality (up/down). I would prefer one own function (e.g. the mentioned |
Both seem fine to me (and neither seems perfect...), but as I said, I'm not gonna use that myself, so I'm not the one to judge what would be the best here from the user perspective. We should also take into account that micro also has a default Ctrl+L shortcut for goto, so what should we do in this regard when it comes to relative goto? Add another shortcut for it? Or try to make Ctrl+L reusable (and convenient to use) for relative goto as well? Thinking more about it, the behavior you implemented (i.e. |
|
From my point of view the goto command should always work with one shortcut. A normal number goes to the absolute line number, +xyz goes down xyz and -xyz goes up/back xyz number of lines. This should not even be affected by which ruler (relative or absolute) you use at the moment. |
That's what this PR does. Unfortunately we've already one kind of behavior, which is derived from Now we've different approaches to solve this:
Maybe a community vote would be a good choice or a dictatorial decision. 😉 @zyedidia |
|
Now I'm inclined to agree with @dase78 that providing relative goto within the existing command by +/- seems to be the nicest option. Yes, it would break compatibility, but maybe in this case we can let it go and not be dogmatic about that? We can still provide the existing behavior as well, just with a different (incompatible) interface. How about the |
Yes, right, I remember. I never ever used this kind of navigation, because for me it never made sense.
If I had to decide, I would let the nano-way go. I found it useless for my cases and workflow (never used it in nano also). But that's just my point of view. Some others may see it different. EDIT: The ~ could be a nice compromise to keep up all 3 kinds of fast navigation. |
Yep, this sounds like a good idea to not fully loose this "feature". |
|
Another idea would be:
Myself would not be very happy about it, because I've never been a Vimuser and I don't find the shortcuts intuitive in any kind of way (that's one big reason, why I love Micro that much). But as mentioned from @dmaluka in another related topic, it seems, that many Vimusers are used to this navigation (relativeruler and jk). My first vote would be #, +-~. This I would use heavily. |
|
I will prepare this suggestion in the next few days and try to update the documentation accordingly. |
c047463 to
2fa5463
Compare
2fa5463 to
1373cfd
Compare
|
Shall I already respect #2966? |
1373cfd to
8c0df36
Compare
8c0df36 to
7eb46e0
Compare
|
This PR is now proudly present by @dmaluka 😉 |
7eb46e0 to
395e5b6
Compare
|
I just noticed this breaks my #1691 patch with the latest build. It's a shame the behaviour has changed after 4 years. Can this be reconsidered? I use the "Nano way" daily to jump to the end of the document, having developed that habit since before Micro even existed. In addition I find the new method where "goto 5" is absolute and "goto +5" is relative is completely unintuitive since numerically 5 and +5 are identical. A better solution to stay compatible with other editors, as well as itself, would've been to use ~ (or another prefix) for relative goto. Or just use "jump" for relative goto. |
|
@JoeKar Reverting then? We can always implement a serapate
Just for the record, this method is pretty common. Vim has used it since always, and vi used it before vim, and ed used it before vi. |
|
A separate command would be perfect since it would allow the user to bind Ctrl+L to one command or the other, depending on their own preference. Point taken about how vi does things. Though arguably vi's un-intuitiveness isn't something Micro should be emulating. :) |
Just as a second method, Ctrl+Up/Down brings you also at start/beginning of a document. But habits are habits. ;)
This was already mentioned earlier and would be great, don't know "jumpup" and "jumpdown"? Then we really could bind everything to own shortcuts. +1
I don't think, this is going to happen.;) |
|
I've reverted it anyway, since user regressions are not good. I'll let you guys decide among yourselves how to proceed further. |
Intuitiveness is subjective. |
|
Ok, since it's reverted anyway already we should open #2897 again, where the whole story should be discussed and voted by the community. So please continue there... |
With this change relative numbers are supported. They need to be prefixed with
+or-. In case no prefix is given they're interpret as absolute numbers.Currently it needs to be discussed if we stick to the introduced wrap-over handling or if we drop it.
Closes #2897