Sublime Forum

Access macros from Command Palette

#1

We can see a list of snippets when we type “snippet” or snippet name in command palette:

Capture

It would be nice to see the list of all our macros when we type “macro” or macro’s name in command palette and get the list of all macros, like for the list of snippets. In that way we do not have to associate macros to commands (do not have to bind macro to a key, we can just search for it in command palette)

0 Likes

#2

Would a plugin implementation suffice for something like that? I do a similar thing in my EnhancedSnippets package to make snippet files that Sublime doesn’t recognize appear in the command palette. Should also be possible to make it do that for macros as well.

1 Like

#3

Yes that would be great xD

0 Likes

#4

Incidentally I started working on a package to do this, but I will be unable to work on it for the month of December due to other things going on and lack of free time.

I should however be able to return to it in January at the latest.

1 Like

#5

Thanks xD. That is generally great. Anytime when you have time xD

0 Likes

#6

Sorry for the delay, but after a month of nonstop code streaming I took some time off to decompress.

An initial version of a package that does this can be found at: https://github.com/STealthy-and-haSTy/MacroPalette

This is not “officially” released, but there are instructions on how to get PackageControl to install it at: https://github.com/STealthy-and-haSTy/SublimePackages/tree/master

1 Like

#7

Thanks xD

I will give it a go.

0 Likes

#8

I have added the repo but when I search for the package via Package Control it does not appear.

0 Likes

#9

What build of Sublime are you running? The package requires at least 4073.

Also just to double check, when you use the command in Package Control to add the repo, the URL you want to provide is https://raw.githubusercontent.com/STealthy-and-haSTy/SublimePackages/master/unreleased-packages.json

1 Like

#10

I have version 4192 and it does not appear with me either

1 Like

#11

Hmm, that’s interesting. Can either of you see a package named Envault or ProjectSpecificKeys in the list?

I suspect that something may be hinky behind the scenes somewhere because I can’t see it either but I can see other packages from that source, which seems like an indication that the package control crawler has not pulled in the latest version of the file or something.

In any case, in a pinch you can do Package Control: Add Repository and then use https://github.com/STealthy-and-haSTy/MacroPalette as the repository URL, which will definitely make it available.

1 Like

#12

yes I can see both of these

0 Likes

#13

I was able to add it via direct link to repo and it’s working. Thank you xD

0 Likes

#14

With direct link to repo it’s working for me also.

0 Likes

#15

@OdatNurd

When I add new macros, they don’t appear in the Command Palette. I have to restart Sublime in order for them to appear in Command Palette. Can it be set up that they are available as I add them, like the Snippets do.

0 Likes

#16

There should be a command palette entry MacroPalette: Refresh Macro Cache that will rescan so you don’t need to quit to get it to notice.

In theory the plugin could try to catch when the save macro command runs and then scan again; it would not be able to notice macros springing into existence if something else put them there though.

It does however notice when packages are added or removed and adjusts then, though.

1 Like

#17

Thank you xD

0 Likes

#18

So in retrospect it turns out that this is not easily possible because the command to save a macro is asynchronous, and fires as soon as you select it even though it’s still prompting you for the filename to use.

As such there is no good way to tell that a new macro has arrived like this without constantly scanning to see if a new file appears somewhere in a package.

1 Like

#19

Thanks xD

I understand, it’s not a big deal. I use it without that with not problems.

0 Likes