In previous editors I've users, notably SublimeText and Atom, I was able to create a simple command to add a character like
when I type option-space
.
In Atom, for example, I created the command in init.coffee
:
atom.commands.add 'atom-text-editor',
'editor:insert-nbsp': (event) ->
editor = @getModel()
editor.insertText(' ')
and then the easy part, a keybinding to call the custom command:
'alt-enter': 'editor:insert-br'
In vscode, I know how to do the latter (create a keybinding) but how to create the command.
I realize I can create a snippet, which I have made several of, but I want to essentially trigger the
snippet with a keybinding.
How can I do this?
It's actually much easier in VSCode since 1.9:
{
"key": "alt+space",
"command": "type",
"args": {
"text": " "
},
"when": "editorTextFocus"
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With