summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/keymap
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-04-20 18:11:40 +0800
committerCheng-Han, Wu2016-04-20 18:11:40 +0800
commit8bf516263c6582771e7576e8484ca8cfaa8cb9cb (patch)
treeaba81172f554a50466a762db99f25e3650d7ff45 /public/vendor/codemirror/keymap
parentedc3a31dfdb03e910d7355144280e281eeb582d5 (diff)
Update CodeMirror to 5.13.5
Diffstat (limited to 'public/vendor/codemirror/keymap')
-rw-r--r--public/vendor/codemirror/keymap/sublime.js4
-rw-r--r--public/vendor/codemirror/keymap/vim.js53
2 files changed, 35 insertions, 22 deletions
diff --git a/public/vendor/codemirror/keymap/sublime.js b/public/vendor/codemirror/keymap/sublime.js
index e0d0e92b..3cf67413 100644
--- a/public/vendor/codemirror/keymap/sublime.js
+++ b/public/vendor/codemirror/keymap/sublime.js
@@ -55,6 +55,8 @@
cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); };
cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); };
+ if (mac) map["Cmd-Left"] = "goLineStartSmart";
+
var scrollLineCombo = mac ? "Ctrl-Alt-" : "Ctrl-";
cmds[map[scrollLineCombo + "Up"] = "scrollLineUp"] = function(cm) {
@@ -105,7 +107,7 @@
cm.setSelections(extended);
};
- map["Shift-" + ctrl + "K"] = "deleteLine";
+ map["Shift-Ctrl-K"] = "deleteLine";
function insertLine(cm, above) {
if (cm.isReadOnly()) return CodeMirror.Pass
diff --git a/public/vendor/codemirror/keymap/vim.js b/public/vendor/codemirror/keymap/vim.js
index 0548b75b..b2bee5a1 100644
--- a/public/vendor/codemirror/keymap/vim.js
+++ b/public/vendor/codemirror/keymap/vim.js
@@ -26,7 +26,7 @@
* 2. Variable declarations and short basic helpers
* 3. Instance (External API) implementation
* 4. Internal state tracking objects (input state, counter) implementation
- * and instanstiation
+ * and instantiation
* 5. Key handler (the main command dispatcher) implementation
* 6. Motion, operator, and action implementations
* 7. Helper functions for the key handler, motions, operators, and actions
@@ -64,9 +64,9 @@
{ keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
{ keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
{ keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },
- { keys: 's', type: 'keyToKey', toKeys: 'xi', context: 'visual'},
+ { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},
{ keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },
- { keys: 'S', type: 'keyToKey', toKeys: 'dcc', context: 'visual' },
+ { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },
{ keys: '<Home>', type: 'keyToKey', toKeys: '0' },
{ keys: '<End>', type: 'keyToKey', toKeys: '$' },
{ keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },
@@ -164,6 +164,7 @@
{ keys: 'v', type: 'action', action: 'toggleVisualMode' },
{ keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }},
{ keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
+ { keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
{ keys: 'gv', type: 'action', action: 'reselectLastSelection' },
{ keys: 'J', type: 'action', action: 'joinLines', isEdit: true },
{ keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},
@@ -225,6 +226,7 @@
{ name: 'sort', shortName: 'sor' },
{ name: 'substitute', shortName: 's', possiblyAsync: true },
{ name: 'nohlsearch', shortName: 'noh' },
+ { name: 'yank', shortName: 'y' },
{ name: 'delmarks', shortName: 'delm' },
{ name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },
{ name: 'global', shortName: 'g' }
@@ -640,7 +642,7 @@
jumpList: createCircularJumpList(),
macroModeState: new MacroModeState,
// Recording latest f, t, F or T motion command.
- lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''},
+ lastCharacterSearch: {increment:0, forward:true, selectedCharacter:''},
registerController: new RegisterController({}),
// search history buffer
searchHistoryController: new HistoryController({}),
@@ -681,6 +683,9 @@
// Add user defined key bindings.
exCommandDispatcher.map(lhs, rhs, ctx);
},
+ unmap: function(lhs, ctx) {
+ exCommandDispatcher.unmap(lhs, ctx);
+ },
// TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
// them, or somehow make them work with the existing CodeMirror setOption/getOption API.
setOption: setOption,
@@ -1043,7 +1048,7 @@
};
function HistoryController() {
this.historyBuffer = [];
- this.iterator;
+ this.iterator = 0;
this.initialPrefix = null;
}
HistoryController.prototype = {
@@ -1368,7 +1373,7 @@
}
},
evalInput: function(cm, vim) {
- // If the motion comand is set, execute both the operator and motion.
+ // If the motion command is set, execute both the operator and motion.
// Otherwise return.
var inputState = vim.inputState;
var motion = inputState.motion;
@@ -1692,11 +1697,12 @@
var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;
var first = cm.firstLine();
var last = cm.lastLine();
- // Vim cancels linewise motions that start on an edge and move beyond
- // that edge. It does not cancel motions that do not start on an edge.
- if ((line < first && cur.line == first) ||
- (line > last && cur.line == last)) {
- return;
+ // Vim go to line begin or line end when cursor at first/last line and
+ // move to previous/next line is triggered.
+ if (line < first && cur.line == first){
+ return this.moveToStartOfLine(cm, head, motionArgs, vim);
+ }else if (line > last && cur.line == last){
+ return this.moveToEol(cm, head, motionArgs, vim);
}
if (motionArgs.toFirstChar){
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
@@ -1904,7 +1910,7 @@
},
repeatLastCharacterSearch: function(cm, head, motionArgs) {
- var lastSearch = vimGlobalState.lastChararacterSearch;
+ var lastSearch = vimGlobalState.lastCharacterSearch;
var repeat = motionArgs.repeat;
var forward = motionArgs.forward === lastSearch.forward;
var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);
@@ -2997,7 +3003,7 @@
// Only clip if the selection ends with trailing newline + whitespace
if (/\n\s*$/.test(selection)) {
var lines = selection.split('\n');
- // We know this is all whitepsace.
+ // We know this is all whitespace.
lines.pop();
// Cases:
@@ -3083,9 +3089,9 @@
}
function recordLastCharacterSearch(increment, args) {
- vimGlobalState.lastChararacterSearch.increment = increment;
- vimGlobalState.lastChararacterSearch.forward = args.forward;
- vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter;
+ vimGlobalState.lastCharacterSearch.increment = increment;
+ vimGlobalState.lastCharacterSearch.forward = args.forward;
+ vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;
}
var symbolToMode = {
@@ -3284,8 +3290,6 @@
line = cm.getLine(lineNum);
pos = (dir > 0) ? 0 : line.length;
}
- // Should never get here.
- throw new Error('The impossible happened.');
}
/**
@@ -3447,7 +3451,7 @@
}
// TODO: perhaps this finagling of start and end positions belonds
- // in codmirror/replaceRange?
+ // in codemirror/replaceRange?
function selectCompanionObject(cm, head, symb, inclusive) {
var cur = head, start, end;
@@ -4509,14 +4513,21 @@
if (CodeMirror.commands.save) {
// If a save command is defined, call it.
CodeMirror.commands.save(cm);
- } else {
- // Saves to text area if no save command is defined.
+ } else if (cm.save) {
+ // Saves to text area if no save command is defined and cm.save() is available.
cm.save();
}
},
nohlsearch: function(cm) {
clearSearchHighlight(cm);
},
+ yank: function (cm) {
+ var cur = copyCursor(cm.getCursor());
+ var line = cur.line;
+ var lineText = cm.getLine(line);
+ vimGlobalState.registerController.pushText(
+ '0', 'yank', lineText, true, true);
+ },
delmarks: function(cm, params) {
if (!params.argString || !trim(params.argString)) {
showConfirm(cm, 'Argument required');