diff --git a/index.txt b/index.txt index f280d9be5..af7097062 100644 --- a/index.txt +++ b/index.txt @@ -65,6 +65,8 @@ tag char note action in Normal mode ~ |count| 9 " |F| F{char} 1 cursor to the Nth occurrence of {char} to the left +|O| O 2 begin a new line above the cursor and + insert text, repeat N times |P| ["x]P 2 put the text [from buffer x] before the cursor N times |T| T{char} 1 cursor till after Nth occurrence of {char} diff --git a/src/com/maddyhome/idea/vim/group/ChangeGroup.java b/src/com/maddyhome/idea/vim/group/ChangeGroup.java index cbc790196..83424159d 100644 --- a/src/com/maddyhome/idea/vim/group/ChangeGroup.java +++ b/src/com/maddyhome/idea/vim/group/ChangeGroup.java @@ -171,9 +171,7 @@ public class ChangeGroup extends AbstractActionGroup { if (state.getMode() != CommandState.Mode.REPEAT) { KeyHandler.executeAction("VimEditorEnter", context); } - else { - MotionGroup.moveCaret(editor, CommandGroups.getInstance().getMotion().moveCaretVertical(editor, -1)); - } + MotionGroup.moveCaret(editor, CommandGroups.getInstance().getMotion().moveCaretVertical(editor, -1)); } } else { diff --git a/test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java b/test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java index c38e374c3..46856cdbf 100644 --- a/test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java +++ b/test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java @@ -240,6 +240,13 @@ public class ChangeActionTest extends VimTestCase { "fo<caret>\n"); } + // VIM-404 |O| + public void testInsertNewLineAboveFirstLine() { + doTest(stringToKeys("Obar"), + "fo<caret>o\n", + "bar\nfoo\n"); + } + private void doTest(final List<KeyStroke> keys, String before, String after) { myFixture.configureByText("a.java", before); final Editor editor = myFixture.getEditor();