Home Download Buy Blog Forum Support

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

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

Postby eliben on Wed Mar 27, 2013 1:39 pm

Hello,

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

Code: Select all
>>> view.run_command('duplicate_line')


But others don't, for example:

Code: Select all
>>> view.run_command('toggle_minimap')


Why is that? Can't all the commands be executed on the view object?
eliben
 
Posts: 3
Joined: Wed Mar 27, 2013 1:36 pm

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

Postby eliben on Wed Mar 27, 2013 1:43 pm

Hmm.. it seems that this does work:

Code: Select all
>>> 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?
eliben
 
Posts: 3
Joined: Wed Mar 27, 2013 1:36 pm

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

Postby adzenith on Wed Mar 27, 2013 3:52 pm

Yes.
adzenith
 
Posts: 1215
Joined: Mon Oct 19, 2009 9:12 pm

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

Postby phyllisstein on Sun Mar 31, 2013 10:26 am

eliben wrote:Hmm.. it seems that this does work:

Code: Select all
>>> 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?


According to the API reference, sublime.run_command() runs ApplicationCommands, view.run_command() runs TextCommands, and window.run_command() runs any type of command.
phyllisstein
 
Posts: 49
Joined: Fri Aug 24, 2012 5:28 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 22 guests