in src/keybinding-vim.js [6067:6134]
handleKeyboard: function(data, hashId, key, keyCode, e) {
var editor = data.editor;
var cm = editor.state.cm;
var vim = getVim(cm);
if (keyCode == -1) return;
if (!vim.insertMode) {
if (hashId == -1) {
if (key.charCodeAt(0) > 0xFF) {
if (data.inputKey) {
key = data.inputKey;
if (key && data.inputHash == 4)
key = key.toUpperCase();
}
}
data.inputChar = key;
}
else if (hashId == 4 || hashId == 0) {
if (data.inputKey == key && data.inputHash == hashId && data.inputChar) {
key = data.inputChar;
hashId = -1
}
else {
data.inputChar = null;
data.inputKey = key;
data.inputHash = hashId;
}
}
else {
data.inputChar = data.inputKey = null;
}
}
if (cm.state.overwrite && vim.insertMode && key == "backspace" && hashId == 0) {
return {command: "gotoleft"}
}
if (key == "c" && hashId == 1) { // key == "ctrl-c"
if (!useragent.isMac && editor.getCopyText()) {
editor.once("copy", function() {
if (vim.insertMode) editor.selection.clearSelection();
else cm.operation(function() { exitVisualMode(cm); });
});
return {command: "null", passEvent: true};
}
}
if (key == "esc" && !vim.insertMode && !vim.visualMode && !cm.ace.inMultiSelectMode) {
var searchState = getSearchState(cm);
var overlay = searchState.getOverlay();
if (overlay) cm.removeOverlay(overlay);
}
if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) {
var insertMode = vim.insertMode;
var name = lookupKey(hashId, key, e || {});
if (vim.status == null)
vim.status = "";
var isHandled = multiSelectHandleKey(cm, name, 'user');
vim = getVim(cm); // may be changed by multiSelectHandleKey
if (isHandled && vim.status != null)
vim.status += name;
else if (vim.status == null)
vim.status = "";
cm._signal("changeStatus");
if (!isHandled && (hashId != -1 || insertMode))
return;
return {command: "null", passEvent: !isHandled};
}
},