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
Remap UI keybindings #214
Comments
Sounds good! Thanks for the issue |
I'd like to +1 on this general idea for a different use-case. In my specific case, I'd like to use I took a look, but I also don't see an easy way of changing the built-in defaults for keybindings. @dlvhdr If you agree that configurable overrides for default/built-in keybindings is a good idea, I'd be willing to submit a PR for this. I'd want to make sure we're on the same page as far as architecture/design before submitting a PR though - especially as this would result in additions to the config file. |
This is definitely something I'm interested in. I think this is where I set the default values |
Gotcha - thanks. I think it's still valuable to keep the default config defined in the app but allow overriding of specific keybindings via the config file. This is consistent with the approach lazygit takes. Let me know if you disagree here. I'd propose adding the following to the config file: keybindings # already exists
prs: [] # already exists
universal: # new
up: "up"
upAlt1: "k"
firstLine: "g"
firstLineAlt1: "home"
[ ... other keys omitted for clarity ...]
pr:
comment: "c"
diff: "d"
[ ... other keys omitted for clarity ...]
issue:
comment: "c"
close: "x"
[ ... other keys omitted for clarity ...] I don't love the fact that this introduces a new key: Does this align with your expectations? Do you have another config in mind? I don't yet have a super clear mental model of how to propagate the keybinding config into the app, but I think that will be clearer once I start working on the PR itself. |
I think another approach that avoids breaking changes (which I also want to avoid) is to introduce a syntax like this: keybindings # already exists
universal: # new
- key: up
command: up
- key: k
command: upAlt1
- key: g
command: firstLine
- key: home
command: firstLineAlt1
prs:
- key: v # example for a custom keybind
command: cd {{.RepoPath}} && code . # && gh pr checkout {{.PrNumber}}
- key: c
command: comment
- key: d
command: diff
issues:
- key: c
command: comment
- key: x
command: close If we're worried about conflicts with some bash alias or tool etc, we can add another key like |
In principle, I like this more than my suggestion. However, I worry that it will be a little confusing to differentiate custom commands from builtins. In the example above, I think this is what you are alluding to with:
But I don't quite follow the suggestion here. |
Yes exactly. I'm alluding to the confusion / conflict when a custom command like prs:
- key: v # example for a custom keybind
command: cd {{.RepoPath}} && code . # && gh pr checkout {{.PrNumber}}
- key: c
command: dash comment
- key: d
command: dash diff OR prs:
- key: v # example for a custom keybind
command: cd {{.RepoPath}} && code . # && gh pr checkout {{.PrNumber}}
- key: c
builtin: comment
# or
dash: comment
# or
dash-command: comment Maybe you can think of a better name than builtin, as English isn't my native language. |
Ah, right, glad we're on the same page. Thank you for the examples - that clarifies it for me. I think
I can't come up with anything better than |
Sounds good! |
Is this up for grabs? I am open to giving it a try. |
Yeah definitely @miniscruff! |
Is your feature request related to a problem? Please describe.
It's a bit of a usability annoyance. I'm used to using Vim so just using the home row is practical. Right now I need to do hand gymnastics to use
Ctrl+d
andCtrl+u
for navigating the preview bar and find it rather uncomfortable.Describe the solution you'd like
I'd like to be able to remap those keys in my configuration file so
J
andK
(mind the case) are used instead.Note I'm not 100% sure this isn't currently possible, but going through the README and the source code I couldn't find anything useful.
Describe alternatives you've considered
There aren't many. Essentially it's either hardcoding my preferences (not very considerate to others used to the current workflow) or making it configurable.
I'd say the current keybinding section may benefit from some UI action syntax or maybe a new section could be added for the UI interaction.
The text was updated successfully, but these errors were encountered: