дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
An Insert-mode mapping such as `inoremap . .<C-g>u` typed the literal text ".<C-g>u": codemirror-vim has no <C-g>u command and writes unknown <...> keys of a mapping's right-hand side into the document. inoremap only searches the engine's built-in keymap, so the key is added there through a patch to @replit/codemirror-vim-core, bound to an action that isolates the next history event so the text after it starts a new undo group. Covered by a Vim engine unit test and e2e/vimUndoBreak.spec.ts. Co-authored-by: angelf015 <[email protected]>
22 рядки
1.2 KiB
Diff
22 рядки
1.2 KiB
Diff
diff --git a/vim.js b/vim.js
|
|
--- a/vim.js
|
|
+++ b/vim.js
|
|
@@ -236,6 +236,8 @@ export function initVim(CM) {
|
|
{ keys: '"<register>', type: 'action', action: 'setRegister' },
|
|
{ keys: '<C-r><register>', type: 'action', action: 'insertRegister', context: 'insert', isEdit: true },
|
|
{ keys: '<C-o>', type: 'action', action: 'oneNormalCommand', context: 'insert' },
|
|
+ // OpenIDEA: insert-mode undo break; the host defines this action.
|
|
+ { keys: '<C-g>u', type: 'action', action: 'openideaUndoBreak', context: 'insert' },
|
|
{ keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }},
|
|
{ keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
|
|
{ keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }},
|
|
@@ -3423,6 +3425,8 @@ export function initVim(CM) {
|
|
cm.replaceSelection(text);
|
|
}
|
|
},
|
|
+ // OpenIDEA: the host overrides this with the undo-break implementation.
|
|
+ openideaUndoBreak: function() {},
|
|
oneNormalCommand: function(cm, actionArgs, vim) {
|
|
exitInsertMode(cm, true);
|
|
vim.insertModeReturn = true;
|