Skip to content

Instantly share code, notes, and snippets.

@themasch
Created May 28, 2014 08:31
Show Gist options
  • Save themasch/2e9d83850e6f375529c5 to your computer and use it in GitHub Desktop.
Save themasch/2e9d83850e6f375529c5 to your computer and use it in GitHub Desktop.
Sublime Macro to add a require() for the currently selected variable (pretty dirty)
{
"keys": ["ctrl+alt+r"],
"command": "run_macro_file",
"args": {"file": "Packages/User/require-selection.sublime-macro"}
}
[
{
"args": null,
"command": "copy"
},
{
"args": null,
"command": "toggle_bookmark"
},
{
"args":
{
"extend": false,
"to": "bof"
},
"command": "move_to"
},
{
"args":
{
"extend": false,
"to": "eol"
},
"command": "move_to"
},
{
"args":
{
"characters": "\n"
},
"command": "insert"
},
{
"args":
{
"characters": " ,"
},
"command": "insert"
},
{
"args":
{
"characters": " "
},
"command": "insert"
},
{
"args": null,
"command": "paste"
},
{
"args":
{
"characters": " ="
},
"command": "insert"
},
{
"args":
{
"characters": " require"
},
"command": "insert"
},
{
"args":
{
"contents": "($0)"
},
"command": "insert_snippet"
},
{
"args":
{
"contents": "'$0'"
},
"command": "insert_snippet"
},
{
"args": null,
"command": "paste"
},
{
"args": null,
"command": "next_bookmark"
},
{
"args": null,
"command": "toggle_bookmark"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment