Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider use of 'Alt' for majority of commands #19

Open
nastevens opened this issue Oct 30, 2022 · 2 comments
Open

Reconsider use of 'Alt' for majority of commands #19

nastevens opened this issue Oct 30, 2022 · 2 comments

Comments

@nastevens
Copy link

I'm opening this to start a discussion - Speki is your project and you can bind keys however you want! But from experience I can tell you that there will be more issues like #8 in the future if the project continues to heavily use the Alt modifier key. The problem is that too many other terminals, window managers, and even OS's intercept Alt for their own purposes. Ctrl is a little better but still not perfect.

My recommendation is to use key bindings that don't require modifiers at all, and to put any sort of text editing behind a mode. So, for example, instead of Alt+arrow to move around, just use Arrow. Then use a binding like Enter or i to go into an editing mode and Esc to exit it. This is similar to the direction you've already gone for in the incremental reading section.

Thanks for sharing Speki with the community - I think there's a lot of potential here!

@TBS1996
Copy link
Owner

TBS1996 commented Oct 31, 2022

Hello Nastevens! Thanks a lot for your feedback, this topic is something I've been thinking about. When deciding the key commands I didn't think about that it might not work in other systems, it's my first time deploying software so im figuring out many things as i go along here. First of all, since I wasnt using ctrl+(h/k/k/l) or ctrl+arrowkeys anyway, i've now simply added that as an option too, didnt push that change yet. If you updated Speki recently you may also have noticed that you can now click with your mouse button as well, although ik thats not ideal for terminal apps.

Regarding your idea of simply using arrow-keys and then entering an insert mode for text input, there's some issues to consider here. Mainly it wouldn't just be the text-editing that is behind a separate mode but other widgets too, for example all the list objects also use the arrow-keys, meaning those would also have to have a separate state of being in focus, or else when you press the up arrow key you couldnt know if you wanna go up in the list or to the widget above it. To have some kind of uniformity I would then have to put this extra state on all the widget, perhaps one color for "hovering" over the widget and another color to say that the widget will consume your keystrokes.

I'm not really convinced that this would be either less confusing for newcomers or easier to use. to go from widget A to widget B, you'd have to:

  1. Deselect widget A
  2. move to Widget B
  3. Select widget B

This is in contrast to using a modifier key where you would simply move directly and it'll automatically be in focus. The downside of the current approach is that whatever combination is used, cannot be used by the widget itself, and also the compatibility issues you've mentioned. I know VIM uses alt-key for some of its commands yet it seems to work on any platform though, do you know how it manages to do that? I think i'll start a reddit post asking for advice on this, or perhaps just start using Ctrl for everything as you suggested. I think the alt-key is slightly more ergonomic but compatibility is more important as you point out.

Btw about the incremental reading, I didn't go any direction with it in this regard, it uses the same widget as the question/answer fields, it just adds the extract and cloze function when you're in visual mode. But in all those fields you can enter insert/command/visual! I'm going to work on making it more vim-like in the future.

Once again thanks a lot for your feedback, I'd love to hear your thoughts on what I just wrote. I want to be clear that i'm not arguing against you but rather giving my thoughts on the pros and cons of what to do.

@boymaas
Copy link

boymaas commented Dec 25, 2022

First of all, thank you for developing speki. I second the suggestion made @nastevens. I would love to see this implemented. I have recently started using lazygit. And found their terminal UX experience pleasant. They decided to have an "x" key, which shows you all the commands for a specific context. Loved that! As it helps you learn the shortcuts as you go along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants