-
Notifications
You must be signed in to change notification settings - Fork 214
Keybindings
Tim Officer edited this page Jan 16, 2016
·
7 revisions
Mongotron keybindings are stored in a config file called keybindings.json
~/.mongotron/keybindings.json
Keybindings work very similarly to Atom's keybindings. Each object contains the all the keybindings that are registered in a particular context. Having different contexts allows you to have the same key combination do different things, depending on the context.
"mongotron-workspace": {
"cmd-shift-n" : "connection-manager:new-connection"
}
This specifies that in the mongotron-workspace
context, when the keys cmd-shift-n
are pressed open the connection manager to the new connection screen.
Events handlers can be register by calling the keypressService.registerCommandHandler()
method.
keypressService.registerCommandHandler("connection-manager:new-connection", function() {
navUtils.showConnections();
});
Keypress events can also be global, in which case their handlers will always called. Use the namespace ‘global’ to register an event in the global namespace.
Ex.
keypressService.registerCommandHandler("global:new-connection", function() {
navUtils.showConnections();
});