diff --git a/vim.js b/vim.js --- a/vim.js +++ b/vim.js @@ -236,6 +236,8 @@ { keys: '"', type: 'action', action: 'setRegister' }, { keys: '', type: 'action', action: 'insertRegister', context: 'insert', isEdit: true }, { keys: '', type: 'action', action: 'oneNormalCommand', context: 'insert' }, + // OpenIDEA: insert-mode undo break; the host defines this action. + { keys: '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' }}, @@ -248,6 +250,11 @@ { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' }, { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' }, // Text object motions + // OpenIDEA: function text objects; the host defines the motion. Built in, so a noremap's keys reach them. + { keys: 'af', type: 'motion', motion: 'openideaFunction', context: 'operatorPending' }, + { keys: 'if', type: 'motion', motion: 'openideaFunction', motionArgs: { textObjectInner: true }, context: 'operatorPending' }, + { keys: 'af', type: 'motion', motion: 'openideaFunction', context: 'visual' }, + { keys: 'if', type: 'motion', motion: 'openideaFunction', motionArgs: { textObjectInner: true }, context: 'visual' }, { keys: 'a', type: 'motion', motion: 'textObjectManipulation' }, { keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }}, // Search @@ -2582,6 +2589,8 @@ if (head.sticky == "before") head.ch--; return head; }, + // OpenIDEA: the host overrides this with the function text object. + openideaFunction: function(cm, head) { return head; }, textObjectManipulation: function(cm, head, motionArgs, vim) { // TODO: lots of possible exceptions that can be thrown here. Try da( // outside of a () block. @@ -3423,6 +3432,8 @@ 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;