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 info about binding to mac specific modifier keys #2913

Open
adsick opened this issue Jun 29, 2022 · 11 comments · May be fixed by #6592
Open

add info about binding to mac specific modifier keys #2913

adsick opened this issue Jun 29, 2022 · 11 comments · May be fixed by #6592
Labels
C-enhancement Category: Improvements

Comments

@adsick
Copy link

adsick commented Jun 29, 2022

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.

@the-mikedavis the-mikedavis added the C-enhancement Category: Improvements label Jun 29, 2022
@the-mikedavis
Copy link
Member

Command modifiers are not supported because they're not supported upstream in crossterm: crossterm-rs/crossterm#389

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

@archseer
Copy link
Member

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

@johalun
Copy link

johalun commented Jun 30, 2022

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.

@groves
Copy link
Contributor

groves commented Jul 29, 2022

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.

@kee-oth
Copy link

kee-oth commented Sep 28, 2022

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!

@peredwardsson
Copy link

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

@justaskz
Copy link

justaskz commented Jun 7, 2023

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?

@danillos
Copy link
Contributor

danillos commented Jun 7, 2023

@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.

@the-mikedavis
Copy link
Member

This will be closed by #6592

@the-mikedavis the-mikedavis linked a pull request Jun 7, 2023 that will close this issue
@justaskz
Copy link

justaskz commented Jun 7, 2023

@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

@LeeeSe
Copy link

LeeeSe commented Jan 28, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.