Snippets code from my daily experience

November 9, 2007

OpenKomodo key bindings

Filed under: komodo,xul — dafi @ 8:39 pm

OpenKomodo allows users to choose key bindings based on its own taste.

Starting from several system keysets it is possibile to create new schemes.

Developers can write code using this feature.

You need to

  • overlay chrome://komodo/content/commandsOverlay.xul into chrome.manifest
  • add “observes” attribute to menuitems

Below I show the code that I’ll add to Morekomodo ASAP

The overlayed commandsOverlay.xul should contain

<overlay id="morekomodoCommandOverlay" xmlns="...">
   <broadcasterset id="broadcasterset_global">
        <broadcaster
          id="cmd_morekomodo_favorites"
          key="key_cmd_morekomodo_favorites"
          desc="General: Open Favorites..."
          oncommand="moreKomodo.openFavorites(event);"/>
        <broadcaster
           id="cmd_morekomodo_capitalize"
           key="key_cmd_morekomodo_capitalize"
           desc="Source Code: Capitalize selected text"
           oncommand="..."/>
   </broadcasterset>
</overlay>

You can notice the desc attribute, it contains a short description about the command.

The string preceding the colon (:) represents the category command, the other the real description.

The XUL <menuitem/>s use the observes attribute to reflect key binding.

The attribute value must match the broadcaster id.

<menuitem id="morekomodo-openfavorites"
    label="Open favorites..."
    observes="cmd_morekomodo_favorites" />

ActiveState has defined a set of categories not all applicable to OpenKomodo.

Developer can define its own category but it’s recommended to join already existing one ;-)

Name OpenKomodo
Breakpoint Manager no
Code Browser yes
Debugger no
Editor yes
Find yes
General yes
Help yes
HTTP Inspector no
HTTP Inspector Rules no
HTTP Proxy Debugger Editor no
Macro yes
Projects/Toolbox yes
SCC History no
Source Code yes
Source Control no
Toolbox yes
Tools yes
User Interface yes

Another benefit from this technique consists to have key bindings into the list generated by OpenKomodo (ie from Help menu select “List Key Bindings”)

The Rubric Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.