Reputation: 187
What is the syntax of the keybinds.settings? I am a vim user, and I would ultimately like to:
Upvotes: 4
Views: 337
Reputation: 24119
keybinding.settings file works only for cloud9 commands for now, for customizing vim commands you will have to use init script (see Open Your Init Script item
in Cloud9
menu)
You can use following snippet
require(["plugins/c9.ide.ace.keymaps/vim/keymap"], function(vim) {
var defaultKeymap = vim.aceKeyboardHandler.defaultKeymap;
function ideCommand() { services.commands.exec(this.name); }
function map(keys, action, context) {
var mapping;
if (!action) {
return defaultKeymap.forEach(function(x) {
if (x.keys == keys) {
x.defaultKeys = keys;
x.keys = "";
}
});
} else if (/^c9:/.test(action)) {
var commandName = action.substr(3);
mapping = {
keys: keys, type: "action", action: "aceCommand",
actionArgs: { exec: ideCommand, name: commandName }
};
} else {
mapping = { keys: keys, type: "keyToKey", toKeys: action };
}
if (context)
mapping.context = context;
mapping.user = true;
defaultKeymap.unshift(mapping);
}
map("J", "8j", "normal");
map("K", "8k", "normal");
map(",", ""); // remove default mapping of ,
map(",b", "c9:build", "normal");
map(",g", "c9:run", "normal");
});
note that for ,g
you need to create ghci runner, see https://docs.c9.io/custom_runners.html for details.
Upvotes: 4