Skip to content

Allow overriding the platform used for default keybindings#5671

Open
stefanhaller wants to merge 1 commit into
masterfrom
envvar-for-platform-keybindings
Open

Allow overriding the platform used for default keybindings#5671
stefanhaller wants to merge 1 commit into
masterfrom
envvar-for-platform-keybindings

Conversation

@stefanhaller
Copy link
Copy Markdown
Collaborator

A handful of default keybindings differ by platform (e.g. word-wise cursor movement in text inputs uses alt on macOS but ctrl elsewhere). Lazygit chooses these based on the OS it runs on, but that's the wrong signal when the OS isn't where the user is actually typing: someone running lazygit in a Linux container that they access over ssh from a Mac gets the Linux bindings, when they'd rather have the Mac ones. Remapping each binding by hand via config is tedious, so add a single LAZYGIT_KEYBINDING_PLATFORM override.

Closes #5668.

A handful of default keybindings differ by platform (e.g. word-wise
cursor movement in text inputs uses alt on macOS but ctrl elsewhere).
Lazygit chooses these based on the OS it runs on, but that's the wrong
signal when the OS isn't where the user is actually typing: someone
running lazygit in a Linux container that they access over ssh from a
Mac gets the Linux bindings, when they'd rather have the Mac ones.
Remapping each binding by hand via config is tedious, so add a single
LAZYGIT_KEYBINDING_PLATFORM override.

An unrecognized value falls back to the real OS rather than to the
non-darwin default bindings, since the latter would be an arbitrary
choice.
@hanoii
Copy link
Copy Markdown

hanoii commented Jun 4, 2026

go run main.go which I assume is fine

Yes, that's right.

without the env var I was able to use either both ctrl+backspace and alt+backspace for deleting a word.

Are you really sure that's true? I find this hard to believe.

@hanoii
Copy link
Copy Markdown

hanoii commented Jun 5, 2026

Are you really sure that's true? I find this hard to believe.

I am sure - I just tried it out side of the dev container, directly on my host and it doesn't do it. It's probably some keyboard emulation from vscode. It was a vscode terminal window of a dev container, so there's quite a few layers. What I found odd is that with the environment variable one of the other stopped working.

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.

Provide a way to override platform map keyboards globally.

2 participants