Sublime Forum

[ST3] view.run_command doesn't work for all commands

#1

Hello,

I’m testing out running commands from the Python console in ST3. Some commands work, for example:

>>> view.run_command('duplicate_line')

But others don’t, for example:

>>> view.run_command('toggle_minimap')

Why is that? Can’t all the commands be executed on the view object?

1 Like

#2

Hmm… it seems that this does work:

>>> window.run_command('toggle_minimap')

So is there a clear division of the commands that should run on view vs. commands that should run on window?

0 Likes

#3

Yes.

0 Likes

#4

[quote=“eliben”]Hmm… it seems that this does work:

>>> window.run_command('toggle_minimap')

So is there a clear division of the commands that should run on view vs. commands that should run on window?[/quote]

According to the API reference, sublime.run_command() runs ApplicationCommands, view.run_command() runs TextCommands, and window.run_command() runs any type of command.

1 Like