What is the syntax of keybinds.settings?

What is the syntax of keybinds.settings settings? I am a vim user and I will eventually like:

  • bind shift-j to go down 8 lines (nnoremap J 8j)
  • same with k (nnoremak J 8k)
  • Use as a "leader", i.e. I would like to bind ", b" to "build" and possibly "g" to run "ghci file-name" in the terminal.
+4
source share
1 answer

The keybinding.settings file works only for cloud9 commands, you will need to use an init script to configure vim commands (see Open Your Init Script itemc Cloud9)

You can use the 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");
});

, ,g ghci runner, . https://docs.c9.io/custom_runners.html .

+4

All Articles