keybinds.settings的语法是什么?我是vim用户,我最终会喜欢:
答案 0 :(得分:4)
keybinding.settings文件目前仅适用于cloud9命令,要自定义vim命令,必须使用init脚本(参见Open Your Init Script item
菜单中的Cloud9
)
您可以使用以下代码段
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。