helix icon indicating copy to clipboard operation
helix copied to clipboard

Go to line <n> doesn't work as expected

Open heliostatic opened this issue 3 years ago • 6 comments

I believe, based on the g menu, that g11 should go to line 11 in a file. However, this doesn't work currently. Typing :11 does go to line 11, so the functionality seems to be present, but not implemented for the g11 case

2022-04-11 at 12 37 34 - Alacritty - CleanShot@2x

https://user-images.githubusercontent.com/70898/162788441-4955bff9-d468-423e-ba6e-221dcff59834.mp4

.

heliostatic avatar Apr 11 '22 16:04 heliostatic

g11⏎ doesn't jump to l11 but g11g or 11gg will. The menu text is a bit confusing because it suggests you hit g to goto line but that's actually the second g (the first opens the goto menu). You can also use 11G or as you say :11⏎ works too

the-mikedavis avatar Apr 11 '22 17:04 the-mikedavis

Ah, I understand. Here's an attempt to clarify what's happening.

heliostatic avatar Apr 11 '22 17:04 heliostatic

The menu text is a bit confusing <- I agree ;)

anzhi0708 avatar Apr 12 '22 02:04 anzhi0708

@the-mikedavis Could this be reopened? It is more than confusing, it is plain wrong. Something as basic as going to a line should not have false information presenting itself to you!

gg(line number) is broken, it goes to the start, and then only when you make a down movement it goes to the intended line.

g(line number)g is OK, this should be obvious in the popup hint wording and be in the docs.

Can g(line number)(enter) be made to work as well/instead?

David-Else avatar Oct 26 '22 12:10 David-Else

It is more than confusing, it is plain wrong.

To rehash my comment above, I see this as potentially confusing since it may not be clear that <n> is the count and it's easy to miss that g is a separate keypress since you just hit g to enter this menu. I think it's a stretch to call the docs false information 😕

gg(line number) is broken... g(line number)g is OK, this should be obvious in the popup hint wording and be in the docs.

A PR would be welcome to make this clearer. Aside from changing <n> to be <count>, I genuinely don't know how to improve this without making it a big paragraph that won't fit in the auto-info box. I'll re-open this issue for that.

Can g(line number)(enter) be made to work as well/instead?

Probably but there are already four ways of going to a line number: g<n>g, <n>gg, <n>G, :<n>⏎. I would rather eliminate the gg ones than add a new way. Plus, I can't think of any other key sequence that needs <ret> to finish the sequence - that behavior usually belongs to the prompt, as with :<n>⏎.

the-mikedavis avatar Oct 26 '22 13:10 the-mikedavis

@the-mikedavis Maybe false information was too strong, it just seems to say something to me that is not true, but others might understand it in a different way.

I will try and think more about this issue...

David-Else avatar Oct 26 '22 15:10 David-Else

Bumped here as I was confused as well.

humphreylee avatar Apr 26 '23 12:04 humphreylee