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

[Feature Request] Custom keyboard shortcuts #610

Closed
stevenxxiu opened this issue Nov 14, 2022 · 3 comments
Closed

[Feature Request] Custom keyboard shortcuts #610

stevenxxiu opened this issue Nov 14, 2022 · 3 comments

Comments

@stevenxxiu
Copy link
Contributor

stevenxxiu commented Nov 14, 2022

Thanks for the great project!

It would be great for there to be custom keyboard shortcuts for each action. e.g. I often use Ctrl + LeftArrow, Ctrl + RightArrow, Home, End, Delete, which don't work in the editor. I'm sure other people might also have their own preferences.

This can be done by allowing configurable escape sequences, or one of the libraries in Comprehensive keyboard handling in terminals - kitty. I know that Broot uses Crossterm.

@arcuru
Copy link
Contributor

arcuru commented Nov 17, 2022

To clarify, I'm assuming you mean custom keyboard shortcuts inside the interactive search ui, atuin search --interactive?

If there are shortcuts you think make sense to add universally, it should be fairly simple to add them. The inputs are handled with this match statement.

However adding the ability to have user-defined keyboard shortcuts would be a decent chunk of work, since you'd need to define some sort of API for the UI and commit to supporting it. Personally I don't think it's worth the effort.

@stevenxxiu
Copy link
Contributor Author

stevenxxiu commented Nov 17, 2022

To clarify, I'm assuming you mean custom keyboard shortcuts inside the interactive search ui, atuin search --interactive?

Yup that's what I mean.

However adding the ability to have user-defined keyboard shortcuts would be a decent chunk of work, since you'd need to define some sort of API for the UI and commit to supporting it. Personally I don't think it's worth the effort.

I'm not too sure what you mean here on API for the UI, but fair enough. The keyboard shortcuts I use are the pretty standard ones, so I think adding them universally makes sense.

The ones I want are pretty self-explanatory:

  • Ctrl + LeftArrow: Go to previous word.
  • Ctrl + RightArrow: Go to next word.
  • Home: Go to start of line.
  • End: Go to end of line.
  • Delete: Delete next character.
  • Ctrl + Backspace: Delete previous word.
  • Ctrl + Delete: Delete next word.

The library that's being used here, Termion, doesn't support the Ctrl combinations here. In particular, ctrl + arrow? (#194) · Issues · redox-os / termion · GitLab was created a year ago with no response.

Would moving to Crossterm make sense?

@conradludgate
Copy link
Collaborator

Those keybindings would make sense to be universal!

Crossterm is a WIP (#331) but it's currently blocked due to a bug on zsh/macos (which is my work setup so I'm definitely not going to let that bug through 😂)

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