aome510 / hackernews-TUI

A Terminal UI to browse Hacker News
MIT License
574 stars 21 forks source link

vi mode #46

Closed ink-splatters closed 1 year ago

ink-splatters commented 2 years ago

Hi,

@aome510 any plans for this one?

Anyone around interested in?

Thanks a lot

aome510 commented 2 years ago

Hi @ink-splatters, can you elaborate more about what will a vi mode be used for?

BachoSeven commented 2 years ago

I guess OP means vim-like navigation keys, so hjkl with hl for opening/closing a post and jk to move verticallly between posts, plus things like gg/G to go to the first/last displayed entry. I agree it would be to have that, as many TUI applications provide such bindings and I'm used to them.

aome510 commented 2 years ago

@BachoSeven thanks for the additional insight.

Tbh, the default keybindings are kinda a mess 😢. I haven't used any TUIs before I built HN-TUI, so I have no idea what the bindings other apps normally provide.

I hope this is still addressable with the help of key mapping in the configuration file.

BachoSeven commented 2 years ago

Key mappings in config file would be perfect, I could provide a vi-mode bindings config file which can be linked to in the README for those interested, will do soon.

slarrain commented 2 years ago

Hey @BachoSeven ! How's that binding config file coming through? This is an awesome app, but it is really needed!

huyz commented 2 years ago

@slarrain

As someone who's used a ton of TUI apps and with a vim background, these bindings make a lot more sense to me, as they're more consistent with many other TUI apps:

[keymap.global_keymap]
quit = "C-c"
goto_previous_view = "q"
goto_search_view = "/"

[keymap.story_view_keymap]
page_down = "C-d"
page_up = "C-u"
prev_story_tag = "["
next_story_tag = "]"
open_article_in_article_view = "v"

[keymap.comment_view_keymap]
page_down = "C-d"
page_up = "C-u"
open_link_in_browser = "o"
open_link_in_article_view = "v"
toggle_collapse_comment = " "

[keymap.article_view_keymap]
page_down = "C-d"
page_up = "C-u"
open_link_in_browser = "o"
open_link_in_article_view = "v"
aome510 commented 1 year ago

The default keybindings are not perfect but I guess it can be worked around by using the above keymap.

I'll close this issue for now.