Skip to content

Instantly share code, notes, and snippets.

@raejin
Created June 17, 2014 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raejin/801f666aefb042167c77 to your computer and use it in GitHub Desktop.
Save raejin/801f666aefb042167c77 to your computer and use it in GitHub Desktop.
[
{
"args":
{
"to": "eol"
},
"command": "move_to"
},
{
"args":
{
"characters": ";"
},
"command": "insert"
}
]
@arsham
Copy link

arsham commented Oct 5, 2018

Try this instead:

[
    { "command": "set_mark" },
    { "command": "move_to", "args": {"to": "eol"} },
    { "command": "insert", "args": {"characters": ";"} },
    { "command": "swap_with_mark" },
    { "command": "clear_bookmarks", "args": {"name": "mark"} },
]

This macro retains your current cursor place. I use it to add a comma (,) at the end of like while I am writing code.
I've also added this keymap for quickly adding it to the end of line:

    { "keys": ["ctrl+;"], "command": "run_macro_file", "args": {"file": "Packages/User/Macros/sepicolon_at_eol.sublime-macro"} },

Enjoy!

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