Skip to content

Instantly share code, notes, and snippets.

@ashleemboyer
Last active July 14, 2024 18:31
Show Gist options
  • Save ashleemboyer/6509df0445695578e11998b7d064fbd5 to your computer and use it in GitHub Desktop.
Save ashleemboyer/6509df0445695578e11998b7d064fbd5 to your computer and use it in GitHub Desktop.
My custom VS Code keybindings
// These override the defaults
[
// Inserts Markdown inline-code syntax and places the cursor between the backticks (`)
{
"key": "cmd+e",
"command": "extension.multiCommand.execute",
"when": "editorLangId == markdown && editorTextFocus && !editorHasSelection",
"args": {
"sequence": [
{
"command": "type",
"args": {
"text": "``"
}
},
"cursorLeft"
]
}
},
// Surrounds selected text with backticks (`) in Markdown
{
"key": "cmd+e",
"when": "editorLangId == markdown && editorHasSelection",
"command": "type",
"args": {
"text": "`"
}
},
// Inserts a 2x2 Markdown table
{
"key": "cmd+t",
"command": "type",
"when": "editorLangId == markdown && editorTextFocus && !editorHasSelection",
"args": {
"text": "| Column | Column |\n| ------ | ------ |\n| Cell | Cell |"
}
},
// Inserts Markdown hyperlink syntax and places the cursor in the link text brackets (`[]`)
{
"key": "cmd+k",
"command": "extension.multiCommand.execute",
"when": "editorLangId == markdown && editorTextFocus && !editorHasSelection",
"args": {
"sequence": [
{
"command": "type",
"args": {
"text": "[]()"
}
},
"cursorLeft",
"cursorLeft",
"cursorLeft"
]
}
},
// Surrounds selected text in Markdown hyperlink syntax and places the cursor in the link href parentheses (`()`)
{
"key": "cmd+k",
"command": "extension.multiCommand.execute",
"when": "editorLangId == markdown && editorHasSelection",
"args": {
"sequence": [
"editor.action.clipboardCopyAction",
{
"command": "type",
"args": {
"text": "["
}
},
"editor.action.clipboardPasteAction",
"cursorRight",
{
"command": "type",
"args": {
"text": "()"
}
},
"cursorLeft"
]
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment