1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-18 01:31:44 +02:00

Compare commits

...

15 Commits

Author SHA1 Message Date
Alex Plate
a4be636f9d Run manual tests 2019-11-20 11:47:38 +03:00
Alex Plate
a2bae6795f Prepare to the release 0.54 2019-11-20 11:41:05 +03:00
Alex Plate
8e12c9bef0 Fix backward motion for ex commands 2019-11-19 14:31:30 +03:00
Alex Plate
88926c3eef Update CHANGES.md 2019-11-18 17:51:46 +03:00
Alex Plate
8dd774446b Update license information 2019-11-18 11:55:34 +03:00
Alex Plate
46cf112378 Revert user statistic 2019-11-14 13:12:50 +03:00
Alex Plate
5d2520d057 Revert compile dependencies 2019-11-14 13:10:12 +03:00
Alex Plate
a6ea89162a Change collector option 2019-11-08 14:50:02 +03:00
Alex Plate
1039cf661d Fix capability with 183 2019-11-08 14:41:18 +03:00
Alex Plate
eaf9f0bbfa Fix compatibility with older IDEA versions 2019-11-07 18:24:34 +03:00
Alex Plate
9e036176ef Update CHANGES 2019-11-07 16:40:55 +03:00
Alex Plate
31e1edcc72 Add userstatistic info 2019-11-07 16:26:22 +03:00
Alex Plate
7d9d8d4a02 Fix execution of actions in visual mode with incsearch enabled 2019-11-07 11:14:16 +03:00
Alex Plate
71cb43e751 Remove garbage 2019-11-05 17:40:15 +03:00
Alex Plate
f27e00500e Do not add kotlin stdlib to resulting jar 2019-11-05 17:35:10 +03:00
10 changed files with 165 additions and 62 deletions

View File

@@ -8,21 +8,27 @@ Get an Early Access
-------------------
Would you like to try new features and fixes? Join the Early Access Program and
receive EAP builds as updates! Add this URL to "Settings | Plugins |
Browse Repositories | Manage Repositories":
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim)
receive EAP builds as updates! Use the `Join EAP` option in the status bar or
add this URL to "Settings | Plugins | Manage Plugin Repositories":
`https://plugins.jetbrains.com/plugins/eap/ideavim`
It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
To Be Released
0.54, 2019-11-20
--------------
_Available since 0.53.1 EAP:_
**Features:**
* EasyMotion plugin emulation ([VIM-820](https://youtrack.jetbrains.com/issue/VIM-820) | [Instructions](https://github.com/JetBrains/ideavim#emulated-vim-plugins))
* Support surrounding with a function name ([link](https://github.com/tpope/vim-surround/blob/master/doc/surround.txt#L138))
* [VIM-1720](https://youtrack.jetbrains.com/issue/VIM-1720) Add `:delmarks` command
* Add `:delmarks` command ([VIM-1720](https://youtrack.jetbrains.com/issue/VIM-1720))
* Add IdeaVim icon to the status bar ([VIM-943](https://youtrack.jetbrains.com/issue/VIM-943))
**Changes:**
* Remove the default IdeaVim toggle shortcut (<kbd>CTRL</kbd><kbd>ALT</kbd><kbd>V</kbd>)
* Rename `refactoring` value of `selectmode` option to `ideaselection`
* Remove `template` value of `selectmode` option and replace it with `idearefactormode` option.
**Fixes:**
* [VIM-1766](https://youtrack.jetbrains.com/issue/VIM-1766) Fix disappearing caret in ex entry on Linux
@@ -40,19 +46,9 @@ _Available since 0.53.1 EAP:_
* [VIM-1772](https://youtrack.jetbrains.com/issue/VIM-1772) Fix yanking with `:y` command
* [VIM-1685](https://youtrack.jetbrains.com/issue/VIM-1685) Fix `ESC` for insert mode
* [VIM-1752](https://youtrack.jetbrains.com/issue/VIM-1752) Fix `ESC` for insert mode
_Available since 0.53.2 EAP:_
**Features:**
* Add IdeaVim icon to the status bar ([VIM-943](https://youtrack.jetbrains.com/issue/VIM-943))
* EasyMotion plugin emulation ([VIM-820](https://youtrack.jetbrains.com/issue/VIM-820))
**Changes:**
* Remove the default IdeaVim toggle shortcut (<kbd>CTRL</kbd><kbd>ALT</kbd><kbd>V</kbd>)
* Rename `refactoring` value of `selectmode` option to `ideaselection`
* Remove `template` value of `selectmode` option and replace it with `idearefactormode` option.
**Fixes:**
* [VIM-1189](https://youtrack.jetbrains.com/issue/VIM-1189)
[VIM-927](https://youtrack.jetbrains.com/issue/VIM-927)
Fix mappings to black hole register
* [VIM-1804](https://youtrack.jetbrains.com/issue/VIM-1804) Exit insert move after toggling IdeaVim
* [VIM-1749](https://youtrack.jetbrains.com/issue/VIM-1749) Tag surround is finished on `>`
* [VIM-1801](https://youtrack.jetbrains.com/issue/VIM-1801) Fix j/k motions with inline hints
@@ -60,6 +56,7 @@ _Available since 0.53.2 EAP:_
* [VIM-1819](https://youtrack.jetbrains.com/issue/VIM-1819) Fix execution of some rider actions
* [VIM-1604](https://youtrack.jetbrains.com/issue/VIM-1604) Add IdeaVim logo
0.53, 2019-08-07
--------------
* [VIM-1711](https://youtrack.jetbrains.com/issue/VIM-1711) Search is not triggered during surround action

View File

@@ -49,6 +49,10 @@ Get Early Access
Would you like to try new features and fixes? Join the Early Access Program and
receive EAP builds as updates!
1. Click the IdeaVim icon in the status bar | `EAP` | `Join EAP`
Or subscribe to EAP updates manually:
1. Open `Settings | Plugins`
2. Click the gear icon :gear:, select `Manage Plugin Repositories`, and add the following url:
`https://plugins.jetbrains.com/plugins/eap/ideavim`
@@ -128,24 +132,32 @@ Emulated Vim Plugins
--------------------
IdeaVim extensions emulate some plugins of the original Vim. In order to use
IdeaVim extensions, you have to enable them via this command in your ~/.ideavimrc:
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
set <extension-name>
Available extensions:
* easymotion
* Setup:
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
* `set easymotion`
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
* surround
* `set surround`
* Setup: `set surround`
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
* Commands: `ys`, `cs`, `ds`, `S`
* multiple-cursors
* `set multiple-cursors`
* Setup: `set multiple-cursors`
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
* commentary
* `set commentary`
* Setup: `set commentary`
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
* Commands: `gcc`, `gc + motion`, `v_gc`
@@ -201,4 +213,5 @@ for a list of authors and contributors.
License
-------
IdeaVim is licensed under the terms of the GNU Public License version 2.
IdeaVim is licensed under the terms of the GNU Public License version 2
or any later version.

View File

@@ -19,7 +19,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
If true, creation of global mark will trigger creation of IDE's bookmark
and vice versa.
`idearefactormode` `idearefactormode` String(default "select") - IdeaVim ONLY [To Be Released]
`idearefactormode` `idearefactormode` String(default "select") - IdeaVim ONLY
Define the mode that would be enabled during
the refactoring (renaming, live template, introduce variable, etc)
@@ -80,10 +80,10 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
mouse when using the mouse
key when using shifted special[1] keys
cmd when using "v", "V", or <C-V>
ideaselection when IDE sets a selection - IdeaVim ONLY [To Be Released]
ideaselection when IDE sets a selection - IdeaVim ONLY
(examples: extend selection, wrap with while, etc.)
Deprecated values: [To Be Released]
Deprecated values:
template ~~please use `idearefactormode` option~~
when starting a template - IdeaVim ONLY
refactoring ~~please use ideaselection~~

View File

@@ -3,9 +3,9 @@
<id>IdeaVIM</id>
<change-notes><![CDATA[
<ul>
<li>EasyMotion plugin emulation</li>
<li>EasyMotion plugin emulation (<a href="https://github.com/JetBrains/ideavim#emulated-vim-plugins">link</a>)</li>
<li>Support surrounding with a function name</li>
<li>Add IdeaVim logo to status bar</li>
<li>Add IdeaVim logo to the status bar</li>
<li>Various bug fixes</li>
</ul>
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>

View File

@@ -421,9 +421,12 @@ public class KeyHandler {
commandState.popState();
}
else if (startOffset != null && startOffset != caret.getOffset()) {
// Command line motions are always characterwise exclusive
int endOffset = caret.getOffset();
if (startOffset < endOffset) {
endOffset -= 1;
} else {
startOffset -= 1;
}
final VimSelection vimSelection = VimSelection.Companion
.create(startOffset, endOffset, SelectionType.CHARACTER_WISE, editor);

View File

@@ -52,20 +52,4 @@ object DocumentManager {
EventFacade.getInstance().removeDocumentListener(doc, docListener)
}
}
fun xyz() {
abc(true)
abd(true)
}
fun abc(xx: Boolean) {}
fun abd(xx: Boolean) {}
}
fun xyz() {
abc(true)
abd(true)
}
fun abc(xx: Boolean) {}
fun abd(xx: Boolean) {}

View File

@@ -23,7 +23,9 @@ import com.intellij.ide.ui.LafManagerListener;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollingModel;
import com.intellij.ui.DocumentAdapter;
import com.intellij.util.IJSwingUtilities;
import com.maddyhome.idea.vim.VimPlugin;
@@ -221,8 +223,15 @@ public class ExEntryPanel extends JPanel implements LafManagerListener {
private void resetCaretOffset(@NotNull Editor editor) {
// Reset the original caret, with original scroll offsets
MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), caretOffset);
editor.getScrollingModel().scroll(horizontalOffset, verticalOffset);
final Caret primaryCaret = editor.getCaretModel().getPrimaryCaret();
if (primaryCaret.getOffset() != caretOffset) {
MotionGroup.moveCaret(editor, primaryCaret, caretOffset);
}
final ScrollingModel scrollingModel = editor.getScrollingModel();
if (scrollingModel.getHorizontalScrollOffset() != horizontalOffset ||
scrollingModel.getVerticalScrollOffset() != verticalOffset) {
scrollingModel.scroll(horizontalOffset, verticalOffset);
}
}
@NotNull private final DocumentListener incSearchDocumentListener = new DocumentAdapter() {

View File

@@ -1,6 +1,6 @@
# Manual Tests
## #1 [Last run: 31-10-2019]
## #1 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -14,7 +14,7 @@ Word is selected, block-caret is placed on the word end (offset = `word end - 1`
![](resources/manualTests/1.png)
## #2 [Last run: 31-10-2019]
## #2 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -26,7 +26,7 @@ Last word is selected, block caret is placed on the word end without bouncing
![](resources/manualTests/2.png)
## #3 [Last run: 31-10-2019]
## #3 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -38,7 +38,7 @@ Line is selected. Caret is placed on the line end
![](resources/manualTests/3.png)
## #4 [Last run: 31-10-2019]
## #4 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -51,7 +51,7 @@ After mouse release, caret moves one character back and becomes block shape
![](resources/manualTests/4.gif)
## #5 [Last run: 31-10-2019]
## #5 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -65,7 +65,7 @@ After mouse release, caret moves one character back and becomes block shape
![](resources/manualTests/5.gif)
## #6 [Last run: 31-10-2019]
## #6 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -77,7 +77,7 @@ Line is selected, caret is on the first position
![](resources/manualTests/6.gif)
## #6 [Last run: 31-10-2019]
## #6 [Last run: 20-11-2019]
_Initial mode:_ NORMAL
@@ -94,7 +94,7 @@ Caret stays in _block_ shape with a normal mode
![](resources/manualTests/7.2.gif)
## #7 [Last run: 31-10-2019]
## #7 [Last run: 20-11-2019]
_Action:_
Turn emulation off and on
@@ -102,7 +102,7 @@ Turn emulation off and on
_Result:_
Vim emulator works as expected
## #8 [Last run: 31-10-2019]
## #8 [Last run: 20-11-2019]
_Action:_
Start up IJ with disabled emulator, turn it on
@@ -110,7 +110,7 @@ Start up IJ with disabled emulator, turn it on
_Result:_
Vim emulator works as expected
## #9 [Last run: 05-11-2019]
## #9 [Last run: 20-11-2019]
_Action:_
Wrap with if

View File

@@ -2,6 +2,7 @@ package org.jetbrains.plugins.ideavim.ex.handler
import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.option.OptionsManager
import org.jetbrains.plugins.ideavim.VimTestCase
/**
@@ -32,6 +33,23 @@ class ActionHandlerTest : VimTestCase() {
"-----")
}
// https://github.com/JetBrains/ideavim/commit/fe714a90032d0cb5ef0a0e0d8783980b6f1c7d20#r35647600
fun testExCommandInVisualCharacterModeWithIncSearch() {
OptionsManager.incsearch.set()
configureByJavaText("-----\n" +
"1<caret>2345\n" +
"abcde\n" +
"-----")
typeText(parseKeys("vjl"))
typeText(commandToKeys("'<,'>action CommentByBlockComment"))
assertMode(CommandState.Mode.VISUAL)
myFixture.checkResult("-----\n" +
"1/*2345\n" +
"abc*/de\n" +
"-----")
OptionsManager.incsearch.reset()
}
// VIM-862 |:action|
fun testExCommandInVisualCharacterModeSameLine() {
configureByJavaText("1<caret>2345\n" + "abcde\n")
@@ -41,6 +59,16 @@ class ActionHandlerTest : VimTestCase() {
myFixture.checkResult("1/*23*/45\n" + "abcde\n")
}
fun testExCommandInVisualCharacterModeSameLineWithIncsearch() {
OptionsManager.incsearch.set()
configureByJavaText("1<caret>2345\n" + "abcde\n")
typeText(parseKeys("vl"))
typeText(commandToKeys("'<,'>action CommentByBlockComment"))
assertMode(CommandState.Mode.VISUAL)
myFixture.checkResult("1/*23*/45\n" + "abcde\n")
OptionsManager.incsearch.reset()
}
// VIM-862 |:action| in visual line mode
fun testExCommandInVisualLineMode() {
configureByJavaText("-----\n" +
@@ -58,6 +86,24 @@ class ActionHandlerTest : VimTestCase() {
"-----")
}
fun testExCommandInVisualLineModeWithIncsearch() {
OptionsManager.incsearch.set()
configureByJavaText("-----\n" +
"1<caret>2345\n" +
"abcde\n" +
"-----")
typeText(parseKeys("Vj"))
typeText(commandToKeys("'<,'>action CommentByBlockComment"))
assertMode(CommandState.Mode.VISUAL)
myFixture.checkResult("-----\n" +
"/*\n" +
"12345\n" +
"abcde\n" +
"*/\n" +
"-----")
OptionsManager.incsearch.reset()
}
// VIM-862 |:action| in visual block mode
fun testExCommandInVisualBlockMode() {
configureByJavaText("-----\n" +
@@ -72,4 +118,20 @@ class ActionHandlerTest : VimTestCase() {
"a/*bc*/de\n" +
"-----")
}
}
fun testExCommandInVisualBlockModeWithIncsearch() {
OptionsManager.incsearch.set()
configureByJavaText("-----\n" +
"1<caret>2345\n" +
"abcde\n" +
"-----")
typeText(parseKeys("<C-V>lj"))
typeText(commandToKeys("'<,'>action CommentByBlockComment"))
assertMode(CommandState.Mode.VISUAL)
myFixture.checkResult("-----\n" +
"1/*23*/45\n" +
"a/*bc*/de\n" +
"-----")
OptionsManager.incsearch.reset()
}
}

View File

@@ -2,9 +2,7 @@ package org.jetbrains.plugins.ideavim.extension
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.LogicalPosition
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.motion.updown.MotionDownAction
import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
@@ -12,8 +10,9 @@ import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
import com.maddyhome.idea.vim.extension.VimExtensionHandler
import com.maddyhome.idea.vim.extension.VimNonDisposableExtension
import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.group.visual.vimSetSelection
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.isEndAllowed
import com.maddyhome.idea.vim.helper.mode
import org.jetbrains.plugins.ideavim.VimTestCase
class OpMappingTest : VimTestCase() {
@@ -35,6 +34,22 @@ class OpMappingTest : VimTestCase() {
CommandState.SubMode.NONE)
}
fun `test simple delete backwards`() {
doTest(parseKeys("dP"),
"I found ${c}it in a legendary land",
"I f${c}it in a legendary land",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test delete emulate inclusive`() {
doTest(parseKeys("dU"),
"${c}I found it in a legendary land",
"${c}d it in a legendary land",
CommandState.Mode.COMMAND,
CommandState.SubMode.NONE)
}
fun `test linewise delete`() {
doTest(parseKeys("dO"),
"""
@@ -60,13 +75,32 @@ class TestExtension : VimNonDisposableExtension() {
override fun getName(): String = "TestExtension"
override fun initOnce() {
putExtensionHandlerMapping(MappingMode.O, parseKeys("<Plug>TestExtensionEmulateInclusive"), MoveEmulateInclusive(), false)
putExtensionHandlerMapping(MappingMode.O, parseKeys("<Plug>TestExtensionBackwardsCharacter"), MoveBackwards(), false)
putExtensionHandlerMapping(MappingMode.O, parseKeys("<Plug>TestExtensionCharacter"), Move(), false)
putExtensionHandlerMapping(MappingMode.O, parseKeys("<Plug>TestExtensionLinewise"), MoveLinewise(), false)
putKeyMapping(MappingMode.O, parseKeys("U"), parseKeys("<Plug>TestExtensionEmulateInclusive"), true)
putKeyMapping(MappingMode.O, parseKeys("P"), parseKeys("<Plug>TestExtensionBackwardsCharacter"), true)
putKeyMapping(MappingMode.O, parseKeys("I"), parseKeys("<Plug>TestExtensionCharacter"), true)
putKeyMapping(MappingMode.O, parseKeys("O"), parseKeys("<Plug>TestExtensionLinewise"), true)
}
private class MoveEmulateInclusive : VimExtensionHandler {
override fun execute(editor: Editor, context: DataContext) {
VimPlugin.getVisualMotion().enterVisualMode(editor, CommandState.SubMode.VISUAL_CHARACTER)
val caret = editor.caretModel.currentCaret
val newOffset = VimPlugin.getMotion().moveCaretHorizontal(editor, caret, 5, editor.mode.isEndAllowed)
MotionGroup.moveCaret(editor, caret, newOffset)
}
}
private class MoveBackwards : VimExtensionHandler {
override fun execute(editor: Editor, context: DataContext) {
editor.caretModel.allCarets.forEach { it.moveToOffset(it.offset - 5) }
}
}
private class Move : VimExtensionHandler {
override fun execute(editor: Editor, context: DataContext) {
editor.caretModel.allCarets.forEach { it.moveToOffset(it.offset + 5) }
@@ -78,6 +112,7 @@ class TestExtension : VimNonDisposableExtension() {
VimPlugin.getVisualMotion().enterVisualMode(editor, CommandState.SubMode.VISUAL_LINE)
val caret = editor.caretModel.currentCaret
val newOffset = VimPlugin.getMotion().moveCaretVertical(editor, caret, 1)
MotionGroup.moveCaret(editor, caret, newOffset) }
MotionGroup.moveCaret(editor, caret, newOffset)
}
}
}