HOLD ON! I think I've come to the sweet spot.
Open Logi Options+ and deactivate "Always keep the keyboard layout Mac" (as it would interfere with next commands), then you can use:
- Fn+P, Windows Layout, \ and < are at their place in Parallels, plus Start and Alt act as Start and Alt in Parallels
- Fn+O, Mac Layout, \ and < are at their place in MacOs, plus Start and Alt act as Opt and Command in MacOs
- Fn+U (after setting Mac Layout), toggle "hybrid layout" where \ and < are at their right place/swapped depending if you're using MacOs/Parallels, plus Start and Alt act as Opt and Command in MacOs, while acting as Alt and Start (yeah, swapped, instead of Alt and Start) in Parallels
So far Fn+P it's the best option for me as the right Opt in MacOs is too far on the right, and I always use it on VS for @#[]{}. To fix this issue on MacOs layout too, add these lines into ~/Library/KeyBindings/DefaultKeyBinding.dict of your home directory (if the file does not exists, create it):
"@$é" = ("insertText:", "{");
"@$*" = ("insertText:", "}");
"@è" = ("insertText:", "[");
"@+" = ("insertText:", "]");
"@ò" = ("insertText:", "@");
"@à" = ("insertText:", "#");
To fix the issues in Visual Studio Code for Mac too, too, go to Code > Settings > Key Bindings > Open keyboard shortcuts (JSON) in the upper right corner (is a sheet icon with an arrow) and replace the file content with this one (if empty, otherwise add just the array elements you need):
[
//aperta graffa
{
"key": "shift+cmd+[BracketLeft]",
"command": "type",
"args": {
"text": "{"
},
"when": "editorTextFocus && !editorReadonly"
},
//chiusa graffa
{
"key": "shift+cmd+[BracketRight]",
"command": "type",
"args": {
"text": "}"
},
"when": "editorTextFocus && !editorReadonly"
},
//aperta quadra
{
"key": "cmd+[BracketLeft]",
"command": "type",
"args": {
"text": "["
},
"when": "editorTextFocus && !editorReadonly"
},
//chiusa quadra
{
"key": "cmd+[BracketRight]",
"command": "type",
"args": {
"text": "]"
},
"when": "editorTextFocus && !editorReadonly"
},
//cancelletto
{
"key": "cmd+
",
"command": "type",
"args": {
"text": "#"
},
"when": "editorTextFocus && !editorReadonly"
},
//chiocciola
{
"key": "cmd+[Semicolon]",
"command": "type",
"args": {
"text": "@"
},
"when": "editorTextFocus && !editorReadonly"
},
//punto dal tastierino numerico
{
"key": "numpad_decimal",
"command": "type",
"args": {
"text": "."
},
"when": "editorTextFocus && !editorReadonly"
},
//salva
{
"key": "ctrl+s",
"command": "workbench.action.files.save"
},
//salva tutto
{
"key": "ctrl+shift+s",
"command": "workbench.action.files.saveFiles"
},
//copia
{
"key": "ctrl+c",
"command": "editor.action.clipboardCopyAction"
},
//taglia
{
"key": "ctrl+x",
"command": "editor.action.clipboardCutAction"
},
//incolla
{
"key": "ctrl+v",
"command": "editor.action.clipboardPasteAction"
},
//commenta blocco
{
"key": "ctrl+k ctrl+c",
"command": "editor.action.addCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
//decommenta blocco
{
"key": "ctrl+k ctrl+u",
"command": "editor.action.removeCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
//seleziona tutto
{
"key": "ctrl+a",
"command": "editor.action.selectAll"
},
//annulla
{
"key": "ctrl+z",
"command": "undo"
},
//trova
{
"key": "ctrl+f",
"command": "actions.find",
"when": "editorFocus || editorIsOpen"
},
{
"key": "ctrl+h",
"command": "-deleteLeft",
"when": "textInputFocus"
},
{
"key": "ctrl+h",
"command": "editor.action.startFindReplaceAction",
"when": "editorFocus || editorIsOpen"
},
{
"key": "alt+cmd+f",
"command": "-editor.action.startFindReplaceAction",
"when": "editorFocus || editorIsOpen"
},
{
"key": "ctrl+shift+h",
"command": "workbench.action.replaceInFiles"
},
{
"key": "shift+cmd+h",
"command": "-workbench.action.replaceInFiles"
},
{
"key": "ctrl+[Semicolon]",
"command": "workbench.action.terminal.new"
}
]
And boom! Now the keyboard works perfectly everywhere.