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

Arrow key navigation #8

Closed
clark800 opened this issue Oct 7, 2021 · 2 comments
Closed

Arrow key navigation #8

clark800 opened this issue Oct 7, 2021 · 2 comments

Comments

@clark800
Copy link

clark800 commented Oct 7, 2021

Would you consider adding support for arrow key navigation? I'm used to using arrows in vim since it's nice to be able to move the cursor in insert mode. Thanks

@kyx0r
Copy link
Owner

kyx0r commented Oct 7, 2021

This, I don't even think we can do because keycodes for arrow keys are not in single byte, and have a sequence. Reading such sequence will require some extra work especially in insert mode which wasn't designed to handle sequences unlike normal mode. If you want to make life easier implementing this, you can bind some ctrl + key instead; for moving in insert, then becomes straight forward to implement using the same concept of how backspace deletion works with only difference to not delete anything.

@clark800
Copy link
Author

Yeah, it's a little trickier. I think the way it's done in vim is to set a timer when ESC is pressed and treat it as an arrow if the second byte is read before the timeout, or if no more bytes come before the timeout then it's treated as a normal ESC. https://vimhelp.org/options.txt.html#%27esckeys%27

@kyx0r kyx0r closed this as completed Dec 31, 2021
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

2 participants