michael-lazar / rtv

Browse Reddit from your terminal
MIT License
4.64k stars 274 forks source link

Adding suport for jumping to nth post? #568

Open turing4ever opened 6 years ago

turing4ever commented 6 years ago

Hi there,

Is it possible to added a feature that allow jumping to the nth post on current page by typing :n? Just like in vim you can jump to a line #.

Thanks!

michael-lazar commented 6 years ago

Hi! Currently you can use G / gg to jump to the first or last submission, but that's it.

It's a bit more complicated than vim because in rtv the submissions are loaded on demand. For example, if you want to jump to the 1000th post, the application would need to first load 999 posts through the reddit API. I think it could still be doable but it might not be such a good user experience.

turing4ever commented 6 years ago

Hi Michael,

Thanks for the follow up. Let me clarify a bit. Jumping to 1000th post is unnecessary, but jumping to the 16th on the current page might be very convenient. So, this requested feature could help the viewer to navigate through the posts on the current page faster. What do you think?

michael-lazar commented 6 years ago

Hmm I don't see it as being any more convenient than using page up / page down in that case. I'm not against the idea though, if somebody wants to put together a PR that's well written and tested I would probably accept it.

If we use the vim keybind of : + 1 + 6 + Enter, it would work best if we assigned the : key to open a command prompt at the bottom of the page, similar to how vim's command mode works. Then it could be extended to support other commands in the future.

turing4ever commented 6 years ago

Yes, supporting : key is a good idea. I would prefer one key stroke for each navigation movement, just like q for quit, j k for up and down. : key should help more complicated functions.

I haven’t read the source code yet, will check it out and see if there could be a quick fix.