本文介绍了keybinds.settings的语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

keybinds.settings的语法是什么?我是vim用户,我最终希望:

What is the syntax of the keybinds.settings? I am a vim user, and I would ultimately like to:

  • 将shift-j绑定到8行(nnoremap J 8j)
  • 与k相同(nnoremak J 8k)
  • 使用,作为领导者",即我想将,b"绑定到"build",或者也许将,g"绑定到终端中的"ghci文件名".

推荐答案

keybinding.settings文件目前仅适用于cloud9命令,要自定义vim命令,您将必须使用初始化脚本(请参见Cloud9菜单中的Open Your Init Script item )

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)

您可以使用以下代码段

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运行器,请参见 https://docs.c9. io/custom_runners.html 了解详情.

note that for ,g you need to create ghci runner, see https://docs.c9.io/custom_runners.html for details.

这篇关于keybinds.settings的语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 17:09