How do I set a shortcut for inserting console.log()
and wrapping it around my current selection in Sublime Text without installing any plugin or extra third-party stuff?
So I found the answer. Thought I'd add it here for others:
Go to Sublime Text 2 > Preferences > Key Bindings - User
and add this JSON to the file:
[
{ "keys": ["alt+d"],
"command": "insert_snippet",
"args": {
"contents": "console.log(${1:}$SELECTION);${0}"
}
}
]
Inserts a console.log()
at the current cursor position on pressing alt+d
.
Reference: https://gist.github.com/harthur/2951063
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