-
Notifications
You must be signed in to change notification settings - Fork 56
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
Option keys not usable as mappings on macOS #18
Comments
This probably requires separate key bindings, but fortunately microsoft/vscode#54894 makes this very easy. However we have a bigger problem for international layouts and Chrome OS. |
Out of curiosity, how does it work in Kakoune? |
I'm affraid separate key bindings for macOS won't work. The problem is more fundamental, namely that you're simply not able to bind anything to It works in Kakoune, because the macOS Terminal app (and other third party terminal apps) provide a setting to interpret the option key as the meta key. |
The solution is as follows. The So when the keybinding is defined as follows:
everything is all right. This holds for commands bound to |
I'm okay with removing |
Yeah, it will have side effects. I think you'll be allowed to fire the shortcut regardless of the focus. So when your editing your commit message in a Git side-bar, and hit Conclusion: it will introduce new "bugs". Question: are they worth it? If we remove the |
We can always make this optional by providing alternate keybindings in |
Experimented a bit more with this. Sadly doesn't work in every case. I recommend users to switch to the keyboard layout "Unicode Hex-input", which doesn't have dead keys under the option key. Closing this for now. If anybody has a more sustainable solution, please let us know! |
I wanted to share my workaround: I'm using Karabiner to remap In the end I went even further. I remapped Here's what the setup looks like in Karabiner Elements. {
"description": "Change spacebar to control+alt in VScode for Dance actions",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"com\\.microsoft\\.VSCode",
"com\\.microsoft\\.VSCodeInsiders"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "spacebar",
"modifiers": {}
},
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 240,
"basic.to_if_held_down_threshold_milliseconds": 5
},
"to_if_alone": [
{
"key_code": "spacebar"
}
],
"to_if_held_down": [
{
"key_code": "left_control",
"modifiers": ["left_option"]
}
],
"type": "basic"
}
]
} In my experience this is what the timeouts mean:
|
Reviving this -- I'm working on updated keybindings for Dance on Mac (and for alternative keyboard layouts). Given that the user will have a set-up step where they'll choose their layout and OS, what do you think should be changed to make Dance friendlier to macOS? Ideally we wouldn't need system-wide changes or Karabiner. |
@71 apologies if this has been discussed elsewhere; I didn't see it. Has there been any progress on implementing a set-up step? I'm happy to test if it's in dev and not released yet.
Probably a setting to remap |
I'm just trying out Dance, and hitting this. This might be a basic question — but how does vscodevim succeed at this? |
I'm not even sure whether there are commands in Vim that use |
The problem with this is that it seems to be QWERTY only... |
@max-sixty Yes, but there are other ways of doing this. One promising way is to use Ukulele (or something similar) to create a copy of whatever keyboard layout you want but without the keys bound to |
Hope it's OK to come back to this
Here's a quick example — in vscode I have a custom shortcut: {
"key": "alt+d",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
}, When I have this set, ...indeed, I get 23 matches for (I wish I could be more helpful than "here's something that does it", I realize it's not nearly as helpful as understanding how...) |
I've been using Dance on VSCode for a while now and it's working out really well. There are two things you can do:
This SO question lists multiple options for creating your own keyboard layout. TL;DR: Use Ukulele. If you're on QWERTY, someone left their fixed layout in the comments. |
@max-sixty Oh that's a great point, but I don't know how that works exactly and how the OS chooses which keybindings you can override and which ones you cannot. |
I've also stumbled upon this and tried a few solutions. Nothing seems ideal. I have my own keyboard layout made with Ukelele and I need the alt key for some text input of special characters...
Thank you, @71! Could you make any progress on this since last summer? |
Update: activating the VSCode setting |
This works well! FWIW it doesn't work for all keys — e.g. |
On macOS the alt/option key is used as a second shift like key: one can enter special characters as ∂, ƒ, ¬, ø (
option+d
,option+f
,option+l
,option+o
). Problematic are the keysoption+\``,
option+e,
option+u,
option+i,option+n
which are dead keys to compose diacritics like è, é, ë, ê and ñ. These can't be used to map Kakoune/Dance chords.This solution only adds support to use option as meta in the terminal emulator of VSCode. Using something like this in the editor is currently not supported and should probably be fixed in core VSCode.
The text was updated successfully, but these errors were encountered: