Skip to content

feat: ctrl+h for bindings on mac#4127

Closed
nimma15 wants to merge 3 commits into
micro-editor:masterfrom
nimma15:feat/ctrl+h-for-bindings-on-mac
Closed

feat: ctrl+h for bindings on mac#4127
nimma15 wants to merge 3 commits into
micro-editor:masterfrom
nimma15:feat/ctrl+h-for-bindings-on-mac

Conversation

@nimma15

@nimma15 nimma15 commented Jun 19, 2026

Copy link
Copy Markdown

Ctrl+h for bindings on Mac, while saving alt+g for linux and windows
On Mac, Option+G produces the © symbol instead of sending an Alt+G key event, so the bindings help action is inaccessible to Mac users without terminal reconfiguration. Since Ctrl+H is traditionally a backspace alias that micro already handles via the Backspace key itself, repurposing it for bindings has minimal impact

@dmaluka

dmaluka commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Why?

@nimma15

nimma15 commented Jun 20, 2026

Copy link
Copy Markdown
Author

Why?

On Mac, Option+G produces the © symbol instead of sending an Alt+G key event, so the bindings help action is inaccessible to Mac users without terminal reconfiguration. Since Ctrl+H is traditionally a backspace alias that micro already handles via the Backspace key itself, repurposing it for bindings has minimal impact

@dmaluka

dmaluka commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

I see.

Actually, I see this in micro's README:

Note for Mac: All micro keybindings use the control or alt (option) key, not the command
key. By default, macOS terminals do not forward alt key events. To fix this, please see
the section on macOS terminals further below.

[...]

If you are using macOS, you should consider using iTerm2 instead of the default terminal (Terminal.app). The iTerm2 terminal has much better mouse support as well as better handling of key events. For best keybinding behavior, choose xterm defaults under Preferences->Profiles->Keys->Presets..., and select Esc+ for Left Option Key in the same menu. The newest versions also support true color.

If you still insist on using the default Mac terminal, be sure to set Use Option key as Meta key under
Preferences->Profiles->Keyboard to use option as alt.

So this applies to any Alt keybindings, not just to Alt-g? And micro has a bunch of other default Alt keybindings besides Alt-g. So nothing really special about Alt-g here?

@dmaluka

dmaluka commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Anyway,

On Mac, Option+G produces the © symbol instead of sending an Alt+G key event, so the bindings help action is inaccessible to Mac users without terminal reconfiguration. Since Ctrl+H is traditionally a backspace alias that micro already handles via the Backspace key itself, repurposing it for bindings has minimal impact

Could you add this explanation to the commit message?

Comment thread runtime/help/keybindings.md Outdated
Comment thread internal/action/events.go Outdated
Comment thread internal/action/defaults_darwin.go
- Restore Alt-g binding in macOS defaults

- Add comment explaining tcell.KeyCtrlH vs KeyBackspace overlap

- Separate Alt-g and Ctrl-h into distinct lines in keybindings docs
Comment thread internal/action/events.go Outdated
"CtrlH": "Backspace",
"CtrlH": "ToggleKeyMenu",
"Backspace": "Backspace",
"OldBackspace": "Backspace",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But OldBackspace still has a meaning:

"Backspace": tcell.KeyBackspace2,
"OldBackspace": tcell.KeyBackspace,

Doesn't this influence/brake present binding configurations?
It changes first with tcell v3, where tcell treats KeyBackspace2 as KeyBackspace.

@nimma15 nimma15 closed this Jun 25, 2026
@nimma15 nimma15 deleted the feat/ctrl+h-for-bindings-on-mac branch June 25, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants