Skip to content

Instantly share code, notes, and snippets.

@scaomath
Last active November 12, 2020 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scaomath/71a6e8abae532163df9ea2ea4693b9b9 to your computer and use it in GitHub Desktop.
Save scaomath/71a6e8abae532163df9ea2ea4693b9b9 to your computer and use it in GitHub Desktop.
VS Code key bindings for shortcuts on Ubuntu Linux to mimic MacOS behavior
// On Ubuntu Linux mimic MacOS keybindings on Logitech MX Keys
// where the layout is slightly different to incorporate both MacOS and Linux into one keyboard
// after customized key mapping: ctrl is mapped to alt; alt is mapped to win; (meta is mapped to ctrl)
// in /etc/default/keyboard: XKBOPTIONS="altwin:ctrl_alt_win"
//
[
{
"key": "ctrl+left",
"command": "cursorHome",
"when": "textInputFocus"
},
{
"key": "shift+ctrl+left",
"command": "cursorHomeSelect",
"when": "textInputFocus"
},
{
"key": "ctrl+right",
"command": "cursorEnd",
"when": "textInputFocus"
},
{
"key": "shift+ctrl+right",
"command": "cursorEndSelect",
"when": "textInputFocus"
},
{
"key": "alt+right",
"command": "cursorWordEndRight",
"when": "textInputFocus"
},
{
"key": "shift+alt+right",
"command": "cursorWordEndRightSelect",
"when": "textInputFocus"
},
{
"key": "ctrl+alt+left",
"command": "cursorWordPartLeft",
"when": "textInputFocus"
},
{
"key": "ctrl+shift+alt+left",
"command": "cursorWordPartLeftSelect",
"when": "textInputFocus"
},
{
"key": "ctrl+alt+right",
"command": "cursorWordPartRight",
"when": "textInputFocus"
},
{
"key": "ctrl+shift+alt+right",
"command": "cursorWordPartRightSelect",
"when": "textInputFocus"
},
{
"key": "alt+left",
"command": "cursorWordStartLeft",
"when": "textInputFocus"
},
{
"key": "shift+alt+left",
"command": "cursorWordStartLeftSelect",
"when": "textInputFocus"
},
{
"key": "ctrl+backspace",
"command": "deleteAllLeft",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+delete",
"command": "deleteAllRight",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+backspace",
"command": "deleteWordLeft",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+meta+backspace",
"command": "deleteWordPartLeft",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+meta+delete",
"command": "deleteWordPartRight",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+delete",
"command": "deleteWordRight",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+up",
"command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+ctrl+f",
"command": "editor.action.startFindReplaceAction"
},
{
"key": "alt+ctrl+[",
"command": "editor.fold",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+]",
"command": "editor.unfold",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+enter",
"command": "editor.action.replaceAll",
"when": "editorFocus && findWidgetVisible"
},
{
"key": "alt+enter",
"command": "editor.action.selectAllMatches",
"when": "editorFocus && findWidgetVisible"
},
{
"key": "alt+ctrl+c",
"command": "toggleFindCaseSensitive",
"when": "editorFocus"
},
{
"key": "alt+ctrl+l",
"command": "toggleFindInSelection",
"when": "editorFocus"
},
{
"key": "alt+ctrl+r",
"command": "toggleFindRegex",
"when": "editorFocus"
},
{
"key": "alt+ctrl+w",
"command": "toggleFindWholeWord",
"when": "editorFocus"
},
{
"key": "alt+down",
"command": "showNextParameterHint",
"when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "alt+up",
"command": "showPrevParameterHint",
"when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "alt+meta+space",
"command": "toggleSuggestionFocus",
"when": "suggestWidgetVisible && textInputFocus"
},
{
"key": "meta+enter",
"command": "notebook.cell.execute",
"when": "notebookCellListFocused"
},
{
"key": "alt+enter",
"command": "notebook.cell.executeAndInsertBelow",
"when": "notebookCellListFocused"
},
{
"key": "meta+ctrl+enter",
"command": "python.execInTerminal"
},
{
"key": "shift+meta+up",
"command": "cursorMove",
"args": {
"to": "up",
"by": "line",
"value": 10
},
"when": "editorTextFocus"
},
{
"key": "shift+meta+down",
"command": "cursorMove",
"args": {
"to": "down",
"by": "line",
"value": 10
},
"when": "editorTextFocus"
},
{
"key": "meta+shift+x",
"command": "workbench.action.terminal.kill"
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment