Sublime Forum

Macro binding

#1

OK, so I created a macro and it works. I had recorded 5 up arrow presses and saved it as 5up macro. Here it is:

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

It works perfectly when selected from Tools -> Macros…
BUT when i added:

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

which was supposed to move 5 lines down it plays 5up macro, and when I’m selecting this macro from menu it plays well…
It just makes no sense…

0 Likes

#2

Let me try to restate your problem and see if I’m understanding what you’re saying. You have a macro named 5up that you’ve defined, and bound to a keybind and it works both in the menu and via keybind. You created a new macro named 5down. This macro works if you select it by menu, but does not select by keybind. Is that correct?

If that is the case, I suspect something in the keybind or keys you’re hitting is a little strange. Try opening the console and putting in the two logging commands and see if that sheds any light on the keys your hitting or the commands that are being executed:

sublime.log_commands(True)
sublime.log_input(True)
0 Likes

#3

That’s the console output:

key evt: control+down
command: run_emmet_action {"action": "decrement_number_by_1"}
key evt: control+5
command: run_macro_file {"file": "res://Packages/User/Macros/down/5down.sublime-macro"}
key evt: control+up
command: run_emmet_action {"action": "increment_number_by_1"}
key evt: control+5
command: run_macro_file {"file": "res://Packages/User/Macros/down/5down.sublime-macro"}

It seems that emmet plugin crushes the makro, but what is strange is that makro starts with ctrl+5 even if it’s binded with ctrl+arrow+5.
I will try to change keybindings and make another reply.

0 Likes

#4

Ok so i have changed makro to:

{ "keys": ["ctrl+'"], "command": "run_macro_file", "args": {"file": "res://Packages/User/Macros/down/5down.sublime-macro"} },
{ "keys": ["ctrl+;"], "command": "run_macro_file", "args": {"file": "res://Packages/User/Macros/up/5upside.sublime-macro"} },

And it’s working perfectly. Now i can move fast up and down!

1 Like

#5

I’m glad you’ve got it working! It can be a real challenge to find appropriate and useful keybinds for everything you want to do.

0 Likes