Home Download Buy Blog Forum Support

Package menu in ST2?

Package menu in ST2?

Postby Marciano on Sat Feb 12, 2011 3:57 am

Hi all,

sorry if this has been mentioned before---I could not find a reference to it. How do I create a "Packages | <plugin-name>" submenu in ST2? I would really like to port my LaTeX plugin to ST2. Converting the existing package-menu file (in the LaTeX subdirectory) to JSON does not seem to work, but perhaps I am doing something wrong.

Thanks!
Marciano
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: Package menu in ST2?

Postby jps on Sat Feb 12, 2011 8:43 am

Package menus aren't supported yet in Sublime Text 2, but they will be in the future.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Package menu in ST2?

Postby Marciano on Sat Feb 12, 2011 6:40 pm

OK, thanks. Can I define package-specific keybindings? I tried creating a file called "Default (OSX).sublime-keymap" with the same JSON syntax as the file by the same name in "Packages/Default" (with an additional keybinding), but that did not seem to do anything. That is, the new key binding was not recognized.

Thanks again! M
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: Package menu in ST2?

Postby Marciano on Sun Feb 13, 2011 5:46 pm

OK, I think I answered my own question. You must explicitly add your key bindings using the Preferences | User Key Bindings menu. That's OK for now.
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: Package menu in ST2?

Postby jps on Tue Feb 15, 2011 5:01 am

You can create extra package-level key bindings, but you'll have to restart after doing so.

For example, if you save this:

Code: Select all
[
   { "keys": ["ctrl+k", "ctrl+q"], "command": "show_about_window" }
]


In Packages/Python/Default (Windows).sublime-keymap, then on next startup, you should see this in the console:

Code: Select all
found 3 files for base name Default (Windows).sublime-keymap


Which indicates the extra file is being read in.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Package menu in ST2?

Postby fxdgear on Tue Feb 15, 2011 5:21 am

I have a question regarding plugin specific keymapings.

I have a plugin, I added the keymaping to the Default (OSX).sublime-keymap, everything worked just smooth as a peach.

Then I decided I wanted my plugin to use it's own keybindings so that I can keep the keybindings and plugin together.
So when I copied the Default (OSX).sublime-keymap to plugin_name.sublime-keymap, cleared the default one, restarted, and now I get this error:
``no command for selector: noop:``

is this expected behavior?

Thanks
n
fxdgear
 
Posts: 9
Joined: Tue Feb 15, 2011 5:13 am

Re: Package menu in ST2?

Postby jps on Tue Feb 15, 2011 6:16 am

That message is unrelated, and can be ignored.

Only keymaps named "Default (<platform>).sublime-keymap" are used, any other files will be ignored.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Package menu in ST2?

Postby fxdgear on Tue Feb 15, 2011 7:07 am

Jps,

Grand thanks. Is there plan to support other keymap named files?

N
fxdgear
 
Posts: 9
Joined: Tue Feb 15, 2011 5:13 am

Re: Package menu in ST2?

Postby jps on Tue Feb 15, 2011 7:32 am

Yes, but you don't need them for this.

Just make a set of Default (XXX).sublime-keymap files in your package directory, and they'll get merged into the key bindings on load.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Package menu in ST2?

Postby fxdgear on Tue Feb 15, 2011 5:44 pm

jps,

So that being said if I were to do something like this:

Default (python_debugger).sublime-keymap

That should get merged into the keybindings on load, right?

n
fxdgear
 
Posts: 9
Joined: Tue Feb 15, 2011 5:13 am

Next

Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests