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

Add stage_item/unstage_item to its own key_config #909

Closed
merikan opened this issue Sep 17, 2021 · 7 comments · Fixed by #930
Closed

Add stage_item/unstage_item to its own key_config #909

merikan opened this issue Sep 17, 2021 · 7 comments · Fixed by #930
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@merikan
Copy link

merikan commented Sep 17, 2021

Is your feature request related to a problem? Please describe.
It's not a problem but would be an improvement to avoid misunderstandings

Describe the solution you'd like
I wanted to remap the stage_item/unstage_item to Spacebar instead of Enter, so I changed

enter: ( code: Enter, modifiers: ( bits: 0,),),    

to

enter: ( code: Char(' '), modifiers: ( bits: 0,),),

and it works great.

I have now changed the Enter key to Space but I do not know if it affects any other function that also uses the Enter keybinding.

It would be awesome if we had separate key-bindings for stage_item and unstage_item and they can of course be linked to Enter by default.

Describe alternatives you've considered
I have looked around in the code and can see that Enter is used in several places, so there are probably more places for improvements.

For me, Space is great to toggle on/off, and Enter is a great fit for confirming an operation, but that's just my personal preference. 😉

Thx for an awesome project 👍

@extrawurst
Copy link
Owner

That makes sense 👍

@extrawurst extrawurst added the enhancement New feature or request label Sep 17, 2021
@extrawurst extrawurst added this to the v0.18 milestone Sep 17, 2021
@extrawurst extrawurst added the good first issue Good for newcomers label Sep 25, 2021
@alessandroasm
Copy link
Contributor

I would like to work on that 🙂

alessandroasm added a commit to alessandroasm/gitui that referenced this issue Oct 4, 2021
alessandroasm added a commit to alessandroasm/gitui that referenced this issue Oct 4, 2021
@alessandroasm
Copy link
Contributor

I've opened a PR to implement this feature. Please let me know if it needs adjustments.

@extrawurst
Copy link
Owner

@alessandroasm thanks for approaching this. now that I look into it I am wondering if we have any practical reason to separate staging/unstaging into separate keys? we only ever have one fo the two options anyway so my proposal would be to have one new stage_unstage_item key.

@merikan your thoughts?

@alessandroasm
Copy link
Contributor

I forgot to update the Help.
image

I'll update the PR shortly.

@extrawurst
Copy link
Owner

@merikan next question: this new key should probably also apply instead of enter for staging hunks, right?

@merikan
Copy link
Author

merikan commented Oct 8, 2021

@extrawurst
Yes, I think the same key to toggle on/off is most intuitive and is usually how it works in other applications. It can of course be two different fields bound to the same keyboard-key i.e. SPACE
Yes, same key for staging hunks 👍

extrawurst pushed a commit that referenced this issue Oct 10, 2021
* Add specific key bindings to stage / unstage items

Feature requested by Issue #909.

* Updating Help popup with stage / unstage keys

* Merging staging and unstaging into a single `stage_unstage_item` key

* Add/remove hunk now use the `stage_unstage_item` key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants