Add custom keybindings #325
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi and thanks for doing gomuks!
This PR is an approach to add customizable keybindings; this has been discussed in several related issues like #69 #70 #112 and #128. This is just a proposal, I'd love to improve this PR if you have any suggestions.
I've never written much golang code before and was mainly adapting what I already saw, so please let me know if you spot anything that's just bad practice.
This PR
$HOME/.config/gomuks/keybindings.yamlcbind'sEncodeto translate key(combination)s to stringsui/view-main.goAlso
go-runewidth, though I'm not particularly happy I had to addtcell/v2, not sure if that's a problem. To me, the convenience of usingEncodeseemed to be worth it.ui/view-main.goor if there would be a more suitable place. I could also imagine a separate keybindings struct that the main view "registers" to.Would be happy to hear your thoughts. My
keybindings.yamllooks like this: