I’m a new SublimeText 2 user (Windows), and I’m having trouble using macros. I’m not sure whether they are broken, or whether they simply are very different from Vim or Emacs macros. When I record a simple macro it works OK, but anything complicated goes haywire: it does what I want when I record it the first time, but not on subsequent calls. I’ve noticed additional problems:
-
If I save the macro to disk, it sometimes seems to have more key strokes in it than it ought to. I recorded a macro where I began by jumping forward a couple of words (Control-Right) and then back a word (Control-Left); the macro on disk began with what seemed like a very long string of word movements.
-
If I save the macro to disk in my User package, it appears on the Tools/Macros submenu…but selecting it from that submenu doesn’t appear to do anything.
-
Any macro that includes searching (i.e., the “f” command in Vintage mode) appears to do the wrong thing when played back.
Is it broken? Am I missing something?
Here’s a painfully detailed example of what I’m trying to do. I’ve got a code file with a lot of entries that look like this:
typemethod SOMENAME {fdict} {
...
}
The macro is supposed to change one of the above to something more or less like this:
define SOMENAME {
typemethod ruleset {fdict} {
...
}
}
So I start at the beginning of the first line, select the name, e.g., “SOMENAME”, cut it, replace it with rule set, move to the line above, type in "define " and paste the name, and then use Control-M to jump to the bottom and add the closing “}”.
I’ve tried this using Vintage commands. I’ve tried in INSERT mode using normal ST movement and selection commands (e.g., Control-D Control-X to cut the name instead of Vi’s “cw”). It works when when I record it, but when I replay it on the next instance, the “define SOMENAME” ends up a couple of lines below the “typemethod” line, instead of right above it.
Note: I’ve also tried it using multiple selections; that worked great until it came time to paste the name into its new spot. All of the names I’d cut all went into the first selection.