cfangmeier / tuijam

A fancy TUI client for Google Play Music
MIT License
129 stars 9 forks source link

Add vim mode V2 #44

Closed kdb424 closed 4 years ago

kdb424 commented 4 years ago

Noticed your update, and thought I'd rebase and add again. It was a lot cleaner to add this time I think. Didn't add docs yet yours have been updated hastily, and are in fact, broken for setting controls. Copied exactly, they fail to parse properly.

EDIT: Seems that my rebase introduced some bugs.

kdb424 commented 4 years ago

Update. Bugfixed. Seems to work fine now. Had to do an additional check against the search box if in vim mode to allow navigation to work properly, but block actual keys in the search box.

cfangmeier commented 4 years ago

Hi @kdb424, If I understand the changes correctly, what this does is basically add insert/normal mode to the search input. Without other vim-like actions (motions come to mind) I guess I don't really see how this is so useful. Especially since searches will generally be quite short (a few words at most) and not be left half-finished in the search box to be edited later.

To me, the more useful vim-like features would be something like G/gg for going to the top and bottom of the search/queue lists, ctrl-u/ctrl-d for moving half-pages up and down, and other things like that.

kdb424 commented 4 years ago

@cfangmeier I definitely agree this can be expanded upon, and would like to do so. My main goal, at least for initial pass, was to have binds that were single key, while not losing the ability to type in the search box, which this pass has done. For example, if you set your "pause/play" button to "p" every time you type that letter in the search box, your music will start/stop. The initial PR was basically to see if you would be interested, and as a foundation for more features while being minimally invasive.

cfangmeier commented 4 years ago

ok. That makes sense.

I checked out the branch and tried it out. I have a few suggestions to make it even better:

  1. Add some visual indicator for normal/insert mode. This could be as simple as changing the cursor style in the search field. Not sure how easy urwid makes that...
  2. Switching to insert mode should automatically move the focus to the search input.
  3. Hitting tab/shift-tab should automatically exit insert mode and move the focus as usual.

How does that sound?

kdb424 commented 4 years ago

1: That's a fantastic idea. I have been dealing with not knowing what mode I was in, and missed this obvious idea. 2: I must have missed this when I re-based, but I originally had it where if you jumped to search with a bind (example /), it would put you in insert mode as that was the clear intention to search, where as just tabbing through may mess with other binds if a user bound "tab" to a single alphanumeric. 3: With the last comment in mind, maybe hitting enter when searching should exit insert mode instead? This type of action would mimic the command mode more closely.