helix icon indicating copy to clipboard operation
helix copied to clipboard

add info about binding to mac specific modifier keys

Open adsick opened this issue 3 years ago • 5 comments

documentation describes modifier keys in terms of classic "Control, Alt, Shift" trinity, but mac has "Command, Option, Shift" (and Control which I don't want to use), how to deal with it? maybe add a note about it in the documentation?

I want to have Command-x bindings, not Control-x.

adsick avatar Jun 29 '22 10:06 adsick

Command modifiers are not supported because they're not supported upstream in crossterm: https://github.com/crossterm-rs/crossterm/issues/389

Support for command could most likely be added with a GUI but otherwise awaits that issue upstream.

the-mikedavis avatar Jun 29 '22 14:06 the-mikedavis

As far as I know, Cmd usually isn't exposed at all in macOS terminals, I think you'd need to remap it inside iTerm to expose it. It would start to clash with OS-level/terminal shortcuts like Cmd+n etc

archseer avatar Jun 29 '22 15:06 archseer

iTerm2 is very flexible with remapping modifier keys. ctrl is in an awkward location on macs. I always swap caps lock and ctrl in system preferences but if you don't want that I'm sure iTerm2 can help.

johalun avatar Jun 30 '22 15:06 johalun

Command can be exposed with Kitty's keyboard protocol. That's started being added in https://github.com/crossterm-rs/crossterm/pull/691. Once that lands, I think we could build on it for additional modifiers.

groves avatar Jul 29 '22 18:07 groves

Command can be exposed with Kitty's keyboard protocol. That's started being added in crossterm-rs/crossterm#691. Once that lands, I think we could build on it for additional modifiers.

@groves Just pinging that the linked PR has been merged as I am interested in this as well. Thanks!

kee-oth avatar Sep 28 '22 05:09 kee-oth

Also interested. Editor looks great, but using Mac + nordic keyboard makes it a little awkward.

peredwardsson avatar Oct 10 '22 15:10 peredwardsson

Are there any updates?

I tried to remap keys using kitty: When Cmd+KEY is pressed, kitty sends Ctrl+KEY hex code as text. However it does not work. And there is no way to debug it.

Does anyone have any success in making Command key working?

justaskz avatar Jun 07 '23 13:06 justaskz

@justaskz one example with Kitty that I did to save with cmd+s

# Kitty config

map cmd+S send_text all \x13
# Helix Config

[keys.normal]
'C-s' = ':w!'

\x13 = control+s you can see more here Kitty accepts unicode too.

danillos avatar Jun 07 '23 13:06 danillos

This will be closed by https://github.com/helix-editor/helix/pull/6592

the-mikedavis avatar Jun 07 '23 14:06 the-mikedavis

@danillos thank you, it is working now!!

I took wrong config example from somewhere map cmd+s send_text normal,application \x13 and it did not work

justaskz avatar Jun 07 '23 20:06 justaskz

if you use alacritty,Bind cmd + s to ctrl + s and use it with helix's key bindings

~/.config/alacritty/alacritty.yaml

import = ["/Users/ls/.config/alacritty/themes/themes/tokyo-night.toml"]
live_config_reload = true

[font]
# AppleFontSmoothing = true
size = 14.0

[font.normal]
family = "JetBrainsMono Nerd Font"
style = "Regular"

[[keyboard.bindings]]
chars = "\u0013"
key = "S"
mods = "Command"

~/.config/helix/config.toml

theme = "tokyonight"

[editor]
middle-click-paste = false
auto-save = true

[editor.file-picker]
hidden = false


[editor.lsp]
display-messages = true
display-inlay-hints	= true

[editor.cursor-shape]
normal = "block"
insert = "bar"

[keys.normal]
C-s = ":w"

LeeeSe avatar Jan 28 '24 06:01 LeeeSe