Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:
[
{ "keys": ["super+shift+l"],
"command": "insert_snippet",
"args": {
"contents": "console.log(${1:}$SELECTION);${0}"
}
}
]Inserts a console.log() at the current cursor position, tab once to jump past.
Very cool. I'd add a context match for javascript, so you can add additional logging styles based on the language:
{ "keys": ["super+shift+l"], "command": "insert_snippet", "args": { "contents": "console.log(${1:}$SELECTION);${0}" }, "context": [ { "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true } ] }, { "keys": ["super+shift+l"], "command": "insert_snippet", "args": { "contents": "NSLog(@\"${1:}$SELECTION\"$2);\n${0}" }, "context": [ { "key": "selector", "operator": "equal", "operand": "source.objc", "match_all": true } ] }