Skip to content

Instantly share code, notes, and snippets.

@andypotts
Forked from harthur/snippet.md
Last active July 20, 2017 09:40
Show Gist options
  • Save andypotts/402c13fc45d15dfa7d1d24b2929e6662 to your computer and use it in GitHub Desktop.
Save andypotts/402c13fc45d15dfa7d1d24b2929e6662 to your computer and use it in GitHub Desktop.
console.log() + var_dump() key bindings for Sublime Text. Cmd + Shift + L.

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.ts", "match_all": true }
      ]
    },
    { "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": "var_dump(${1:}$SELECTION);\n${0}"
      }, "context":
      [
        { "key": "selector", "operator": "equal", "operand": "source.php", "match_all": true }
      ]
    }
]

Inserts a console.log() or var_dump() at the current cursor position, tab once to jump past.

@ahmadmilzam
Copy link

Nice one! I'll definitely use it. Thanks

@andypotts
Copy link
Author

@ahmadmilzam, great 😄

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