Skip to content

Instantly share code, notes, and snippets.

@stpe
Forked from harthur/snippet.md
Created June 19, 2012 07:58
Show Gist options
  • Save stpe/2952891 to your computer and use it in GitHub Desktop.
Save stpe/2952891 to your computer and use it in GitHub Desktop.
console.log() key binding for Sublime Text 2

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}"
    }, 
    "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 }
    ]
  }
]

Inserts a console.log() (or corresponding depending on language) at the current cursor position, tab once to jump past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment