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 config option to disable switching tabs with panel jump keys #3927

Conversation

hgreenstein
Copy link
Contributor

@hgreenstein hgreenstein commented Sep 20, 2024

PR Description

Problem this PR attempts to solve

I really appreciate the feature added in #3794 that allows switching tabs using panel jump keys when the side panel is already active and see how it is convenient for many users. However, after using lazygit for quite some time, I've developed muscle memory where I rely on pressing a number key to instantly switch to a panel and perform an action, regardless of which panel is currently active. I have found myself several times in the past few days clicking '2' and going to hit 'a' + 'c' to commit all and find I was already had window 2 active and my tab was instead switched to 'Worktrees' and the keybindings no longer apply to stage or commit.

Solution

  • Add a config SwitchTabsWithPanelJumpKeys as a gui boolean that is true by default, keeping the current new behavior added by Switch tabs with panel jump keys #3794
  • When SwitchTabsWithPanelJumpKeys is set to false in the user's config, the old behavior is returned which does not switch tabs using the side panel jump keys.
  • This is behavior is verified with an integration test with ``SwitchTabsWithPanelJumpKeys` set to false that shows the expected behavior that jumping to window 2 while window 2 is already active does not switch tabs within window 2

To disable switching tabs with panel jump keys, add the following to your config.yml:

gui:
  # If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead
  switchTabsWithPanelJumpKeys: false

P.S.

This is my first contribution to lazygit and while I absolutely strived to read all documentation and follow all standards, I accept that this PR may not be perfect and am very open to feedback and suggestions to improve both this code and any future contributions. I absolutely love lazygit, I use it everyday and swear by it as the most powerful and efficient tool for managing git, I love and appreciate all the work all the maintainers do to constantly improve it. So thank you to all who are reading this and I look forward to contributing more to make lazygit even more of the best git tool available!

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • No text rendered to user -> Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@stefanhaller stefanhaller added the enhancement New feature or request label Oct 17, 2024
@stefanhaller
Copy link
Collaborator

Sorry for taking so long to review this. It looks very good! Great job, especially considering it's your first contribution.

My only complaint is a git history nitpick: please don't merge master into your branch, this creates an ugly git history that is hard to make sense of. Please rebase on master instead.

I'm not merging this right away because there's now a discussion whether the default for the option should be false; waiting for that to be decided.

@jesseduffield
Copy link
Owner

@hgreenstein as per that linked discussion, let's disable the option by default.

@peauc
Copy link

peauc commented Nov 6, 2024

Looking forward for this feature to land on master 👀. With whatever default

@jesseduffield jesseduffield force-pushed the disable-switch-tab-with-panel-jump-keys branch 2 times, most recently from 30f963a to af43071 Compare November 9, 2024 06:09
@jesseduffield jesseduffield force-pushed the disable-switch-tab-with-panel-jump-keys branch from af43071 to 8da43af Compare November 9, 2024 06:19
@jesseduffield jesseduffield merged commit b2cbd93 into jesseduffield:master Nov 9, 2024
15 checks passed
@jesseduffield
Copy link
Owner

Thanks for the PR @hgreenstein !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants