2014-12-06 191 views
4

keybinds.settings的語法是什麼?我是VIM用戶,我將最終想:keybinds.settings的語法是什麼?

  • 綁定移-J下井8行(nnoremapĴ8J)
  • 其中k是相同的(nnoremakĴ8K)
  • 用途,作爲「領導者」,即我想綁定「,b」到「構建」,也許「g」在終端中運行「ghci文件名」。

回答

4

keybinding.settings文件僅適用於CLOUD9現在命令,用於定製Vim命令,你將不得不使用的init腳本(見Open Your Init Script itemCloud9菜單)

您可以使用下面的代碼片段

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

+0

這真的很酷!非常感謝! – 2014-12-06 18:48:01