Skip to content

Commit a1d9b3d

Browse files
authored
fix mapping in insert mode (#206)
1 parent 9d52bce commit a1d9b3d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/vim.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,9 @@ export function initVim(CodeMirror) {
920920
}
921921
return !keysAreChars;
922922
}
923+
else if (match.type == 'full') {
924+
vim.inputState.keyBuffer.length = 0;
925+
}
923926
vim.expectLiteralNext = false;
924927

925928
if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }

test/vim_test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5136,6 +5136,12 @@ testVim('ex_imap', function(cm, vim, helpers) {
51365136
eq('xox4\nfox8\nfoodxfg', cm.getValue());
51375137
eq(3, cm.listSelections().length);
51385138
}
5139+
5140+
cm.setValue('1\n2')
5141+
helpers.doKeys('gg', 'dd');
5142+
helpers.doEx('imap a <C-c>');
5143+
helpers.doKeys('i', 'x', 'a', 'p');
5144+
eq('x2\n1', cm.getValue());
51395145
}, { value: '1234\n5678\nabcdefg' });
51405146
testVim('ex_unmap_api', function(cm, vim, helpers) {
51415147
CodeMirror.Vim.map('<Alt-X>', 'gg', 'normal');

0 commit comments

Comments
 (0)