Reputation: 1594
In Sublime (Version 3.2.2, Build 3211) (Ubuntu 18.04.5), I'd like to record a macro where I select-all, copy and paste the current content into another, unsaved file. And then do other commands as well, but I'm not even getting that far. The new-file step doesn't seem to work – neither new
, nor new_window
, newWindow
, new_file
, newFile
seem to work; not even reopen_last_file
. It should be new_file
, though.
The console throws this:
Unknown macro command new_file
Which is weird. The command new_file
works fine in other contexts: looking at the key-bindings settings, ctrl+n
is bound to the same command and the hotkey has no issues.
Selecting all, copying – even this following bit works as intended:
{
"command": "insert",
"args": {"characters": "Hello, Friend!\n"}
}
In their forums, user "jps" writes:
With regards to the other console messages (unknown command, etc), don’t worry about them, they’re supposed to be there :slight_smile:
… but this doesn't seem to be right if it's obviously not working.
I have a project open but closing the project has no effect.
Is there maybe a package or something missing?
Upvotes: 0
Views: 75
Reputation: 22791
Macros in sublime can only capture and replay TextCommand
commands; that is, commands that directly modify the content of a buffer or it's visual state. Examples including adding or removing text, changing the selection, moving the cursor around or changing view
specific settings (like toggling word wrap or changing rulers, etc).
Commands like new_file
, new_window
or opening and closing projects are WindowCommand
commands, which can't be captured via a macro.
In order to run a sequence of commands that includes a WindowCommand
(or ApplicationCommand
), you need to use a package. Two examples of that which are readily available on Package Control are Chain of Command and Multicommand.
Upvotes: 1