1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-17 16:31:45 +02:00

Compare commits

...

138 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
Alex Plate
617c0e3813 Add missing gif 2019-11-05 15:54:51 +03:00
Alex Plate
76634e3eed Fix "wrap with if" 2019-11-05 15:53:33 +03:00
Alex Plate
21c16b26c9 Update set-commands 2019-11-05 10:19:29 +03:00
Alex Plate
9d6f43cfeb Fix problem with lookup selection 2019-11-01 13:55:32 +03:00
Alex Plate
cdcb31cf2f Change listeners for tests 2019-10-31 18:13:37 +03:00
Alex Plate
e17f571dba Remove useless teamcity report 2019-10-31 17:56:36 +03:00
Alex Plate
629c48bba0 Run manual tests 2019-10-31 17:55:37 +03:00
Alex Plate
5078df6caf Update CHANGES 2019-10-31 17:50:34 +03:00
Alex Plate
2c5c4d9714 Update set-commands 2019-10-31 13:13:30 +03:00
Alex Plate
316cd2c02c Rename refactoring to ideaselection 2019-10-31 13:05:22 +03:00
Alex Plate
e56f08505f Convert IdeaVisualControlTest.kt to option test 2019-10-30 18:02:15 +03:00
Alex Plate
58a1f9e275 Move tests to different location 2019-10-30 17:57:24 +03:00
Alex Plate
bfdf54db67 Add tests for idearefactormode option 2019-10-30 17:46:25 +03:00
Alex Plate
df8598a6f4 Run manual tests 2019-10-30 16:49:39 +03:00
Alex Plate
4ca9e74249 Refactor controlNonVimSelection 2019-10-30 16:43:54 +03:00
Alex Plate
33caeeaf1d Fix log 2019-10-30 16:02:12 +03:00
Alex Plate
53a8c3ecc8 Move all mode exit methods to the same place 2019-10-30 16:00:03 +03:00
Alex Plate
fabe066f94 Move selection control methods to the separate file 2019-10-30 14:45:40 +03:00
Alex Plate
5672bc0fb2 Rename function 2019-10-30 14:29:51 +03:00
Alex Plate
c77f43e7c7 Initial idearefactormode support 2019-10-30 13:00:04 +03:00
Alex Plate
d47ad34909 Fix removed vimstate saving 2019-10-30 12:38:06 +03:00
Alex Plate
96f731e9c9 Refactor MotionUp/Down actions 2019-10-29 15:37:48 +03:00
Alex Plate
1b9376a9f5 Rename motion up/down actions 2019-10-29 15:31:54 +03:00
Alex Plate
1425ee0048 Ctrl-N and Ctrl-P actions for lookup in normal mode 2019-10-29 15:28:54 +03:00
Alex Plate
3a014b2a13 Convert VimPluginToggleAction to kotlin 2019-10-29 14:39:55 +03:00
Alex Plate
38c4e6bebc Rename .java to .kt 2019-10-29 14:39:05 +03:00
Alex Plate
171404bf43 Change the superclass of VimPluginToggleAction 2019-10-29 14:33:14 +03:00
Alex Plate
73b1adce1b Make common action for enabling/disabling IdeaVim 2019-10-28 18:42:37 +03:00
Alex Plate
90f55821e0 Remove not-released option 2019-10-28 15:35:53 +03:00
Alex Plate
fee8009f38 Make vim actions popup as a separate action 2019-10-28 14:59:35 +03:00
Alex Plate
8d698aeacd Update the Join EAP dialog 2019-10-28 13:50:21 +03:00
Alex Plate
fbd588444f Hide some icon actions to sublist 2019-10-26 16:06:21 +03:00
Alex Plate
5735769ee7 null save marks restoring 2019-10-25 20:19:40 +03:00
Alex Plate
150f9190d5 Add customisation for surround with for 2019-10-25 19:58:00 +03:00
Alex Plate
6a1e8a0c22 Fix template with multiple variables 2019-10-25 17:14:23 +03:00
Alex Plate
66fca4a921 [VIM-1819] Fix execution of some rider actions 2019-10-25 15:26:33 +03:00
Alex Plate
9a2accc74b Use the correct action for next variable 2019-10-25 14:33:52 +03:00
Alex Plate
5584b5ec3a Refactor selection correction during the template 2019-10-24 16:17:34 +03:00
Alex Plate
3b4121f59a Reformat code 2019-10-24 16:15:11 +03:00
Alex Plate
35eb6c2974 Add tests and doc 2019-10-24 15:16:59 +03:00
Alex Plate
e51deac151 Make TemplateTest.kt as option test 2019-10-24 12:59:02 +03:00
Alex Plate
c9bb160291 Add savemodefor option 2019-10-23 13:17:02 +03:00
Alex Plate
586979644c Add inNormalMode helper function 2019-10-23 13:15:09 +03:00
Alex Plate
0d376eaa1d Update icon list labels 2019-10-22 12:44:25 +03:00
Alex Plate
086c3d1a24 Update the join EAP dialog 2019-10-22 12:33:45 +03:00
Alex Plate
91e75561a3 Remove the default shortcut 2019-10-21 17:35:55 +03:00
Alex Plate
979bf26441 Change the implementation of system marks 2019-10-21 16:58:22 +03:00
Alex Plate
49844ddd9b Refactor fileLocation classes 2019-10-21 15:30:46 +03:00
Alex Plate
d095ebb2f3 Rename .java to .kt 2019-10-21 15:07:14 +03:00
Alex Plate
36f473508a Disable mappings for the second part of multikey commands 2019-10-21 13:40:53 +03:00
Alex Plate
5eb2810352 Add new corrections for caret vertical motion 2019-10-18 15:15:35 +03:00
Alex Plate
ee9e3a6673 Covert DocumentManager.kt to kotlin 2019-10-18 10:24:48 +03:00
Alex Plate
81a6bd528d WIP: Renaming file 'DocumentManager' with Kotlin extension 2019-10-18 10:09:20 +03:00
Alex Plate
0cd32c97c4 Update changes 2019-10-18 10:07:41 +03:00
Alex Plate
9bef55c63e Correct selection processing
The last character in the line is not selected if the selection was started from the middle of this character and has a negative direction
2019-10-17 19:17:38 +03:00
Alex Plate
9b8686c25f Reset caret on escape 2019-10-17 17:43:37 +03:00
Alex Plate
7130760114 Fix vertical caret movements with inlays 2019-10-17 17:34:10 +03:00
Alex Plate
c6390874a2 Update changes 2019-10-17 17:16:28 +03:00
Alex Plate
bf758dcd32 Add missing bundle property 2019-10-17 15:42:41 +03:00
Alex Plate
2258ffa5eb Fix incompatibilities with older version of IJ 2019-10-17 15:38:14 +03:00
Alex Plate
20b8e8db8b Add icon to status bar 2019-10-17 15:20:01 +03:00
Alex Plate
0738d965fd Add ideavim icon for actions 2019-10-16 15:05:45 +03:00
Alex Plate
a3a421410f [VIM-1749] Tag surround is finished on > 2019-10-15 19:52:48 +03:00
Alex Plate
1921bef0ea Use build script to print TeamCity status 2019-10-15 19:11:09 +03:00
Alex Plate
70270830dc Add badge for 2019.2 tests 2019-10-15 18:56:32 +03:00
Alex Plate
d57f465e60 Add IdeaVim icon 2019-10-15 18:43:32 +03:00
Alex Plate
03c38e3454 [VIM-1804] Correct disabling and enabling IdeaVim 2019-10-15 18:14:13 +03:00
Alex Plate
be7d632cba Disable IdeaVim while AceJump is active.
https://github.com/acejump/AceJump/issues/266
2019-10-14 17:05:18 +03:00
Alex Plate
8c0a85abf4 Vim script supports evaluating of integers 2019-10-14 12:44:08 +03:00
Alex Plate
497e8c06f1 Create getter for last direction 2019-10-10 19:35:04 +03:00
Alex Plate
c1bf84605c Make findAll function public 2019-10-10 18:44:37 +03:00
Alex Plate
e362f12394 Add comment for toRegex function 2019-10-10 16:29:51 +03:00
Alex Plate
02d201a2f1 Parse the scope of let expression 2019-10-10 16:28:27 +03:00
Alex Plate
48915cc6ad Print iskeyword value as a regex string 2019-10-09 18:20:16 +03:00
Alex Plate
02b065cc2c Extensions can use linewise selection 2019-10-08 14:36:20 +03:00
Alex Plate
a255597bc0 Fix exception 2019-10-08 10:37:11 +03:00
Alex Plate
29858e8b10 Do not handle plugin incomplete mappings 2019-10-08 10:31:47 +03:00
Alex Plate
972cfb265b Change MapHandler formatting 2019-10-04 18:46:30 +03:00
Alex Plate
5e8a3afe61 Provide correct mapping names
vmap - mapping for visual and select mode
xmap - mapping for visual mode
2019-10-04 18:45:46 +03:00
Alex Plate
700decb2e0 Update mappings handler for properly handler intersecting mappings. 2019-10-02 18:44:43 +03:00
Alex Plate
8368055397 Registrar should be written in java due to capability problems 2019-10-01 20:33:00 +03:00
Alex Plate
0d0f1f1c0c External plugins can now contribute to vimExtension 2019-10-01 19:59:41 +03:00
Alex Plate
db68ae5cea Add tests for extension in op mode 2019-10-01 10:15:44 +03:00
Alex Plate
0fd7c4aa4f Clean up 2019-09-30 19:46:40 +03:00
Alex Plate
8592e6ef60 Plugins can act as an operator 2019-09-30 19:46:03 +03:00
Alex Plate
e9fb02220a Update api of ListenerSuppressor 2019-09-30 19:46:03 +03:00
Alex Plate
aa54a0cd98 Execute mapping in sync way 2019-09-30 19:46:02 +03:00
Alex Plate
eb724c8753 Fix yy command 2019-09-27 22:11:28 +03:00
Alex Plate
1bb0caa704 Fix dd for empty line 2019-09-27 17:46:00 +03:00
Alex Plate
5bf2bc4a7b Reformat Command 2019-09-27 14:56:24 +03:00
Alex Plate
70fd7ef89d operator-W doesn't affect the next line 2019-09-26 15:31:05 +03:00
Alex Plate
50d8e79571 Use fail function from kotlin 2019-09-26 14:47:36 +03:00
Alex Plate
c236ddd967 Add docs to Nodes 2019-09-26 11:25:49 +03:00
Alex Plate
b551518911 Add additional checks for command consistency 2019-09-25 20:09:21 +03:00
Alex Plate
1be49b06f3 Fix processing of / and ? commands 2019-09-25 20:01:20 +03:00
Alex Plate
200a9c6318 Update key handling process 2019-09-25 20:01:19 +03:00
Alex Plate
9f10106d75 Use only one handler to process @@ and @: commands 2019-09-25 20:00:23 +03:00
Alex Plate
6d4ff752a0 Double commands are processed in original way 2019-09-25 16:22:54 +03:00
Alex Plate
29ecae66a9 Make baseExecute as final method 2019-09-25 13:20:16 +03:00
Alex Plate
9c5f50d0a6 Move change motion tests to the separate file 2019-09-25 13:02:49 +03:00
Alex Plate
8fcc9ac1e2 Some fixes on change motion actions. 2019-09-24 17:53:36 +03:00
Alex Plate
8d83b3b1e7 Remove parameter from getMotionRange 2019-09-24 17:13:20 +03:00
Alex Plate
155570b6bf Remove unused flag 2019-09-24 16:44:12 +03:00
Alex Plate
831dc35935 Update processing of text objects 2019-09-24 16:42:46 +03:00
Alex Plate
b641f1b67c Motion command should explicit define inclusive / exclusive 2019-09-24 15:24:39 +03:00
Alex Plate
3c4906b8ac Get rid of useless FLAG_MOT_EXCLUSIVE 2019-09-23 17:31:17 +03:00
Alex Plate
a575bc92cc Correctly process d_ command 2019-09-18 22:40:29 +03:00
Alex Plate
7794e9ccd2 Fix undo mapping 2019-09-18 21:28:28 +03:00
Alex Plate
4f5301a7e0 Fix mapping for undo action 2019-09-17 18:42:41 +03:00
Alex Plate
6842936a75 Add state for awaiting for digraph (or char) input 2019-09-17 18:42:41 +03:00
Alex Plate
a0bf6599fa Add comment for command flags option 2019-09-17 18:42:41 +03:00
Alex Plate
c0384949a3 Add javadoc for key mapping 2019-09-17 18:42:41 +03:00
Alex Plate
371f4b128e Rename EX_ENTRY to CMD_LINE mode 2019-09-17 18:42:41 +03:00
Alex Plate
29fc776293 Remove NONE argument 2019-09-17 18:42:40 +03:00
Alex Plate
bbdf87190c Extract node argument into the separate variable 2019-09-17 18:42:40 +03:00
Alex Plate
02a448f284 Convert command nodes to kt 2019-09-17 18:42:40 +03:00
Alex Plate
8665878b04 Remove useless FLAG_OP_PEND flag 2019-09-17 18:42:40 +03:00
Alex Plate
c23812941b Clean up Argument class 2019-09-17 18:42:40 +03:00
Alex Plate
fdac774745 Convert FilterMotionAction to kt 2019-09-17 18:42:40 +03:00
Alex Plate
0a38b65ded WIP: Renaming file 'FilterMotionAction' with Kotlin extension 2019-09-17 18:42:39 +03:00
Alex Plate
a7f44c8dd1 Revert "Temporally disable multithread startup"
This reverts commit bef3b3ba
2019-09-17 18:32:12 +03:00
Alex Plate
2444bd3c2d Update Changes.md 2019-09-17 18:29:36 +03:00
Alex Plate
27f74844cc Update changes 2019-09-17 18:28:40 +03:00
321 changed files with 4306 additions and 3420 deletions

View File

@@ -8,19 +8,27 @@ Get an Early Access
------------------- -------------------
Would you like to try new features and fixes? Join the Early Access Program and 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 | receive EAP builds as updates! Use the `Join EAP` option in the status bar or
Browse Repositories | Manage Repositories": add this URL to "Settings | Plugins | Manage Plugin Repositories":
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim) `https://plugins.jetbrains.com/plugins/eap/ideavim`
It is important to distinguish EAP from traditional pre-release software. 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 Please note that the quality of EAP versions may at times be way below even
usual beta standards. usual beta standards.
To be released 0.54, 2019-11-20
-------------- --------------
**Features:** **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)) * 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:** **Fixes:**
* [VIM-1766](https://youtrack.jetbrains.com/issue/VIM-1766) Fix disappearing caret in ex entry on Linux * [VIM-1766](https://youtrack.jetbrains.com/issue/VIM-1766) Fix disappearing caret in ex entry on Linux
@@ -38,6 +46,16 @@ To be released
* [VIM-1772](https://youtrack.jetbrains.com/issue/VIM-1772) Fix yanking with `:y` command * [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-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 * [VIM-1752](https://youtrack.jetbrains.com/issue/VIM-1752) Fix `ESC` for insert mode
* [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
* [VIM-1800](https://youtrack.jetbrains.com/issue/VIM-1800) Improve ideamarks option
* [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 0.53, 2019-08-07
-------------- --------------

View File

@@ -10,6 +10,12 @@
</a> </a>
<span>2019.1 Tests</span> <span>2019.1 Tests</span>
</div> </div>
<div>
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20192&guest=1">
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20192)/statusIcon.svg?guest=1"/>
</a>
<span>2019.2 Tests</span>
</div>
### Where to Start ### Where to Start

View File

@@ -1,27 +1,17 @@
<img src="resources/META-INF/pluginIcon.svg" width="80" height="80" alt="icon" align="left"/>
IdeaVim IdeaVim
======= ===
<div> <div>
<a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub"> <a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
<img src="https://jb.gg/badges/official.svg" alt="official JetBrains project"/> <img src="https://jb.gg/badges/official.svg" alt="official JetBrains project"/>
</a> </a>
</div> <a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20191&guest=1">
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20191)/statusIcon.svg?guest=1"/>
<div>
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Deploy&guest=1">
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Deploy)/statusIcon.svg?guest=1"/>
</a> </a>
<span>Stable</span>
</div> </div>
<div>
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Build&guest=1">
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Build)/statusIcon.svg?guest=1"/>
</a>
<span>EAP</span>
</div>
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform. IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform.
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio. RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
@@ -59,6 +49,10 @@ Get Early Access
Would you like to try new features and fixes? Join the Early Access Program and Would you like to try new features and fixes? Join the Early Access Program and
receive EAP builds as updates! 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` 1. Open `Settings | Plugins`
2. Click the gear icon :gear:, select `Manage Plugin Repositories`, and add the following url: 2. Click the gear icon :gear:, select `Manage Plugin Repositories`, and add the following url:
`https://plugins.jetbrains.com/plugins/eap/ideavim` `https://plugins.jetbrains.com/plugins/eap/ideavim`
@@ -138,24 +132,32 @@ Emulated Vim Plugins
-------------------- --------------------
IdeaVim extensions emulate some plugins of the original Vim. In order to use 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> set <extension-name>
Available extensions: 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 * surround
* `set surround` * Setup: `set surround`
* Emulates [vim-surround](https://github.com/tpope/vim-surround) * Emulates [vim-surround](https://github.com/tpope/vim-surround)
* Commands: `ys`, `cs`, `ds`, `S` * Commands: `ys`, `cs`, `ds`, `S`
* multiple-cursors * multiple-cursors
* `set multiple-cursors` * Setup: `set multiple-cursors`
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors) * Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>` * Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
* commentary * commentary
* `set commentary` * Setup: `set commentary`
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary) * Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
* Commands: `gcc`, `gc + motion`, `v_gc` * Commands: `gcc`, `gc + motion`, `v_gc`
@@ -211,4 +213,5 @@ for a list of authors and contributors.
License 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

@@ -18,6 +18,19 @@ 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 If true, creation of global mark will trigger creation of IDE's bookmark
and vice versa. and vice versa.
`idearefactormode` `idearefactormode` String(default "select") - IdeaVim ONLY
Define the mode that would be enabled during
the refactoring (renaming, live template, introduce variable, etc)
Use one of the following values:
- keep - keep the mode that was enabled before starting a refactoring
- select - start refactoring in select mode
- visual - start refactoring in visual mode
This option has effect if you are in normal, insert or replace mode before refactoring start.
Visual or select mode are not changed.
'ignorecase' 'ic' ignore case in search patterns 'ignorecase' 'ic' ignore case in search patterns
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc. 'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
@@ -59,7 +72,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
'scrolloff' 'so' minimum number of lines above and below the cursor 'scrolloff' 'so' minimum number of lines above and below the cursor
'selection' 'sel' what type of selection to use 'selection' 'sel' what type of selection to use
`selectmode` `slm` String (default "template") `selectmode` `slm` String (default "")
This is a comma-separated list of words, which specify when to start This is a comma-separated list of words, which specify when to start
Select mode instead of Visual mode, when a selection is started. Select mode instead of Visual mode, when a selection is started.
@@ -67,9 +80,14 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
mouse when using the mouse mouse when using the mouse
key when using shifted special[1] keys key when using shifted special[1] keys
cmd when using "v", "V", or <C-V> cmd when using "v", "V", or <C-V>
template when starting a template - IdeaVim ONLY ideaselection when IDE sets a selection - IdeaVim ONLY
refactoring when refactoring without - IdeaVim ONLY (examples: extend selection, wrap with while, etc.)
a template is performed
Deprecated values:
template ~~please use `idearefactormode` option~~
when starting a template - IdeaVim ONLY
refactoring ~~please use ideaselection~~
same as ideaselection - IdeaVim ONLY
'showmode' 'smd' message on the status line to show current mode 'showmode' 'smd' message on the status line to show current mode

View File

@@ -3,7 +3,9 @@
<id>IdeaVIM</id> <id>IdeaVIM</id>
<change-notes><![CDATA[ <change-notes><![CDATA[
<ul> <ul>
<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>Support surrounding with a function name</li>
<li>Add IdeaVim logo to the status bar</li>
<li>Various bug fixes</li> <li>Various bug fixes</li>
</ul> </ul>
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p> <p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
@@ -70,6 +72,8 @@
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/> <projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/> <applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.StatusBarIconProvider"/>
</extensions> </extensions>
<extensions defaultExtensionNs="IdeaVIM"> <extensions defaultExtensionNs="IdeaVIM">
@@ -111,6 +115,7 @@
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftEndAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftEndAction"/>
<!-- Up/Down --> <!-- Up/Down -->
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownCtrlNAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownNotLineWiseAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownNotLineWiseAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownFirstNonSpaceAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownFirstNonSpaceAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.EnterNormalAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.EnterNormalAction"/>
@@ -122,6 +127,7 @@
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndInsertAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndInsertAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionPercentOrMatchAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionPercentOrMatchAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpCtrlPAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpNotLineWiseAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpNotLineWiseAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpFirstNonSpaceAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpFirstNonSpaceAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionArrowDownAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionArrowDownAction"/>
@@ -283,7 +289,6 @@
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinLinesSpacesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinLinesSpacesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinVisualLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinVisualLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinVisualLinesSpacesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinVisualLinesSpacesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteLineAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteMotionAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteMotionAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualLinesAction"/>
@@ -314,20 +319,16 @@
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualLinesEndAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualLinesEndAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterMotionAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterMotionAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterCountLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterVisualLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterVisualLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.AutoIndentLinesVisualAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.AutoIndentLinesVisualAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ReformatCodeVisualAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.ReformatCodeVisualAction"/>
<!-- Shift --> <!-- Shift -->
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.AutoIndentLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.AutoIndentMotionAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.AutoIndentMotionAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesNormalModeAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightLinesAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightLinesNormalModeAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightMotionAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightMotionAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightVisualAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightVisualAction"/>
@@ -340,7 +341,6 @@
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorActionMoveCursor"/> <vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorActionMoveCursor"/>
<vimAction implementation="com.maddyhome.idea.vim.action.copy.SelectRegisterAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.copy.SelectRegisterAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankLineAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.copy.YankLineAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankLineMidCountAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankMotionAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.copy.YankMotionAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualLinesAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualLinesAction"/>
@@ -382,7 +382,6 @@
<!-- Macro --> <!-- Macro -->
<vimAction implementation="com.maddyhome.idea.vim.action.macro.ToggleRecordingAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.macro.ToggleRecordingAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.macro.PlaybackRegisterAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.macro.PlaybackRegisterAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.macro.PlaybackLastRegisterAction"/>
<!-- Command Line --> <!-- Command Line -->
<vimAction implementation="com.maddyhome.idea.vim.action.ex.ProcessExEntryAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.ex.ProcessExEntryAction"/>
@@ -391,7 +390,6 @@
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLastSearchReplaceAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLastSearchReplaceAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLastGlobalSearchReplaceAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLastGlobalSearchReplaceAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.RepeatChangeAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.RepeatChangeAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.RepeatExCommandAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.ExEntryAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.ExEntryAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.ResetModeAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.ResetModeAction"/>
<vimAction implementation="com.maddyhome.idea.vim.action.change.RedoAction"/> <vimAction implementation="com.maddyhome.idea.vim.action.change.RedoAction"/>
@@ -491,7 +489,6 @@
<actions> <actions>
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.action.VimPluginToggleAction" text="Vim Emulator" description="Toggle the vim plugin On/off"> <action id="VimPluginToggle" class="com.maddyhome.idea.vim.action.VimPluginToggleAction" text="Vim Emulator" description="Toggle the vim plugin On/off">
<keyboard-shortcut first-keystroke="control alt V" keymap="$default"/>
<add-to-group group-id="ToolsMenu" anchor="last"/> <add-to-group group-id="ToolsMenu" anchor="last"/>
</action> </action>
@@ -499,5 +496,6 @@
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Add Test Inlays | IdeaVim Internal" internal="true"/> <action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Add Test Inlays | IdeaVim Internal" internal="true"/>
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/> <action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
<action id="VimActions" class="com.maddyhome.idea.vim.VimActions" text="Vim Actions"/>
</actions> </actions>
</idea-plugin> </idea-plugin>

View File

@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
<defs>
<linearGradient id="ideavim_plugin-a" x1="-6.748%" x2="47.286%" y1="33.61%" y2="85.907%">
<stop offset="0%" stop-color="#3BEA62"/>
<stop offset="100%" stop-color="#087CFA"/>
</linearGradient>
</defs>
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd" points="28.019 4 15.988 24.119 15.988 4 4 4 4 36 17.953 36 36 4"/>
</svg>

After

Width:  |  Height:  |  Size: 450 B

View File

@@ -0,0 +1,4 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path
d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>
</svg>

After

Width:  |  Height:  |  Size: 824 B

View File

@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40">
<defs>
<linearGradient id="ideavim_plugin-a" x1="-6.748%" x2="47.286%" y1="33.61%" y2="85.907%">
<stop offset="0%" stop-color="#3BEA62"/>
<stop offset="100%" stop-color="#087CFA"/>
</linearGradient>
</defs>
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd" points="28.019 4 15.988 24.119 15.988 4 4 4 4 36 17.953 36 36 4"/>
</svg>

After

Width:  |  Height:  |  Size: 450 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40">
<polygon fill="#6E6E6E" fill-rule="evenodd" points="28.019 4 15.988 24.119 15.988 4 4 4 4 36 17.953 36 36 4"/>
</svg>

After

Width:  |  Height:  |  Size: 204 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40">
<polygon fill="#AFB1B3" fill-rule="evenodd" points="28.019 4 15.988 24.119 15.988 4 4 4 4 36 17.953 36 36 4"/>
</svg>

After

Width:  |  Height:  |  Size: 204 B

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="16" height="16" fill="#000000">
<path fill="#1DA1F2" d="M 25.855469 5.574219 C 24.914063 5.992188 23.902344 6.273438 22.839844 6.402344 C 23.921875 5.75 24.757813 4.722656 25.148438 3.496094 C 24.132813 4.097656 23.007813 4.535156 21.8125 4.769531 C 20.855469 3.75 19.492188 3.113281 17.980469 3.113281 C 15.082031 3.113281 12.730469 5.464844 12.730469 8.363281 C 12.730469 8.773438 12.777344 9.175781 12.867188 9.558594 C 8.503906 9.339844 4.636719 7.246094 2.046875 4.070313 C 1.59375 4.847656 1.335938 5.75 1.335938 6.714844 C 1.335938 8.535156 2.261719 10.140625 3.671875 11.082031 C 2.808594 11.054688 2 10.820313 1.292969 10.425781 C 1.292969 10.449219 1.292969 10.46875 1.292969 10.492188 C 1.292969 13.035156 3.101563 15.15625 5.503906 15.640625 C 5.0625 15.761719 4.601563 15.824219 4.121094 15.824219 C 3.78125 15.824219 3.453125 15.792969 3.132813 15.730469 C 3.800781 17.8125 5.738281 19.335938 8.035156 19.375 C 6.242188 20.785156 3.976563 21.621094 1.515625 21.621094 C 1.089844 21.621094 0.675781 21.597656 0.265625 21.550781 C 2.585938 23.039063 5.347656 23.90625 8.3125 23.90625 C 17.96875 23.90625 23.25 15.90625 23.25 8.972656 C 23.25 8.742188 23.246094 8.515625 23.234375 8.289063 C 24.261719 7.554688 25.152344 6.628906 25.855469 5.574219"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="16" height="16" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
<g>
<g>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="7.083" y1="16.2945" x2="64.1058" y2="42.2878" gradientTransform="matrix(1 0 0 -1 0 71.0471)">
<stop offset="0" style="stop-color:#7863AB"/>
<stop offset="0.1649" style="stop-color:#6572B6"/>
<stop offset="0.3776" style="stop-color:#538FCC"/>
<stop offset="0.5401" style="stop-color:#3DA5DD"/>
<stop offset="0.6317" style="stop-color:#35ADE3"/>
</linearGradient>
<path style="fill:url(#SVGID_1_);" d="M66.9,47.5c-0.2-0.2-13.1-12.6-13.1-12.6s9.8-10.4,12.4-13c0.8-0.8,1.5-1.6,2-2.6
c3.6-6.1,1.5-13.9-4.6-17.5c-4.5-2.6-10.1-2.2-14.1,0.8c-0.7,0.5-1.3,1-1.9,1.6C47.3,4.6,33.7,17,21.9,27.8l22.1,14L20.8,67.9
c-1.4,1-2.8,1.6-4.3,1.9c0.3,0,0.5,0,0.8-0.1c4.6-0.7,43.9-7.3,45.8-7.7c2.3-0.4,4.4-1.8,5.7-3.9C71,54.5,70,50,66.9,47.5z"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="30.31" y1="42.9162" x2="1.0679" y2="68.7442" gradientTransform="matrix(1 0 0 -1 0 71.0471)">
<stop offset="0" style="stop-color:#7863AB"/>
<stop offset="7.176042e-002" style="stop-color:#895EA7"/>
<stop offset="0.2523" style="stop-color:#C34F9D"/>
<stop offset="0.3901" style="stop-color:#ED3995"/>
<stop offset="0.4677" style="stop-color:#EE3B8B"/>
</linearGradient>
<path style="fill:url(#SVGID_2_);" d="M45.9,30.5c-0.4-2.7-1.8-4.9-3.8-6.5C40,22.4,23.8,5.6,22,3.7C19.2,1,15.2-0.5,11.1,0.2
C4.1,1.2-0.8,7.8,0.3,14.8c0.5,3.5,2.5,6.5,5.1,8.4c2.6,2,23,16,24.3,17c2.1,1.6,4.9,2.5,7.7,2C42.9,41.2,46.8,36,45.9,30.5z"/>
</g>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="4.9829" y1="12.3617" x2="74.0226" y2="55.8638" gradientTransform="matrix(1 0 0 -1 0 71.0471)">
<stop offset="0" style="stop-color:#7863AB"/>
<stop offset="0.1649" style="stop-color:#6572B6"/>
<stop offset="0.3776" style="stop-color:#538FCC"/>
<stop offset="0.5401" style="stop-color:#3DA5DD"/>
<stop offset="0.6317" style="stop-color:#35ADE3"/>
</linearGradient>
<path style="fill:url(#SVGID_3_);" d="M23,67.8c0.1,0,23.3-26.1,23.3-26.1L22.9,26.9c-8.3,7.6-16,14.5-17.8,16.2
c-1.1,1-2.2,2.3-3,3.7c-4.3,7.4-1.8,16.8,5.6,21.1C10.7,69.6,17.5,71.7,23,67.8z"/>
</g>
<g>
<rect x="13.4" y="13.4" style="fill:#231F20;" width="43.2" height="43.2"/>
<rect x="17.4" y="48.5" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
<polygon style="fill:#FFFFFF;" points="23.8,29.9 17,19.1 21.6,19.1 25.8,26.2 30.2,19.1 34.7,19.1 27.8,29.8 27.8,37 23.8,37
"/>
<polygon style="fill:#FFFFFF;" points="41.6,22.7 36.1,22.7 36.1,19.1 51,19.1 51,22.7 45.5,22.7 45.5,37 41.6,37 "/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -23,6 +23,7 @@ e_badrange=Unexpected character ''{0}'' in range
e_norange=No range allowed e_norange=No range allowed
e_rangereq=Range required e_rangereq=Range required
e_argreq=Argument required e_argreq=Argument required
e_argforb=Argument forbidden
e_noprev=E34: No previous command e_noprev=E34: No previous command
e_nopresub=E33: No previous substitute regular expression e_nopresub=E33: No previous substitute regular expression
E191=E191: Argument must be a letter or forward/backward quote E191=E191: Argument must be a letter or forward/backward quote

View File

@@ -26,19 +26,27 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.command.UndoConfirmationPolicy; import com.intellij.openapi.command.UndoConfirmationPolicy;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.ActionPlan; import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId; import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler; import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.maddyhome.idea.vim.action.ExEntryAction;
import com.maddyhome.idea.vim.action.macro.ToggleRecordingAction;
import com.maddyhome.idea.vim.action.motion.search.SearchEntryFwdAction;
import com.maddyhome.idea.vim.action.motion.search.SearchEntryRevAction;
import com.maddyhome.idea.vim.command.*; import com.maddyhome.idea.vim.command.*;
import com.maddyhome.idea.vim.extension.VimExtensionHandler; import com.maddyhome.idea.vim.extension.VimExtensionHandler;
import com.maddyhome.idea.vim.group.ChangeGroup;
import com.maddyhome.idea.vim.group.RegisterGroup; import com.maddyhome.idea.vim.group.RegisterGroup;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.group.visual.VisualGroupKt;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase; import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.MotionActionHandler;
import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
import com.maddyhome.idea.vim.helper.*; import com.maddyhome.idea.vim.helper.*;
import com.maddyhome.idea.vim.key.*; import com.maddyhome.idea.vim.key.*;
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
import com.maddyhome.idea.vim.option.OptionsManager; import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
@@ -48,9 +56,12 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.intellij.openapi.actionSystem.CommonDataKeys.*; import static com.intellij.openapi.actionSystem.CommonDataKeys.*;
import static com.intellij.openapi.actionSystem.PlatformDataKeys.PROJECT_FILE_DIRECTORY; import static com.intellij.openapi.actionSystem.PlatformDataKeys.PROJECT_FILE_DIRECTORY;
import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
/** /**
* This handlers every keystroke that the user can argType except those that are still valid hotkeys for various Idea * This handlers every keystroke that the user can argType except those that are still valid hotkeys for various Idea
@@ -95,11 +106,13 @@ public class KeyHandler {
return origHandler; return origHandler;
} }
public static void executeVimAction(@NotNull Editor editor, @NotNull EditorActionHandlerBase cmd, DataContext context) { public static void executeVimAction(@NotNull Editor editor,
CommandProcessor.getInstance().executeCommand(editor.getProject(), () -> cmd @NotNull EditorActionHandlerBase cmd,
.execute(editor, getProjectAwareDataContext(editor, context)), cmd.getId(), DataContext context) {
DocCommandGroupId.noneGroupId(editor.getDocument()), CommandProcessor.getInstance()
UndoConfirmationPolicy.DEFAULT, editor.getDocument()); .executeCommand(editor.getProject(), () -> cmd.execute(editor, getProjectAwareDataContext(editor, context)),
cmd.getId(), DocCommandGroupId.noneGroupId(editor.getDocument()), UndoConfirmationPolicy.DEFAULT,
editor.getDocument());
} }
/** /**
@@ -114,10 +127,13 @@ public class KeyHandler {
// What is "place"? Leave it the empty string for now. // What is "place"? Leave it the empty string for now.
// Is the template presentation sufficient? // Is the template presentation sufficient?
// What are the modifiers? Is zero OK? // What are the modifiers? Is zero OK?
//
// beforeActionPerformedUpdate should be called to update the action. It fixes some rider-specific problems
// because rider use async update method. See VIM-1819
final AnActionEvent event = final AnActionEvent event =
new AnActionEvent(null, context, ActionPlaces.ACTION_SEARCH, action.getTemplatePresentation(), new AnActionEvent(null, context, ActionPlaces.ACTION_SEARCH, action.getTemplatePresentation(),
ActionManager.getInstance(), 0); ActionManager.getInstance(), 0);
action.update(event); action.beforeActionPerformedUpdate(event);
if (event.getPresentation().isEnabled()) { if (event.getPresentation().isEnabled()) {
action.actionPerformed(event); action.actionPerformed(event);
return true; return true;
@@ -182,8 +198,13 @@ public class KeyHandler {
// Update the count // Update the count
count = count * 10 + (chKey - '0'); count = count * 10 + (chKey - '0');
} }
else if (allowKeyMappings && handleKeyMapping(editor, key, context)) { else if (!waitCommandFinish(editor) && allowKeyMappings && handleKeyMapping(editor, key, context)) {
return; if (editorState.getMappingMode() != MappingMode.OP_PENDING ||
currentCmd.isEmpty() ||
currentCmd.peek().getArgument() == null ||
currentCmd.peek().getArgument().getType() != Argument.Type.OFFSETS) {
return;
}
} }
// Pressing delete while entering a count "removes" the last digit entered // Pressing delete while entering a count "removes" the last digit entered
// Unlike the digits, this must be checked *after* checking for key mappings // Unlike the digits, this must be checked *after* checking for key mappings
@@ -207,24 +228,17 @@ public class KeyHandler {
// Ask the key/action tree if this is an appropriate key at this point in the command and if so, // Ask the key/action tree if this is an appropriate key at this point in the command and if so,
// return the node matching this keystroke // return the node matching this keystroke
final Node node = editorState.getCurrentNode().getChildOrArgument(key); Node node = editorState.getCurrentNode().get(key);
if (handleDigraph(editor, key, context, node)) { if (handleDigraph(editor, key, context, node)) return;
return;
}
// If this is a branch node we have entered only part of a multi-key command node = mapOpCommand(key, node, editorState);
if (node instanceof BranchNode) {
handleBranchNode(editor, context, editorState, chKey, (BranchNode)node); if (node instanceof CommandNode) {
handleCommandNode(editor, context, key, (CommandNode)node, editorState);
} }
// If this is a command node the user has entered a valid key sequence of a known command else if (node instanceof CommandPartNode) {
else if (node instanceof CommandNode) { editorState.setCurrentNode((CommandPartNode)node);
handleCommandNode(editor, (CommandNode)node);
}
// If this is an argument node then the last keystroke was not part of the current command but should
// be the first keystroke of the argument of the current command
else if (node instanceof ArgumentNode) {
shouldRecord = handleArgumentNode(editor, key, context, editorState, (ArgumentNode)node);
} }
else { else {
if (lastWasBS && lastChar != 0 && OptionsManager.INSTANCE.getDigraph().isSet()) { if (lastWasBS && lastChar != 0 && OptionsManager.INSTANCE.getDigraph().isSet()) {
@@ -267,21 +281,32 @@ public class KeyHandler {
if (editorState.getMappingMode() == MappingMode.OP_PENDING) { if (editorState.getMappingMode() == MappingMode.OP_PENDING) {
editorState.popState(); editorState.popState();
} }
else {
VimPlugin.indicateError();
reset(editor);
}
}
// We had some sort of error so reset the handler and let the user know (beep)
else if (state == State.ERROR) {
VimPlugin.indicateError(); VimPlugin.indicateError();
fullReset(editor); reset(editor);
} }
else if (isRecording && shouldRecord) { else if (isRecording && shouldRecord) {
VimPlugin.getRegister().recordKeyStroke(key); VimPlugin.getRegister().recordKeyStroke(key);
} }
} }
private boolean waitCommandFinish(@NotNull Editor editor) {
return !(CommandState.getInstance(editor).getCurrentNode() instanceof RootNode);
}
/**
* See the description for {@link CommandFlags#FLAG_DUPLICABLE_OPERATOR}
*/
private Node mapOpCommand(KeyStroke key, Node node, @NotNull CommandState editorState) {
if (editorState.getMappingMode() == MappingMode.OP_PENDING && !currentCmd.empty()) {
EditorActionHandlerBase action = currentCmd.peek().getAction();
if (action.getFlags().contains(CommandFlags.FLAG_DUPLICABLE_OPERATOR) &&
action.getKeyStrokesSet().stream().anyMatch(o -> o.size() == 1 && o.get(0).equals(key))) {
return editorState.getCurrentNode().get(KeyStroke.getKeyStroke('_'));
}
}
return node;
}
private static <T> boolean isPrefix(@NotNull List<T> list1, @NotNull List<T> list2) { private static <T> boolean isPrefix(@NotNull List<T> list1, @NotNull List<T> list2) {
if (list1.size() > list2.size()) { if (list1.size() > list2.size()) {
return false; return false;
@@ -295,7 +320,7 @@ public class KeyHandler {
} }
private void handleEditorReset(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull final DataContext context) { private void handleEditorReset(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull final DataContext context) {
if (state != State.COMMAND && count == 0 && currentArg == Argument.Type.NONE && currentCmd.size() == 0) { if (count == 0 && currentArg == null && currentCmd.size() == 0) {
RegisterGroup register = VimPlugin.getRegister(); RegisterGroup register = VimPlugin.getRegister();
if (register.getCurrentRegister() == register.getDefaultRegister()) { if (register.getCurrentRegister() == register.getDefaultRegister()) {
if (key.getKeyCode() == KeyEvent.VK_ESCAPE) { if (key.getKeyCode() == KeyEvent.VK_ESCAPE) {
@@ -306,18 +331,18 @@ public class KeyHandler {
} }
} }
reset(editor); reset(editor);
ChangeGroup.resetCaret(editor, false);
} }
private boolean handleKeyMapping(@NotNull final Editor editor, private boolean handleKeyMapping(@NotNull final Editor editor,
@NotNull final KeyStroke key, @NotNull final KeyStroke key,
@NotNull final DataContext context) { @NotNull final DataContext context) {
if (state == State.CHAR_OR_DIGRAPH) return false;
final CommandState commandState = CommandState.getInstance(editor); final CommandState commandState = CommandState.getInstance(editor);
commandState.stopMappingTimer(); commandState.stopMappingTimer();
final MappingMode mappingMode = commandState.getMappingMode(); final MappingMode mappingMode = commandState.getMappingMode();
if (MappingMode.NVO.contains(mappingMode) && (state != State.NEW_COMMAND || currentArg != Argument.Type.NONE)) {
return false;
}
final List<KeyStroke> mappingKeys = commandState.getMappingKeys(); final List<KeyStroke> mappingKeys = commandState.getMappingKeys();
final List<KeyStroke> fromKeys = new ArrayList<>(mappingKeys); final List<KeyStroke> fromKeys = new ArrayList<>(mappingKeys);
@@ -331,11 +356,19 @@ public class KeyHandler {
final Application application = ApplicationManager.getApplication(); final Application application = ApplicationManager.getApplication();
if (mapping.isPrefix(fromKeys)) { if (mapping.isPrefix(fromKeys)) {
// Okay, there is some mapping that starts with inserted key sequence. So,
// either the user will continue to enter the mapping, or (if timeout option is set)
// the entered command should be executed. Here we set up the times that will execute
// typed keys after some delay.
// E.g. there is a map for "dweri". If the user types "d", "w" they mean either "dweri" or "dw" command.
// If the user will continue typing "e", "r" and "i", the timer will be cancelled. If the user will
// not type anything, the "dw" command will be executed.
mappingKeys.add(key); mappingKeys.add(key);
if (!application.isUnitTestMode() && OptionsManager.INSTANCE.getTimeout().isSet()) { if (!application.isUnitTestMode() && OptionsManager.INSTANCE.getTimeout().isSet()) {
commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> { commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
final KeyStroke firstKey = mappingKeys.get(0);
mappingKeys.clear(); mappingKeys.clear();
if (editor.isDisposed()) { if (editor.isDisposed() || firstKey.equals(parseKeys("<Plug>").get(0))) {
return; return;
} }
for (KeyStroke keyStroke : fromKeys) { for (KeyStroke keyStroke : fromKeys) {
@@ -346,62 +379,121 @@ public class KeyHandler {
return true; return true;
} }
else if (mappingInfo != null) { else if (mappingInfo != null) {
// Okay, there is a mapping for the entered key sequence
// now the another key sequence should be executed, or the handler that attached to this command
mappingKeys.clear(); mappingKeys.clear();
final Runnable handleMappedKeys = () -> {
if (editor.isDisposed()) {
return;
}
final List<KeyStroke> toKeys = mappingInfo.getToKeys();
final VimExtensionHandler extensionHandler = mappingInfo.getExtensionHandler();
final EditorDataContext currentContext = new EditorDataContext(editor);
if (toKeys != null) {
final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), toKeys);
boolean first = true;
for (KeyStroke keyStroke : toKeys) {
final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix);
handleKey(editor, keyStroke, currentContext, recursive);
first = false;
}
}
else if (extensionHandler != null) {
final CommandProcessor processor = CommandProcessor.getInstance();
processor.executeCommand(editor.getProject(), () -> extensionHandler.execute(editor, context),
"Vim " + extensionHandler.getClass().getSimpleName(), null);
}
// NB: mappingInfo MUST be non-null here, so if equal final List<KeyStroke> toKeys = mappingInfo.getToKeys();
// then prevMappingInfo is also non-null; this also final VimExtensionHandler extensionHandler = mappingInfo.getExtensionHandler();
// means that the prev mapping was a prefix, but the final EditorDataContext currentContext = new EditorDataContext(editor);
// next key typed (`key`) was not part of that if (toKeys != null) {
if (prevMappingInfo == mappingInfo) { // Here is a mapping to another key sequence
// post to end of queue so it's handled AFTER final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), toKeys);
// an <Plug> mapping is invoked (since that boolean first = true;
// will also get posted) for (KeyStroke keyStroke : toKeys) {
Runnable handleRemainingKey = () -> handleKey(editor, key, currentContext); final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix);
handleKey(editor, keyStroke, currentContext, recursive);
if (application.isUnitTestMode()) { first = false;
handleRemainingKey.run();
}
else {
application.invokeLater(handleRemainingKey);
}
} }
};
if (application.isUnitTestMode()) {
handleMappedKeys.run();
} }
else { else if (extensionHandler != null) {
application.invokeLater(handleMappedKeys); // Here is a mapping to some vim handler
final CommandProcessor processor = CommandProcessor.getInstance();
final boolean isPendingMode = CommandState.getInstance(editor).getMappingMode() == MappingMode.OP_PENDING;
Map<Caret, Integer> startOffsets =
editor.getCaretModel().getAllCarets().stream().collect(Collectors.toMap(Function.identity(), Caret::getOffset));
processor.executeCommand(editor.getProject(), () -> extensionHandler.execute(editor, context),
"Vim " + extensionHandler.getClass().getSimpleName(), null);
if (isPendingMode &&
!currentCmd.isEmpty() &&
currentCmd.peek().getArgument() == null) {
Map<Caret, VimSelection> offsets = new HashMap<>();
for (Caret caret : editor.getCaretModel().getAllCarets()) {
@Nullable Integer startOffset = startOffsets.get(caret);
if (caret.hasSelection()) {
final VimSelection vimSelection = VimSelection.Companion
.create(UserDataManager.getVimSelectionStart(caret), caret.getOffset(),
SelectionType.fromSubMode(CommandStateHelper.getSubMode(editor)), editor);
offsets.put(caret, vimSelection);
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);
offsets.put(caret, vimSelection);
try (VimListenerSuppressor.Locked ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) {
// Move caret to the initial offset for better undo action
// This is not a necessary thing, but without it undo action look less convenient
editor.getCaretModel().moveToOffset(startOffset);
}
}
}
if (!offsets.isEmpty()) {
currentCmd.peek().setArgument(new Argument(offsets));
state = State.READY;
}
}
}
// NB: mappingInfo MUST be non-null here, so if equal
// then prevMappingInfo is also non-null; this also
// means that the prev mapping was a prefix, but the
// next key typed (`key`) was not part of that
if (prevMappingInfo == mappingInfo) {
handleKey(editor, key, currentContext);
} }
return true; return true;
} }
else { else {
final List<KeyStroke> unhandledKeys = new ArrayList<>(mappingKeys); // If the user enters a command that starts with known mapping, but it is not exactly this mapping,
// mapping handler prevents further processing of there keys.
// E.g. if there is a mapping for "hello" and user enters command "help"
// the processing of "h", "e" and "l" will be prevented by this handler.
// However, these keys should be processed as usual when user enters "p"
// and the following for loop does exactly that.
//
// Okay, look at the code below. Why is the first key handled separately?
// Let's assume the next mappings:
// - map ds j
// - map I 2l
// If user enters `dI`, the first `d` will be caught be this handler because it's a prefix for `ds` command.
// After the user enters `I`, the caught `d` should be processed without mapping and the rest of keys
// should be processed with mappings (to make I work)
//
// Additionally, the <Plug>mappings are not executed if the are failed to map to somethings.
// E.g.
// - map <Plug>iA someAction
// - map I <Plug>i
// For `IA` someAction should be executed.
// But if the user types `Ib`, `<Plug>i` won't be executed again. Only `b` will be passed to keyHandler.
if (mappingKeys.isEmpty()) return false;
// Well, this will always be false, but just for protection
if (fromKeys.isEmpty()) return false;
final List<KeyStroke> unhandledKeys = new ArrayList<>(fromKeys);
mappingKeys.clear(); mappingKeys.clear();
for (KeyStroke keyStroke : unhandledKeys) {
handleKey(editor, keyStroke, context, false); if (unhandledKeys.get(0).equals(parseKeys("<Plug>").get(0))) {
handleKey(editor, unhandledKeys.get(unhandledKeys.size() - 1), context);
} else {
handleKey(editor, unhandledKeys.get(0), context, false);
for (KeyStroke keyStroke : unhandledKeys.subList(1, unhandledKeys.size())) {
handleKey(editor, keyStroke, context, true);
}
} }
return false; return true;
} }
} }
@@ -415,8 +507,7 @@ public class KeyHandler {
} }
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) { private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
return (editorState.getMode() == CommandState.Mode.COMMAND || state == State.COMMAND) && return (editorState.getMode() == CommandState.Mode.COMMAND) && StringHelper.isCloseKeyStroke(key);
StringHelper.isCloseKeyStroke(key);
} }
private void handleCharArgument(@NotNull KeyStroke key, char chKey) { private void handleCharArgument(@NotNull KeyStroke key, char chKey) {
@@ -509,10 +600,8 @@ public class KeyHandler {
final Command mot = arg.getMotion(); final Command mot = arg.getMotion();
// If no count was entered for either command then nothing changes. If either had a count then // If no count was entered for either command then nothing changes. If either had a count then
// the motion gets the product of both. // the motion gets the product of both.
if (mot != null) { int cnt = cmd.getRawCount() == 0 && mot.getRawCount() == 0 ? 0 : cmd.getCount() * mot.getCount();
int cnt = cmd.getRawCount() == 0 && mot.getRawCount() == 0 ? 0 : cmd.getCount() * mot.getCount(); mot.setCount(cnt);
mot.setCount(cnt);
}
cmd.setCount(0); cmd.setCount(0);
} }
@@ -559,87 +648,81 @@ public class KeyHandler {
} }
} }
private void handleCommandNode(@NotNull Editor editor, @NotNull CommandNode node) { private void handleCommandNode(Editor editor,
// If all does well we are ready to process this command DataContext context,
state = State.READY; KeyStroke key,
// Did we just get the completed sequence for a motion command argument? @NotNull CommandNode node,
if (currentArg == Argument.Type.MOTION) { CommandState editorState) {
// We have been expecting a motion argument - is this one? // The user entered a valid command. Create the command and add it to the stack
if (node.getCmdType() == Command.Type.MOTION) { Command cmd = new Command(count, node.getAction(), node.getAction().getType(), node.getAction().getFlags(), keys);
if (!(node.getAction() instanceof MotionActionHandler) && !(node.getAction() instanceof TextObjectActionHandler)) { currentCmd.push(cmd);
throw new RuntimeException("MOTION cmd type can be used only with MotionActionHandler or TextObjectActionHandler - " +
node.getAction().getClass().getName()); if (currentArg != null && !checkArgumentCompatibility(node)) return;
}
// Create the motion command and add it to the stack if (node.getAction().getArgumentType() == null || stopMacroRecord(node, editorState)) {
Command cmd = new Command(count, node.getAction(), node.getCmdType(), node.getFlags()); state = State.READY;
cmd.setKeys(keys); }
currentCmd.push(cmd); else {
} currentArg = node.getAction().getArgumentType();
else if (node.getCmdType() == Command.Type.RESET) { startWaitingForArgument(editor, context, key.getKeyChar(), currentArg, editorState, node.getAction());
currentCmd.clear(); partialReset(editor);
Command cmd = new Command(1, node.getAction(), node.getCmdType(), node.getFlags()); }
cmd.setKeys(keys);
currentCmd.push(cmd); // TODO In the name of God, get rid of EX_STRING, FLAG_COMPLETE_EX and all the related staff
if (currentArg == Argument.Type.EX_STRING && node.getAction().getFlags().contains(CommandFlags.FLAG_COMPLETE_EX)) {
EditorActionHandlerBase action;
if (forwardSearch) {
action = new SearchEntryFwdAction();
} }
else { else {
// Oops - this wasn't a motion command. The user goofed and typed something else action = new SearchEntryRevAction();
state = State.BAD_COMMAND;
} }
}
else if (currentArg == Argument.Type.EX_STRING && node.getFlags().contains(CommandFlags.FLAG_COMPLETE_EX)) {
String text = VimPlugin.getProcess().endSearchCommand(editor); String text = VimPlugin.getProcess().endSearchCommand(editor);
currentCmd.pop();
Argument arg = new Argument(text); Argument arg = new Argument(text);
Command cmd = currentCmd.peek(); cmd = new Command(count, action, action.getType(), action.getFlags(), keys);
cmd.setArgument(arg); cmd.setArgument(arg);
CommandState.getInstance(editor).popState();
}
// The user entered a valid command that doesn't take any arguments
else {
// Create the command and add it to the stack
Command cmd = new Command(count, node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd); currentCmd.push(cmd);
CommandState.getInstance(editor).popState();
} }
} }
private boolean handleArgumentNode(@NotNull Editor editor, private boolean stopMacroRecord(CommandNode node, @NotNull CommandState editorState) {
@NotNull KeyStroke key, return editorState.isRecording() && node.getAction() instanceof ToggleRecordingAction;
@NotNull DataContext context, }
@NotNull CommandState editorState,
@NotNull ArgumentNode node) { private void startWaitingForArgument(Editor editor,
// Create a new command based on what the user has typed so far, excluding this keystroke. DataContext context,
Command cmd = new Command(count, node.getAction(), node.getCmdType(), node.getFlags()); char key,
cmd.setKeys(keys); @NotNull Argument.Type argument,
currentCmd.push(cmd); CommandState editorState,
// What type of argument does this command expect? EditorActionHandlerBase action) {
switch (node.getArgType()) { switch (argument) {
case DIGRAPH:
//digraphState = 0;
digraph = new DigraphSequence();
// No break - fall through
case CHARACTER: case CHARACTER:
case DIGRAPH:
digraph = new DigraphSequence();
state = State.CHAR_OR_DIGRAPH;
break;
case MOTION: case MOTION:
state = State.NEW_COMMAND; editorState.pushState(editorState.getMode(), editorState.getSubMode(), MappingMode.OP_PENDING);
currentArg = node.getArgType();
// Is the current command an operator? If so set the state to only accept "operator pending"
// commands
if (node.getFlags().contains(CommandFlags.FLAG_OP_PEND)) {
editorState.pushState(editorState.getMode(), editorState.getSubMode(), MappingMode.OP_PENDING);
}
break; break;
case EX_STRING: case EX_STRING:
break; forwardSearch = !(action instanceof SearchEntryRevAction);
default:
// Oops - we aren't expecting any other type of argument
state = State.ERROR;
}
// If the current keystroke is really the first character of an argument the user needs to enter, VimPlugin.getProcess().startSearchCommand(editor, context, count, key);
// recursively go back and handle this keystroke again with all the state properly updated to state = State.NEW_COMMAND;
// handle the argument editorState.pushState(CommandState.Mode.CMD_LINE, CommandState.SubMode.NONE, MappingMode.CMD_LINE);
if (currentArg != Argument.Type.NONE) { currentCmd.pop();
partialReset(editor); }
handleKey(editor, key, context); }
private boolean checkArgumentCompatibility(@NotNull CommandNode node) {
if (currentArg == Argument.Type.MOTION &&
node.getAction().getType() != Command.Type.MOTION &&
!(node.getAction() instanceof ExEntryAction)) {
state = State.BAD_COMMAND;
return false; return false;
} }
return true; return true;
@@ -657,37 +740,6 @@ public class KeyHandler {
return action != null && executeAction(action, context); return action != null && executeAction(action, context);
} }
private void handleBranchNode(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull CommandState editorState,
char key,
@NotNull BranchNode node) {
// Flag that we aren't allowing any more count digits (unless it's OK)
if (!node.getFlags().contains(CommandFlags.FLAG_ALLOW_MID_COUNT)) {
state = State.COMMAND;
}
editorState.setCurrentNode(node);
ArgumentNode arg = (ArgumentNode)((BranchNode)editorState.getCurrentNode()).getArgumentNode();
if (arg != null) {
if (currentArg == Argument.Type.MOTION && arg.getCmdType() != Command.Type.MOTION) {
editorState.popState();
state = State.BAD_COMMAND;
return;
}
if (editorState.isRecording() && arg.getFlags().contains(CommandFlags.FLAG_NO_ARG_RECORDING)) {
handleKey(editor, KeyStroke.getKeyStroke(' '), context);
}
if (arg.getArgType() == Argument.Type.EX_STRING) {
VimPlugin.getProcess().startSearchCommand(editor, context, count, key);
state = State.NEW_COMMAND;
currentArg = Argument.Type.EX_STRING;
editorState.pushState(CommandState.Mode.EX_ENTRY, CommandState.SubMode.NONE, MappingMode.CMD_LINE);
}
}
}
/** /**
* Partially resets the state of this handler. Resets the command count, clears the key list, resets the key tree * Partially resets the state of this handler. Resets the command count, clears the key list, resets the key tree
* node to the root for the current mode we are in. * node to the root for the current mode we are in.
@@ -712,7 +764,7 @@ public class KeyHandler {
partialReset(editor); partialReset(editor);
state = State.NEW_COMMAND; state = State.NEW_COMMAND;
currentCmd.clear(); currentCmd.clear();
currentArg = Argument.Type.NONE; currentArg = null;
digraph = null; digraph = null;
} }
@@ -729,11 +781,16 @@ public class KeyHandler {
lastChar = 0; lastChar = 0;
lastWasBS = false; lastWasBS = false;
VimPlugin.getRegister().resetRegister(); VimPlugin.getRegister().resetRegister();
if (editor != null) {
VisualGroupKt.updateCaretState(editor);
editor.getSelectionModel().removeSelection();
}
} }
// This method is copied from com.intellij.openapi.editor.actionSystem.EditorAction.getProjectAwareDataContext // This method is copied from com.intellij.openapi.editor.actionSystem.EditorAction.getProjectAwareDataContext
@NotNull @NotNull
private static DataContext getProjectAwareDataContext(@NotNull final Editor editor, @NotNull final DataContext original) { private static DataContext getProjectAwareDataContext(@NotNull final Editor editor,
@NotNull final DataContext original) {
if (PROJECT.getData(original) == editor.getProject()) { if (PROJECT.getData(original) == editor.getProject()) {
return new DialogAwareDataContext(original); return new DialogAwareDataContext(original);
} }
@@ -828,18 +885,26 @@ public class KeyHandler {
} }
private enum State { private enum State {
NEW_COMMAND, COMMAND, READY, ERROR, BAD_COMMAND /** Awaiting a new command */
NEW_COMMAND,
// TODO This should be probably processed in some better way
/** Awaiting for char or digraph input. In this mode mappings doesn't work (even for <C-K>) */
CHAR_OR_DIGRAPH,
READY,
BAD_COMMAND
} }
private int count; private int count;
private List<KeyStroke> keys; private List<KeyStroke> keys;
private State state; private State state;
@NotNull private final Stack<Command> currentCmd = new Stack<>(); @NotNull private final Stack<Command> currentCmd = new Stack<>();
@NotNull private Argument.Type currentArg; @Nullable private Argument.Type currentArg;
private TypedActionHandler origHandler; private TypedActionHandler origHandler;
@Nullable private DigraphSequence digraph = null; @Nullable private DigraphSequence digraph = null;
private char lastChar; private char lastChar;
private boolean lastWasBS; private boolean lastWasBS;
private boolean forwardSearch = true;
private static KeyHandler instance; private static KeyHandler instance;
} }

View File

@@ -0,0 +1,256 @@
package com.maddyhome.idea.vim
import com.intellij.ide.BrowserUtil
import com.intellij.ide.DataManager
import com.intellij.ide.plugins.InstalledPluginsState
import com.intellij.ide.plugins.PluginManager
import com.intellij.ide.plugins.PluginManagerMain
import com.intellij.ide.plugins.RepositoryHelper
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.options.ShowSettingsUtil
import com.intellij.openapi.progress.PerformInBackgroundOption
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.Task
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.ui.popup.ListPopup
import com.intellij.openapi.updateSettings.impl.PluginDownloader
import com.intellij.openapi.updateSettings.impl.UpdateChecker
import com.intellij.openapi.updateSettings.impl.UpdateInstaller
import com.intellij.openapi.updateSettings.impl.UpdateSettings
import com.intellij.openapi.util.Ref
import com.intellij.openapi.wm.StatusBar
import com.intellij.openapi.wm.StatusBarWidget
import com.intellij.openapi.wm.StatusBarWidgetProvider
import com.intellij.ui.awt.RelativePoint
import com.intellij.util.Consumer
import com.intellij.util.text.VersionComparatorUtil
import com.maddyhome.idea.vim.group.NotificationService
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable
import icons.VimIcons
import java.awt.Point
import java.awt.event.MouseEvent
import javax.swing.Icon
import javax.swing.SwingConstants
private class StatusBarIconProvider : StatusBarWidgetProvider {
override fun getWidget(project: Project) = VimStatusBar
}
private object VimStatusBar : StatusBarWidget, StatusBarWidget.IconPresentation {
private var statusBar: StatusBar? = null
override fun ID(): String = "IdeaVim-Icon"
override fun install(statusBar: StatusBar) {
this.statusBar = statusBar
}
override fun dispose() {}
override fun getTooltipText() = "IdeaVim"
override fun getIcon(): Icon = if (VimPlugin.isEnabled()) VimIcons.IDEAVIM else VimIcons.IDEAVIM_DISABLED
override fun getClickConsumer() = Consumer<MouseEvent> { event ->
val component = event.component
val popup = VimActionsPopup.getPopup(DataManager.getInstance().getDataContext(component))
val dimension = popup.content.preferredSize
// Trying to find the best position. 16 - size of the icon, 1 - height of the delimiter
val at = Point(-dimension.width + 16, -dimension.height - 1)
popup.show(RelativePoint(component, at))
}
// TODO [VERSION UPDATE] After 193 use `getPresentation()`
@Suppress("DEPRECATION", "UnstableApiUsage")
override fun getPresentation(type: StatusBarWidget.PlatformType): StatusBarWidget.WidgetPresentation? = this
fun update() {
statusBar?.updateWidget(this.ID())
}
}
class VimActions : DumbAwareAction() {
companion object {
const val actionPlace = "VimActionsPopup"
}
override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return
VimActionsPopup.getPopup(e.dataContext).showCenteredInCurrentWindow(project)
}
override fun update(e: AnActionEvent) {
val project = e.project
e.presentation.isEnabledAndVisible = project != null && !project.isDisposed
}
}
private object VimActionsPopup {
fun getPopup(dataContext: DataContext): ListPopup {
val actions = getActions()
val popup = JBPopupFactory.getInstance()
.createActionGroupPopup("IdeaVim", actions,
dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false,
VimActions.actionPlace)
popup.setAdText("Version ${VimPlugin.getVersion()}", SwingConstants.CENTER)
return popup
}
private fun getActions(): DefaultActionGroup {
val actionGroup = DefaultActionGroup()
actionGroup.isPopup = true
actionGroup.add(ActionManager.getInstance().getAction("VimPluginToggle"))
actionGroup.addSeparator()
actionGroup.add(NotificationService.OpenIdeaVimRcAction(null))
actionGroup.add(ShortcutConflictsSettings)
actionGroup.addSeparator()
val eapGroup = DefaultActionGroup("EAP" + if (JoinEap.eapActive()) " (Active)" else "", true)
eapGroup.add(JoinEap)
eapGroup.add(HelpLink("About EAP...", "https://github.com/JetBrains/ideavim#get-early-access", null))
actionGroup.add(eapGroup)
val helpGroup = DefaultActionGroup("Contacts && Help", true)
helpGroup.add(HelpLink("Contact on Twitter", "https://twitter.com/ideavim", VimIcons.TWITTER))
helpGroup.add(HelpLink("Create an Issue", "https://youtrack.jetbrains.com/issues/VIM", VimIcons.YOUTRACK))
helpGroup.add(HelpLink("Contribute on GitHub", "https://github.com/JetBrains/ideavim", VimIcons.GITHUB))
actionGroup.add(helpGroup)
return actionGroup
}
}
private class HelpLink(
name: String,
val link: String,
icon: Icon?
) : DumbAwareAction(name, null, icon) {
override fun actionPerformed(e: AnActionEvent) {
BrowserUtil.browse(link)
}
}
private object ShortcutConflictsSettings : DumbAwareAction("Settings...") {
override fun actionPerformed(e: AnActionEvent) {
ShowSettingsUtil.getInstance().editConfigurable(e.project, VimEmulationConfigurable())
}
}
private object JoinEap : DumbAwareAction() {
private const val EAP_LINK = "https://plugins.jetbrains.com/plugins/eap/ideavim"
fun eapActive() = EAP_LINK in UpdateSettings.getInstance().storedPluginHosts
override fun actionPerformed(e: AnActionEvent) {
if (eapActive()) {
UpdateSettings.getInstance().storedPluginHosts -= EAP_LINK
VimPlugin.getNotifications(e.project).notifyEapFinished()
} else {
UpdateSettings.getInstance().storedPluginHosts += EAP_LINK
checkForUpdates(e.project)
}
}
override fun update(e: AnActionEvent) {
if (eapActive()) {
e.presentation.text = "Finish EAP"
} else {
e.presentation.text = "Get Early Access..."
}
}
private fun checkForUpdates(project: Project?) {
val notificator = VimPlugin.getNotifications(project)
val pluginRef = Ref.create<PluginDownloader>()
object : Task.Backgroundable(null, "Checking for IdeaVim EAP version", true) {
override fun run(indicator: ProgressIndicator) {
val downloaders = mutableListOf<PluginDownloader>()
val build = ApplicationInfo.getInstance().build
for (host in RepositoryHelper.getPluginHosts()) {
val newPluginDescriptor = RepositoryHelper
.loadPlugins(host, null, indicator)
.filter { it.pluginId == VimPlugin.getPluginId() }
.maxWith(java.util.Comparator { o1, o2 -> VersionComparatorUtil.compare(o1.version, o2.version) })
?: continue
downloaders += PluginDownloader.createDownloader(newPluginDescriptor, host, build)
}
val plugin = downloaders.maxWith(java.util.Comparator { o1, o2 -> VersionComparatorUtil.compare(o1.pluginVersion, o2.pluginVersion) })
pluginRef.set(plugin)
}
override fun onSuccess() {
val downloader: PluginDownloader = pluginRef.get() ?: run {
notificator.notifySubscribedToEap()
return
}
val currentVersion = PluginManager.getPlugin(VimPlugin.getPluginId())?.version ?: ""
if (VersionComparatorUtil.compare(downloader.pluginVersion, currentVersion) <= 0) {
notificator.notifySubscribedToEap()
return
}
val version = downloader.pluginVersion
val message = "Do you want to install the EAP version of IdeaVim?"
@Suppress("MoveVariableDeclarationIntoWhen")
val res = Messages.showYesNoCancelDialog(project, message, "IdeaVim $version", null)
when (res) {
Messages.YES -> updatePlugin(project, downloader)
Messages.NO -> notificator.notifySubscribedToEap()
Messages.CANCEL -> if (eapActive()) UpdateSettings.getInstance().storedPluginHosts -= EAP_LINK
}
}
override fun onCancel() {
notificator.notifySubscribedToEap()
}
override fun onThrowable(error: Throwable) {
notificator.notifySubscribedToEap()
}
}.queue()
}
private fun updatePlugin(project: Project?, downloader: PluginDownloader) {
val notificator = VimPlugin.getNotifications(project)
return object : Task.Backgroundable(null, "Plugin Updates", true, PerformInBackgroundOption.DEAF) {
private var updated = false
override fun run(indicator: ProgressIndicator) {
val state = InstalledPluginsState.getInstance()
state.onDescriptorDownload(downloader.descriptor)
UpdateChecker.checkAndPrepareToInstall(downloader, state, mutableMapOf(VimPlugin.getPluginId() to downloader), mutableListOf(), indicator)
updated = UpdateInstaller.installPluginUpdates(listOf(downloader), indicator)
}
override fun onSuccess() {
if (updated) {
PluginManagerMain.notifyPluginsUpdated(null)
} else {
notificator.notifyFailedToDownloadEap()
}
}
override fun onCancel() {
notificator.notifyFailedToDownloadEap()
}
override fun onThrowable(error: Throwable) {
notificator.notifyFailedToDownloadEap()
}
}.queue()
}
}

View File

@@ -18,6 +18,7 @@
package com.maddyhome.idea.vim package com.maddyhome.idea.vim
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.PersistentStateComponent import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.RoamingType import com.intellij.openapi.components.RoamingType
import com.intellij.openapi.components.State import com.intellij.openapi.components.State
@@ -56,13 +57,10 @@ class VimLocalConfig : PersistentStateComponent<Element> {
VimPlugin.getHistory().readData(state) VimPlugin.getHistory().readData(state)
} }
// Disable multithreading for EAP release
setup()
/*
if (ApplicationManager.getApplication().isUnitTestMode) { if (ApplicationManager.getApplication().isUnitTestMode) {
setup()
} else { } else {
ApplicationManager.getApplication().executeOnPooledThread(setup) ApplicationManager.getApplication().executeOnPooledThread(setup)
} }
*/
} }
} }

View File

@@ -44,11 +44,11 @@ import com.intellij.openapi.wm.WindowManager;
import com.intellij.util.io.HttpRequests; import com.intellij.util.io.HttpRequests;
import com.maddyhome.idea.vim.ex.CommandParser; import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser; import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser;
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar;
import com.maddyhome.idea.vim.group.*; import com.maddyhome.idea.vim.group.*;
import com.maddyhome.idea.vim.group.copy.PutGroup; import com.maddyhome.idea.vim.group.copy.PutGroup;
import com.maddyhome.idea.vim.group.copy.YankGroup; import com.maddyhome.idea.vim.group.copy.YankGroup;
import com.maddyhome.idea.vim.group.visual.VisualMotionGroup; import com.maddyhome.idea.vim.group.visual.VisualMotionGroup;
import com.maddyhome.idea.vim.helper.DocumentManager;
import com.maddyhome.idea.vim.helper.MacKeyRepeat; import com.maddyhome.idea.vim.helper.MacKeyRepeat;
import com.maddyhome.idea.vim.listener.VimListenerManager; import com.maddyhome.idea.vim.listener.VimListenerManager;
import com.maddyhome.idea.vim.option.OptionsManager; import com.maddyhome.idea.vim.option.OptionsManager;
@@ -284,6 +284,7 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
getKey().saveData(element); getKey().saveData(element);
getEditor().saveData(element); getEditor().saveData(element);
this.state.saveData(element);
return element; return element;
} }
@@ -303,9 +304,6 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
getSearch().turnOn(); getSearch().turnOn();
VimListenerManager.INSTANCE.turnOn(); VimListenerManager.INSTANCE.turnOn();
// Add some listeners so we can handle special events
DocumentManager.getInstance().addDocumentListener(MarkGroup.MarkUpdater.INSTANCE);
DocumentManager.getInstance().addDocumentListener(SearchGroup.DocumentSearchListener.INSTANCE);
Runnable asyncSetup = () -> { Runnable asyncSetup = () -> {
// Register vim actions in command mode // Register vim actions in command mode
@@ -314,6 +312,9 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
// Register ex handlers // Register ex handlers
CommandParser.getInstance().registerHandlers(); CommandParser.getInstance().registerHandlers();
// Register extensions
VimExtensionRegistrar.registerExtensions();
if (!ApplicationManager.getApplication().isUnitTestMode()) { if (!ApplicationManager.getApplication().isUnitTestMode()) {
final File ideaVimRc = VimScriptParser.findIdeaVimRc(); final File ideaVimRc = VimScriptParser.findIdeaVimRc();
if (ideaVimRc != null) { if (ideaVimRc != null) {
@@ -324,14 +325,11 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
Initialization.initialized(); Initialization.initialized();
}; };
// Disable multithreading for EAP release
asyncSetup.run();
/*
if (ApplicationManager.getApplication().isUnitTestMode()) { if (ApplicationManager.getApplication().isUnitTestMode()) {
asyncSetup.run();
} else { } else {
ApplicationManager.getApplication().executeOnPooledThread(asyncSetup); ApplicationManager.getApplication().executeOnPooledThread(asyncSetup);
} }
*/
} }
@NotNull @NotNull
@@ -364,6 +362,8 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
if (enabled) { if (enabled) {
getInstance().turnOnPlugin(); getInstance().turnOnPlugin();
} }
VimStatusBar.INSTANCE.update();
} }
public static boolean isError() { public static boolean isError() {
@@ -520,14 +520,10 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
this.state.readData(element); this.state.readData(element);
}; };
// Disable multithreading for EAP release
setup.run();
/*
if (ApplicationManager.getApplication().isUnitTestMode()) { if (ApplicationManager.getApplication().isUnitTestMode()) {
setup.run(); setup.run();
} else { } else {
ApplicationManager.getApplication().executeOnPooledThread(setup); ApplicationManager.getApplication().executeOnPooledThread(setup);
} }
*/
} }
} }

View File

@@ -10,7 +10,6 @@ import kotlin.reflect.KProperty
class VimState { class VimState {
var isIdeaJoinNotified by StateProperty("idea-join") var isIdeaJoinNotified by StateProperty("idea-join")
var isIdeaPutNotified by StateProperty("idea-put") var isIdeaPutNotified by StateProperty("idea-put")
var isTemplateInSelectModeNotified by StateProperty("template-selectmode")
fun readData(element: Element) { fun readData(element: Element) {
val notifications = element.getChild("notifications") val notifications = element.getChild("notifications")

View File

@@ -73,7 +73,7 @@ public class VimTypedActionHandler implements TypedActionHandlerEx {
} }
} }
else { else {
try (final VimListenerSuppressor ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) { try (VimListenerSuppressor.Locked ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) {
TypedActionHandler origHandler = handler.getOriginalHandler(); TypedActionHandler origHandler = handler.getOriginalHandler();
origHandler.execute(editor, charTyped, context); origHandler.execute(editor, charTyped, context);
} }

View File

@@ -35,7 +35,7 @@ public class ExEntryAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull

View File

@@ -37,7 +37,7 @@ public class ResetModeAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NO; return MappingMode.ALL;
} }
@NotNull @NotNull

View File

@@ -16,38 +16,29 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package com.maddyhome.idea.vim.action; package com.maddyhome.idea.vim.action
import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.project.DumbAwareToggleAction
import com.intellij.openapi.project.DumbAware; import com.maddyhome.idea.vim.VimActions
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin
import org.jetbrains.annotations.NotNull;
/** /**
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option * This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
* but could also be used as a toolbar item. * but could also be used as a toolbar item.
*/ */
public class VimPluginToggleAction extends ToggleAction implements DumbAware { class VimPluginToggleAction : DumbAwareToggleAction() {
/** override fun isSelected(event: AnActionEvent): Boolean = VimPlugin.isEnabled()
* Indicates if the toggle is on or off
* override fun setSelected(event: AnActionEvent, b: Boolean) {
* @param event The event that triggered the action VimPlugin.setEnabled(b)
* @return true if the toggle is on, false if off
*/
@Override
public boolean isSelected(@NotNull AnActionEvent event) {
return VimPlugin.isEnabled();
} }
/** override fun update(e: AnActionEvent) {
* Specifies whether the toggle should be on or off super.update(e)
*
* @param event The event that triggered the action e.presentation.text = if (VimActions.actionPlace == e.place) {
* @param b The new state - true is on, false is off if (VimPlugin.isEnabled()) "Enabled" else "Enable"
*/ } else "Vim Emulator"
@Override
public void setSelected(@NotNull AnActionEvent event, boolean b) {
VimPlugin.setEnabled(b);
} }
} }

View File

@@ -39,6 +39,7 @@ import com.maddyhome.idea.vim.helper.CommandStateHelper;
import com.maddyhome.idea.vim.helper.EditorDataContext; import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.helper.EditorHelper; import com.maddyhome.idea.vim.helper.EditorHelper;
import com.maddyhome.idea.vim.key.ShortcutOwner; import com.maddyhome.idea.vim.key.ShortcutOwner;
import com.maddyhome.idea.vim.listener.IdeaSpecifics;
import com.maddyhome.idea.vim.option.ListOption; import com.maddyhome.idea.vim.option.ListOption;
import com.maddyhome.idea.vim.option.OptionsManager; import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -133,6 +134,7 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
// Workaround for smart step into // Workaround for smart step into
final Key<?> SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA"); final Key<?> SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA");
if (SMART_STEP_INPLACE_DATA != null && editor.getUserData(SMART_STEP_INPLACE_DATA) != null) return false; if (SMART_STEP_INPLACE_DATA != null && editor.getUserData(SMART_STEP_INPLACE_DATA) != null) return false;
if (IdeaSpecifics.INSTANCE.aceJumpActive()) return false;
final int keyCode = keyStroke.getKeyCode(); final int keyCode = keyStroke.getKeyCode();
if (LookupManager.getActiveLookup(editor) != null && !passCommandToVimWithLookup(keyStroke)) { if (LookupManager.getActiveLookup(editor) != null && !passCommandToVimWithLookup(keyStroke)) {

View File

@@ -32,7 +32,6 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -67,12 +66,6 @@ final public class OperatorAction extends VimActionHandler.SingleExecution {
return Argument.Type.MOTION; return Argument.Type.MOTION;
} }
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@Override @Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final OperatorFunction operatorFunction = VimPlugin.getKey().getOperatorFunction(); final OperatorFunction operatorFunction = VimPlugin.getKey().getOperatorFunction();
@@ -80,16 +73,14 @@ final public class OperatorAction extends VimActionHandler.SingleExecution {
final Argument argument = cmd.getArgument(); final Argument argument = cmd.getArgument();
if (argument != null) { if (argument != null) {
final Command motion = argument.getMotion(); final Command motion = argument.getMotion();
if (motion != null) { final TextRange range = MotionGroup
final TextRange range = MotionGroup .getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(),
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(), cmd.getRawCount(), argument);
cmd.getRawCount(), argument, true); if (range != null) {
if (range != null) { VimPlugin.getMark().setChangeMarks(editor, range);
VimPlugin.getMark().setChangeMarks(editor, range); final SelectionType selectionType = SelectionType.fromCommandFlags(motion.getFlags());
final SelectionType selectionType = SelectionType.fromCommandFlags(motion.getFlags()); KeyHandler.getInstance().reset(editor);
KeyHandler.getInstance().reset(editor); return operatorFunction.apply(editor, context, selectionType);
return operatorFunction.apply(editor, context, selectionType);
}
} }
} }
return false; return false;

View File

@@ -64,9 +64,7 @@ public class RepeatChangeAction extends VimActionHandler.SingleExecution {
Argument arg = cmd.getArgument(); Argument arg = cmd.getArgument();
if (arg != null) { if (arg != null) {
Command mot = arg.getMotion(); Command mot = arg.getMotion();
if (mot != null) { mot.setCount(0);
mot.setCount(0);
}
} }
} }
Command save = state.getCommand(); Command save = state.getCommand();

View File

@@ -1,64 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.ExException;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class RepeatExCommandAction extends VimActionHandler.SingleExecution {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("@:");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
int count = command.getCount();
try {
return CommandParser.getInstance().processLastCommand(editor, context, count);
}
catch (ExException e) {
return false;
}
}
}

View File

@@ -27,9 +27,14 @@ import com.maddyhome.idea.vim.helper.UndoRedoHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
import java.awt.event.KeyEvent;
import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
public class UndoAction extends VimActionHandler.SingleExecution { public class UndoAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@@ -41,7 +46,10 @@ public class UndoAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public Set<List<KeyStroke>> getKeyStrokesSet() { public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("u", "<Undo>"); Set<List<KeyStroke>> keys = new HashSet<>();
keys.add(parseKeys("u"));
keys.add(Collections.singletonList(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0)));
return keys;
} }
@NotNull @NotNull

View File

@@ -43,7 +43,7 @@ final public class AutoIndentLinesVisualAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -56,12 +56,6 @@ public class ChangeCaseLowerMotionAction extends ChangeEditorActionHandler.ForEa
return Command.Type.CHANGE; return Command.Type.CHANGE;
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@NotNull @NotNull
@Override @Override
public Argument.Type getArgumentType() { public Argument.Type getArgumentType() {

View File

@@ -45,7 +45,7 @@ final public class ChangeCaseLowerVisualAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -62,12 +62,6 @@ public class ChangeCaseToggleMotionAction extends ChangeEditorActionHandler.ForE
return Argument.Type.MOTION; return Argument.Type.MOTION;
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@Override @Override
public boolean execute(@NotNull Editor editor, public boolean execute(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,

View File

@@ -44,7 +44,7 @@ final public class ChangeCaseToggleVisualAction extends VisualOperatorActionHand
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -62,12 +62,6 @@ public class ChangeCaseUpperMotionAction extends ChangeEditorActionHandler.ForEa
return Argument.Type.MOTION; return Argument.Type.MOTION;
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@Override @Override
public boolean execute(@NotNull Editor editor, public boolean execute(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,

View File

@@ -44,7 +44,7 @@ final public class ChangeCaseUpperVisualAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -46,7 +46,7 @@ public class ChangeLineAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull @NotNull
@Override @Override
public Set<List<KeyStroke>> getKeyStrokesSet() { public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("cc", "S"); return parseKeysSet("S");
} }
@NotNull @NotNull
@@ -58,7 +58,7 @@ public class ChangeLineAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_ALLOW_MID_COUNT, CommandFlags.FLAG_MULTIKEY_UNDO); return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_MULTIKEY_UNDO);
} }
@Override @Override

View File

@@ -57,14 +57,14 @@ public class ChangeMotionAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public Argument.Type getArgumentType() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND, CommandFlags.FLAG_MULTIKEY_UNDO); return Argument.Type.MOTION;
} }
@NotNull @NotNull
@Override @Override
public Argument.Type getArgumentType() { public EnumSet<CommandFlags> getFlags() {
return Argument.Type.MOTION; return EnumSet.of(CommandFlags.FLAG_DUPLICABLE_OPERATOR);
} }
@Override @Override

View File

@@ -43,7 +43,7 @@ final public class ChangeVisualAction extends VisualOperatorActionHandler.ForEac
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -44,7 +44,7 @@ final public class ChangeVisualCharacterAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -46,7 +46,7 @@ final public class ChangeVisualLinesAction extends VisualOperatorActionHandler.F
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -46,7 +46,7 @@ final public class ChangeVisualLinesEndAction extends VisualOperatorActionHandle
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -1,59 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class FilterCountLinesAction extends VimActionHandler.SingleExecution {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("!!");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
return true;
}
}

View File

@@ -1,131 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change;
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.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.MotionGroup;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class FilterMotionAction extends VimActionHandler.SingleExecution {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("!");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final Argument argument = cmd.getArgument();
if (argument == null) {
return false;
}
TextRange range = MotionGroup
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(), cmd.getRawCount(),
argument, false);
if (range == null) {
return false;
}
LogicalPosition current = editor.getCaretModel().getLogicalPosition();
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
if (current.line != start.line) {
MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), range.getStartOffset());
}
int count;
if (start.line < end.line) {
count = end.line - start.line + 1;
}
else {
count = 1;
}
Command command = new Command(count, new EmptyAction(), Command.Type.UNDEFINED, EnumSet.noneOf(CommandFlags.class));
VimPlugin.getProcess().startFilterCommand(editor, context, command);
return true;
}
private static class EmptyAction extends VimActionHandler.SingleExecution {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return Collections.emptySet();
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return Collections.emptySet();
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return false;
}
}
}

View File

@@ -0,0 +1,68 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.endOffsetInclusive
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import javax.swing.KeyStroke
class FilterMotionAction : VimActionHandler.SingleExecution() {
override val mappingModes: Set<MappingMode> = MappingMode.N
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("!")
override val type: Command.Type = Command.Type.CHANGE
override val argumentType: Argument.Type = Argument.Type.MOTION
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_DUPLICABLE_OPERATOR)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
val argument = cmd.argument ?: return false
val range = MotionGroup
.getMotionRange(editor, editor.caretModel.primaryCaret, context, cmd.count, cmd.rawCount,
argument)
?: return false
val current = editor.caretModel.logicalPosition
val start = editor.offsetToLogicalPosition(range.startOffset)
val end = editor.offsetToLogicalPosition(range.endOffsetInclusive)
if (current.line != start.line) {
MotionGroup.moveCaret(editor, editor.caretModel.primaryCaret, range.startOffset)
}
val count = if (start.line < end.line) end.line - start.line + 1 else 1
VimPlugin.getProcess().startFilterCommand(editor, context, Argument.EMPTY_COMMAND.copy(rawCount = count))
return true
}
}

View File

@@ -25,6 +25,7 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags; import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler; import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.ModeHelper;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -41,7 +42,7 @@ final public class FilterVisualLinesAction extends VimActionHandler.SingleExecut
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull
@@ -66,7 +67,7 @@ final public class FilterVisualLinesAction extends VimActionHandler.SingleExecut
@Override @Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getProcess().startFilterCommand(editor, context, cmd); VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
VimPlugin.getVisualMotion().exitVisual(editor); ModeHelper.exitVisualMode(editor);
return true; return true;
} }
} }

View File

@@ -43,7 +43,7 @@ final public class ReformatCodeVisualAction extends VisualOperatorActionHandler.
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -40,7 +40,7 @@ final public class ChangeVisualNumberAvalancheDecAction extends VisualOperatorAc
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -40,7 +40,7 @@ final public class ChangeVisualNumberAvalancheIncAction extends VisualOperatorAc
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -40,7 +40,7 @@ final public class ChangeVisualNumberDecAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -40,7 +40,7 @@ final public class ChangeVisualNumberIncAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -46,7 +46,7 @@ final public class DeleteJoinVisualLinesAction extends VisualOperatorActionHandl
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -46,7 +46,7 @@ final public class DeleteJoinVisualLinesSpacesAction extends VisualOperatorActio
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -1,73 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class DeleteLineAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("dd");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_ALLOW_MID_COUNT);
}
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().deleteLine(editor, caret, count);
}
}

View File

@@ -22,11 +22,10 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.*;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import kotlin.Pair;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -64,7 +63,7 @@ public class DeleteMotionAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND); return EnumSet.of(CommandFlags.FLAG_DUPLICABLE_OPERATOR);
} }
@Override @Override
@@ -74,7 +73,12 @@ public class DeleteMotionAction extends ChangeEditorActionHandler.ForEachCaret {
int count, int count,
int rawCount, int rawCount,
@Nullable Argument argument) { @Nullable Argument argument) {
return argument != null && if (argument == null) return false;
VimPlugin.getChange().deleteMotion(editor, caret, context, count, rawCount, argument, false); Pair<TextRange, SelectionType> deleteRangeAndType =
VimPlugin.getChange().getDeleteRangeAndType(editor, caret, context, count, rawCount, argument, false);
if (deleteRangeAndType == null) return false;
return VimPlugin.getChange()
.deleteRange(editor, caret, deleteRangeAndType.getFirst(), deleteRangeAndType.getSecond(), false);
} }
} }

View File

@@ -44,7 +44,7 @@ final public class DeleteVisualAction extends VisualOperatorActionHandler.ForEac
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -43,7 +43,7 @@ final public class DeleteVisualLinesAction extends VisualOperatorActionHandler.F
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -46,7 +46,7 @@ final public class DeleteVisualLinesEndAction extends VisualOperatorActionHandle
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -21,11 +21,11 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.RegisterActions; import com.maddyhome.idea.vim.RegisterActions;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase; import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.VimActionHandler; import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.ModeHelper;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -51,7 +51,7 @@ final public class InsertExitModeAction extends VimActionHandler.SingleExecution
@NotNull @NotNull
@Override @Override
final public Set<List<KeyStroke>> getKeyStrokesSet() { final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-[>", "<C-C>", "<Esc>", "<C-\\><C-N>"); return parseKeysSet("<C-[>", "<C-C>", "<Esc>");
} }
@Contract(pure = true) @Contract(pure = true)
@@ -63,7 +63,7 @@ final public class InsertExitModeAction extends VimActionHandler.SingleExecution
@Override @Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEscape(editor, context); ModeHelper.exitInsertMode(editor, context);
return true; return true;
} }
} }

View File

@@ -45,7 +45,7 @@ final public class VisualBlockAppendAction extends VisualOperatorActionHandler.S
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@Contract(pure = true) @Contract(pure = true)

View File

@@ -45,7 +45,7 @@ final public class VisualBlockInsertAction extends VisualOperatorActionHandler.S
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -1,66 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class AutoIndentLinesAction extends ChangeEditorActionHandler.ForEachCaret {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("==");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().autoIndentLines(editor, caret, context, count);
return true;
}
}

View File

@@ -59,14 +59,14 @@ public class AutoIndentMotionAction extends ChangeEditorActionHandler.ForEachCar
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public Argument.Type getArgumentType() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND); return Argument.Type.MOTION;
} }
@NotNull @NotNull
@Override @Override
public Argument.Type getArgumentType() { public EnumSet<CommandFlags> getFlags() {
return Argument.Type.MOTION; return EnumSet.of(CommandFlags.FLAG_DUPLICABLE_OPERATOR);
} }
@Override @Override

View File

@@ -51,22 +51,3 @@ class ShiftLeftLinesAction : ChangeEditorActionHandler.ForEachCaret() {
return true return true
} }
} }
class ShiftLeftLinesNormalModeAction : ChangeEditorActionHandler.ForEachCaret() {
override val mappingModes: Set<MappingMode> = MappingMode.N
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<<")
override val type: Command.Type = Command.Type.CHANGE
override fun execute(editor: Editor,
caret: Caret,
context: DataContext,
count: Int,
rawCount: Int,
argument: Argument?): Boolean {
VimPlugin.getChange().indentLines(editor, caret, context, count, -1)
return true
}
}

View File

@@ -64,7 +64,7 @@ public class ShiftLeftMotionAction extends ChangeEditorActionHandler.ForEachCare
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND); return EnumSet.of(CommandFlags.FLAG_DUPLICABLE_OPERATOR);
} }
@Override @Override

View File

@@ -43,7 +43,7 @@ final public class ShiftLeftVisualAction extends VisualOperatorActionHandler.For
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -51,17 +51,3 @@ class ShiftRightLinesAction : ChangeEditorActionHandler.ForEachCaret() {
return true return true
} }
} }
class ShiftRightLinesNormalModeAction : ChangeEditorActionHandler.ForEachCaret() {
override val mappingModes: Set<MappingMode> = MappingMode.N
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet(">>")
override val type: Command.Type = Command.Type.CHANGE
override fun execute(editor: Editor, caret: Caret, context: DataContext, count: Int,
rawCount: Int, argument: Argument?): Boolean {
VimPlugin.getChange().indentLines(editor, caret, context, count, 1)
return true
}
}

View File

@@ -64,7 +64,7 @@ public class ShiftRightMotionAction extends ChangeEditorActionHandler.ForEachCar
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND); return EnumSet.of(CommandFlags.FLAG_DUPLICABLE_OPERATOR);
} }
@Override @Override

View File

@@ -43,7 +43,7 @@ final public class ShiftRightVisualAction extends VisualOperatorActionHandler.Fo
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -36,7 +36,7 @@ import javax.swing.KeyStroke
* @author vlan * @author vlan
*/ */
class PutVisualTextAction : VisualOperatorActionHandler.SingleExecution() { class PutVisualTextAction : VisualOperatorActionHandler.SingleExecution() {
override val mappingModes: Set<MappingMode> = MappingMode.V override val mappingModes: Set<MappingMode> = MappingMode.X
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("p", "P") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("p", "P")

View File

@@ -37,7 +37,7 @@ import javax.swing.KeyStroke
*/ */
class PutVisualTextMoveCursorAction : VisualOperatorActionHandler.SingleExecution() { class PutVisualTextMoveCursorAction : VisualOperatorActionHandler.SingleExecution() {
override val mappingModes: Set<MappingMode> = MappingMode.V override val mappingModes: Set<MappingMode> = MappingMode.X
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("gp", "gP") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("gp", "gP")

View File

@@ -37,7 +37,7 @@ import javax.swing.KeyStroke
*/ */
class PutVisualTextNoIndentAction : VisualOperatorActionHandler.SingleExecution() { class PutVisualTextNoIndentAction : VisualOperatorActionHandler.SingleExecution() {
override val mappingModes: Set<MappingMode> = MappingMode.V override val mappingModes: Set<MappingMode> = MappingMode.X
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("[p", "]p", "[P", "]P") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("[p", "]p", "[P", "]P")

View File

@@ -38,7 +38,7 @@ public class SelectRegisterAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull

View File

@@ -22,11 +22,8 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.handler.VimActionHandler import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
@@ -41,17 +38,3 @@ class YankLineAction : VimActionHandler.SingleExecution() {
return VimPlugin.getYank().yankLine(editor, cmd.count) return VimPlugin.getYank().yankLine(editor, cmd.count)
} }
} }
class YankLineMidCountAction : VimActionHandler.SingleExecution() {
override val mappingModes: Set<MappingMode> = MappingMode.N
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("yy")
override val type: Command.Type = Command.Type.COPY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_ALLOW_MID_COUNT)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getYank().yankLine(editor, cmd.count)
}
}

View File

@@ -62,7 +62,7 @@ public class YankMotionAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND); return EnumSet.of(CommandFlags.FLAG_DUPLICABLE_OPERATOR);
} }
@Override @Override

View File

@@ -42,7 +42,7 @@ final public class YankVisualAction extends VisualOperatorActionHandler.SingleEx
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -43,7 +43,7 @@ final public class YankVisualLinesAction extends VisualOperatorActionHandler.Sin
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.V; return MappingMode.X;
} }
@NotNull @NotNull

View File

@@ -36,7 +36,7 @@ public class FileGetLocationInfoAction extends VimActionHandler.SingleExecution
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NV; return MappingMode.NX;
} }
@NotNull @NotNull

View File

@@ -11,7 +11,7 @@ import javax.swing.KeyStroke
class VimCollapseAllRegions : VimActionHandler.SingleExecution() { class VimCollapseAllRegions : VimActionHandler.SingleExecution() {
val actionName: String = "CollapseAllRegions" val actionName: String = "CollapseAllRegions"
override val mappingModes: Set<MappingMode> = MappingMode.NV override val mappingModes: Set<MappingMode> = MappingMode.NX
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zM") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zM")
@@ -26,7 +26,7 @@ class VimCollapseAllRegions : VimActionHandler.SingleExecution() {
class VimCollapseRegion : VimActionHandler.SingleExecution() { class VimCollapseRegion : VimActionHandler.SingleExecution() {
private val actionName: String = "CollapseRegion" private val actionName: String = "CollapseRegion"
override val mappingModes: Set<MappingMode> = MappingMode.NV override val mappingModes: Set<MappingMode> = MappingMode.NX
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zc") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zc")
@@ -41,7 +41,7 @@ class VimCollapseRegion : VimActionHandler.SingleExecution() {
class VimCollapseRegionRecursively : VimActionHandler.SingleExecution() { class VimCollapseRegionRecursively : VimActionHandler.SingleExecution() {
private val actionName: String = "CollapseRegionRecursively" private val actionName: String = "CollapseRegionRecursively"
override val mappingModes: Set<MappingMode> = MappingMode.NV override val mappingModes: Set<MappingMode> = MappingMode.NX
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zC") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zC")
@@ -56,7 +56,7 @@ class VimCollapseRegionRecursively : VimActionHandler.SingleExecution() {
class VimExpandAllRegions : VimActionHandler.SingleExecution() { class VimExpandAllRegions : VimActionHandler.SingleExecution() {
private val actionName: String = "ExpandAllRegions" private val actionName: String = "ExpandAllRegions"
override val mappingModes: Set<MappingMode> = MappingMode.NV override val mappingModes: Set<MappingMode> = MappingMode.NX
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zR") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zR")
@@ -71,7 +71,7 @@ class VimExpandAllRegions : VimActionHandler.SingleExecution() {
class VimExpandRegion : VimActionHandler.SingleExecution() { class VimExpandRegion : VimActionHandler.SingleExecution() {
private val actionName: String = "ExpandRegion" private val actionName: String = "ExpandRegion"
override val mappingModes: Set<MappingMode> = MappingMode.NV override val mappingModes: Set<MappingMode> = MappingMode.NX
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zo") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zo")
@@ -86,7 +86,7 @@ class VimExpandRegion : VimActionHandler.SingleExecution() {
class VimExpandRegionRecursively : VimActionHandler.SingleExecution() { class VimExpandRegionRecursively : VimActionHandler.SingleExecution() {
private val actionName: String = "ExpandRegionRecursively" private val actionName: String = "ExpandRegionRecursively"
override val mappingModes: Set<MappingMode> = MappingMode.NV override val mappingModes: Set<MappingMode> = MappingMode.NX
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zO") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("zO")

View File

@@ -1,60 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.macro;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class PlaybackLastRegisterAction extends VimActionHandler.SingleExecution {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("@@");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_WRITABLE;
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final Project project = PlatformDataKeys.PROJECT.getData(context);
return VimPlugin.getMacro().playbackLastRegister(editor, context, project, cmd.getCount());
}
}

View File

@@ -20,12 +20,17 @@ package com.maddyhome.idea.vim.action.macro;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.ExException;
import com.maddyhome.idea.vim.handler.VimActionHandler; import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -49,7 +54,7 @@ public class PlaybackRegisterAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public Command.Type getType() { public Command.Type getType() {
return Command.Type.OTHER_WRITABLE; return Command.Type.OTHER_SELF_SYNCHRONIZED;
} }
@NotNull @NotNull
@@ -66,6 +71,27 @@ public class PlaybackRegisterAction extends VimActionHandler.SingleExecution {
} }
final char reg = argument.getCharacter(); final char reg = argument.getCharacter();
final Project project = PlatformDataKeys.PROJECT.getData(context); final Project project = PlatformDataKeys.PROJECT.getData(context);
return VimPlugin.getMacro().playbackRegister(editor, context, project, reg, cmd.getCount()); Application application = ApplicationManager.getApplication();
Ref<Boolean> res = Ref.create(false);
if (reg == '@') {
application.runWriteAction(
() -> res.set(VimPlugin.getMacro().playbackLastRegister(editor, context, project, cmd.getCount())));
}
else if (reg == ':') {
// No write action
try {
res.set(CommandParser.getInstance().processLastCommand(editor, context, cmd.getCount()));
}
catch (ExException e) {
res.set(false);
}
}
else {
application.runWriteAction(
() -> res.set(VimPlugin.getMacro().playbackRegister(editor, context, project, reg, cmd.getCount())));
}
return res.get();
} }
} }

View File

@@ -26,17 +26,16 @@ import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
public class ToggleRecordingAction extends VimActionHandler.SingleExecution { public final class ToggleRecordingAction extends VimActionHandler.SingleExecution {
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NV; return MappingMode.NX;
} }
@NotNull @NotNull
@@ -57,12 +56,6 @@ public class ToggleRecordingAction extends VimActionHandler.SingleExecution {
return Argument.Type.CHARACTER; return Argument.Type.CHARACTER;
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_NO_ARG_RECORDING);
}
@Override @Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
if (!CommandState.getInstance(editor).isRecording()) { if (!CommandState.getInstance(editor).isRecording()) {

View File

@@ -41,12 +41,11 @@ class GnNextTextObject : TextObjectActionHandler() {
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("gn") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("gn")
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_MOT_INCLUSIVE) override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? { override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
if (caret != editor.caretModel.primaryCaret) return null if (caret != editor.caretModel.primaryCaret) return null
val range = VimPlugin.getSearch().getNextSearchRange(editor, count, true) val range = VimPlugin.getSearch().getNextSearchRange(editor, count, true)
val adj = VimPlugin.getVisualMotion().selectionAdj return range?.let { TextRange(it.startOffset, it.endOffset) }
return range?.let { TextRange(it.startOffset, it.endOffset - adj) }
} }
} }

View File

@@ -41,11 +41,10 @@ class GnPreviousTextObject : TextObjectActionHandler() {
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("gN") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("gN")
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_MOT_INCLUSIVE) override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? { override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
if (caret != editor.caretModel.primaryCaret) return null if (caret != editor.caretModel.primaryCaret) return null
val range = VimPlugin.getSearch().getNextSearchRange(editor, count, false) val range = VimPlugin.getSearch().getNextSearchRange(editor, count, false)
val adj = VimPlugin.getVisualMotion().selectionAdj return range?.let { TextRange(it.startOffset, it.endOffset) }
return range?.let { TextRange(it.startOffset, it.endOffset - adj) }
} }
} }

View File

@@ -23,6 +23,7 @@ import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags; import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -38,7 +39,7 @@ final public class VisualSelectNextSearch extends MotionActionHandler.SingleExec
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.NV; return MappingMode.NX;
} }
@NotNull @NotNull
@@ -61,4 +62,10 @@ final public class VisualSelectNextSearch extends MotionActionHandler.SingleExec
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().selectNextSearch(editor, count, true); return VimPlugin.getMotion().selectNextSearch(editor, count, true);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -23,6 +23,7 @@ import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags; import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -38,7 +39,7 @@ final public class VisualSelectPreviousSearch extends MotionActionHandler.Single
@NotNull @NotNull
@Override @Override
final public Set<MappingMode> getMappingModes() { final public Set<MappingMode> getMappingModes() {
return MappingMode.NV; return MappingMode.NX;
} }
@NotNull @NotNull
@@ -61,4 +62,11 @@ final public class VisualSelectPreviousSearch extends MotionActionHandler.Single
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().selectNextSearch(editor, count, false); return VimPlugin.getMotion().selectNextSearch(editor, count, false);
} }
@Contract(pure = true)
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -23,21 +23,20 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionArrowLeftAction : NonShiftedSpecialKeyHandler() { class MotionArrowLeftAction : NonShiftedSpecialKeyHandler() {
override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: MutableSet<MappingMode> = MappingMode.NVO override val mappingModes: MutableSet<MappingMode> = MappingMode.NXO
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(parseKeys("<Left>"), listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0))) override val keyStrokesSet: Set<List<KeyStroke>> = setOf(parseKeys("<Left>"), listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0)))
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE)
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int { override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false) return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
} }

View File

@@ -23,25 +23,23 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.enumSetOf
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionArrowRightAction : NonShiftedSpecialKeyHandler() { class MotionArrowRightAction : NonShiftedSpecialKeyHandler() {
override val mappingModes: MutableSet<MappingMode> = MappingMode.NVO override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: MutableSet<MappingMode> = MappingMode.NXO
override val keyStrokesSet: Set<List<KeyStroke>> = setOf( override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
parseKeys("<Right>"), parseKeys("<Right>"),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0)) listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0))
) )
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_EXCLUSIVE)
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int { override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, false) return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, false)
} }

View File

@@ -24,15 +24,14 @@ import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import com.maddyhome.idea.vim.helper.UserDataManager; import com.maddyhome.idea.vim.helper.UserDataManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -41,7 +40,7 @@ public class MotionColumnAction extends MotionActionHandler.ForEachCaret {
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -50,12 +49,6 @@ public class MotionColumnAction extends MotionActionHandler.ForEachCaret {
return parseKeysSet("|"); return parseKeysSet("|");
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE);
}
@Override @Override
public int getOffset(@NotNull Editor editor, public int getOffset(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,
@@ -73,4 +66,10 @@ public class MotionColumnAction extends MotionActionHandler.ForEachCaret {
@NotNull Command cmd) { @NotNull Command cmd) {
UserDataManager.setVimLastColumn(caret, cmd.getCount() - 1); UserDataManager.setVimLastColumn(caret, cmd.getCount() - 1);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -24,25 +24,24 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.group.MotionGroup import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import com.maddyhome.idea.vim.helper.inInsertMode import com.maddyhome.idea.vim.helper.inInsertMode
import com.maddyhome.idea.vim.helper.inSelectMode import com.maddyhome.idea.vim.helper.inSelectMode
import com.maddyhome.idea.vim.helper.inVisualMode import com.maddyhome.idea.vim.helper.inVisualMode
import com.maddyhome.idea.vim.helper.vimLastColumn import com.maddyhome.idea.vim.helper.vimLastColumn
import com.maddyhome.idea.vim.option.OptionsManager import com.maddyhome.idea.vim.option.OptionsManager
import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionEndAction : NonShiftedSpecialKeyHandler() { class MotionEndAction : NonShiftedSpecialKeyHandler() {
override val mappingModes: MutableSet<MappingMode> = MappingMode.NVOS override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: MutableSet<MappingMode> = MappingMode.NVO
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<End>") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<End>")
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_EXCLUSIVE)
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int,
rawCount: Int, argument: Argument?): Int { rawCount: Int, argument: Argument?): Int {
var allow = false var allow = false

View File

@@ -25,17 +25,18 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.MotionActionHandler import com.maddyhome.idea.vim.handler.MotionActionHandler
import java.util.* import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionFirstColumnAction : MotionActionHandler.ForEachCaret() { class MotionFirstColumnAction : MotionActionHandler.ForEachCaret() {
override val mappingModes: Set<MappingMode> = MappingMode.NVO override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: Set<MappingMode> = MappingMode.NXO
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("0") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("0")
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE)
override fun getOffset(editor: Editor, override fun getOffset(editor: Editor,
caret: Caret, caret: Caret,
context: DataContext, context: DataContext,
@@ -47,6 +48,8 @@ class MotionFirstColumnAction : MotionActionHandler.ForEachCaret() {
} }
class MotionFirstColumnInsertModeAction : MotionActionHandler.ForEachCaret() { class MotionFirstColumnInsertModeAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: Set<MappingMode> = MappingMode.I override val mappingModes: Set<MappingMode> = MappingMode.I
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<Home>") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<Home>")

View File

@@ -23,14 +23,13 @@ import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -38,7 +37,7 @@ public class MotionFirstNonSpaceAction extends MotionActionHandler.ForEachCaret
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -47,12 +46,6 @@ public class MotionFirstNonSpaceAction extends MotionActionHandler.ForEachCaret
return parseKeysSet("^"); return parseKeysSet("^");
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE);
}
@Override @Override
public int getOffset(@NotNull Editor editor, public int getOffset(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,
@@ -62,4 +55,10 @@ public class MotionFirstNonSpaceAction extends MotionActionHandler.ForEachCaret
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, caret); return VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, caret);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -23,13 +23,12 @@ import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -37,7 +36,7 @@ public class MotionFirstScreenColumnAction extends MotionActionHandler.ForEachCa
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -46,12 +45,6 @@ public class MotionFirstScreenColumnAction extends MotionActionHandler.ForEachCa
return parseKeysSet("g0", "g<Home>"); return parseKeysSet("g0", "g<Home>");
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE);
}
@Override @Override
public int getOffset(@NotNull Editor editor, public int getOffset(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,
@@ -61,4 +54,10 @@ public class MotionFirstScreenColumnAction extends MotionActionHandler.ForEachCa
Argument argument) { Argument argument) {
return VimPlugin.getMotion().moveCaretToLineScreenStart(editor, caret); return VimPlugin.getMotion().moveCaretToLineScreenStart(editor, caret);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -23,14 +23,13 @@ import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -38,7 +37,7 @@ public class MotionFirstScreenNonSpaceAction extends MotionActionHandler.ForEach
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -47,12 +46,6 @@ public class MotionFirstScreenNonSpaceAction extends MotionActionHandler.ForEach
return parseKeysSet("g^"); return parseKeysSet("g^");
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE);
}
@Override @Override
public int getOffset(@NotNull Editor editor, public int getOffset(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,
@@ -62,4 +55,10 @@ public class MotionFirstScreenNonSpaceAction extends MotionActionHandler.ForEach
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().moveCaretToLineScreenStartSkipLeading(editor, caret); return VimPlugin.getMotion().moveCaretToLineScreenStartSkipLeading(editor, caret);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -23,19 +23,18 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionHomeAction : NonShiftedSpecialKeyHandler() { class MotionHomeAction : NonShiftedSpecialKeyHandler() {
override val mappingModes: MutableSet<MappingMode> = MappingMode.NVS override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: MutableSet<MappingMode> = MappingMode.NV
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<Home>") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<Home>")
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_EXCLUSIVE)
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int,
rawCount: Int, argument: Argument?): Int { rawCount: Int, argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretToLineStart(editor, caret) return VimPlugin.getMotion().moveCaretToLineStart(editor, caret)

View File

@@ -27,6 +27,7 @@ import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.CommandState import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.group.MotionGroup import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.handler.MotionActionHandler import com.maddyhome.idea.vim.handler.MotionActionHandler
import com.maddyhome.idea.vim.helper.inInsertMode import com.maddyhome.idea.vim.helper.inInsertMode
@@ -36,12 +37,12 @@ import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionLastColumnAction : MotionActionHandler.ForEachCaret() { class MotionLastColumnAction : MotionActionHandler.ForEachCaret() {
override val mappingModes: Set<MappingMode> = MappingMode.NVO override val motionType: MotionType = MotionType.INCLUSIVE
override val mappingModes: Set<MappingMode> = MappingMode.NXO
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("$") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("$")
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_INCLUSIVE)
override fun getOffset(editor: Editor, override fun getOffset(editor: Editor,
caret: Caret, caret: Caret,
context: DataContext, context: DataContext,
@@ -77,6 +78,8 @@ class MotionLastColumnAction : MotionActionHandler.ForEachCaret() {
} }
class MotionLastColumnInsertAction : MotionActionHandler.ForEachCaret() { class MotionLastColumnInsertAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: Set<MappingMode> = MappingMode.I override val mappingModes: Set<MappingMode> = MappingMode.I
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<End>") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("<End>")

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -36,7 +37,7 @@ public class MotionLastMatchCharAction extends MotionActionHandler.ForEachCaret
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -54,4 +55,10 @@ public class MotionLastMatchCharAction extends MotionActionHandler.ForEachCaret
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().repeatLastMatchChar(editor, caret, count); return VimPlugin.getMotion().repeatLastMatchChar(editor, caret, count);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -36,7 +37,7 @@ public class MotionLastMatchCharReverseAction extends MotionActionHandler.ForEac
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -54,4 +55,10 @@ public class MotionLastMatchCharReverseAction extends MotionActionHandler.ForEac
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().repeatLastMatchChar(editor, caret, -count); return VimPlugin.getMotion().repeatLastMatchChar(editor, caret, -count);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

View File

@@ -23,14 +23,13 @@ import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -38,7 +37,7 @@ public class MotionLastNonSpaceAction extends MotionActionHandler.ForEachCaret {
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -47,12 +46,6 @@ public class MotionLastNonSpaceAction extends MotionActionHandler.ForEachCaret {
return parseKeysSet("g_"); return parseKeysSet("g_");
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_INCLUSIVE);
}
@Override @Override
public int getOffset(@NotNull Editor editor, public int getOffset(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,
@@ -62,4 +55,10 @@ public class MotionLastNonSpaceAction extends MotionActionHandler.ForEachCaret {
@Nullable Argument argument) { @Nullable Argument argument) {
return VimPlugin.getMotion().moveCaretToLineEndSkipLeadingOffset(editor, caret, count - 1); return VimPlugin.getMotion().moveCaretToLineEndSkipLeadingOffset(editor, caret, count - 1);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.INCLUSIVE;
}
} }

View File

@@ -32,7 +32,6 @@ import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -40,7 +39,7 @@ public class MotionLastScreenColumnAction extends MotionActionHandler.ForEachCar
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -49,12 +48,6 @@ public class MotionLastScreenColumnAction extends MotionActionHandler.ForEachCar
return parseKeysSet("g$", "g<End>"); return parseKeysSet("g$", "g<End>");
} }
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_INCLUSIVE);
}
@Override @Override
public int getOffset(@NotNull Editor editor, public int getOffset(@NotNull Editor editor,
@NotNull Caret caret, @NotNull Caret caret,
@@ -83,4 +76,10 @@ public class MotionLastScreenColumnAction extends MotionActionHandler.ForEachCar
@NotNull Command cmd) { @NotNull Command cmd) {
UserDataManager.setVimLastColumn(caret, MotionGroup.LAST_COLUMN); UserDataManager.setVimLastColumn(caret, MotionGroup.LAST_COLUMN);
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.INCLUSIVE;
}
} }

View File

@@ -23,21 +23,19 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.MotionActionHandler import com.maddyhome.idea.vim.handler.MotionActionHandler
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke import javax.swing.KeyStroke
class MotionLeftAction : MotionActionHandler.ForEachCaret() { class MotionLeftAction : MotionActionHandler.ForEachCaret() {
override val mappingModes: Set<MappingMode> = MappingMode.NVO override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: Set<MappingMode> = MappingMode.NXO
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("h") override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("h")
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE)
override fun getOffset(editor: Editor, override fun getOffset(editor: Editor,
caret: Caret, caret: Caret,
context: DataContext, context: DataContext,
@@ -49,6 +47,8 @@ class MotionLeftAction : MotionActionHandler.ForEachCaret() {
} }
class MotionLeftInsertModeAction : MotionActionHandler.ForEachCaret() { class MotionLeftInsertModeAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.EXCLUSIVE
override val mappingModes: Set<MappingMode> = MappingMode.I override val mappingModes: Set<MappingMode> = MappingMode.I
override val keyStrokesSet: Set<List<KeyStroke>> = setOf( override val keyStrokesSet: Set<List<KeyStroke>> = setOf(

View File

@@ -25,6 +25,7 @@ import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.CommandFlags; import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.MotionType;
import com.maddyhome.idea.vim.group.MotionGroup; import com.maddyhome.idea.vim.group.MotionGroup;
import com.maddyhome.idea.vim.handler.MotionActionHandler; import com.maddyhome.idea.vim.handler.MotionActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -39,7 +40,7 @@ public class MotionLeftMatchCharAction extends MotionActionHandler.ForEachCaret
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {
return MappingMode.NVO; return MappingMode.NXO;
} }
@NotNull @NotNull
@@ -57,7 +58,7 @@ public class MotionLeftMatchCharAction extends MotionActionHandler.ForEachCaret
@NotNull @NotNull
@Override @Override
public EnumSet<CommandFlags> getFlags() { public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_EXCLUSIVE, CommandFlags.FLAG_ALLOW_DIGRAPH); return EnumSet.of(CommandFlags.FLAG_ALLOW_DIGRAPH);
} }
@Override @Override
@@ -75,4 +76,10 @@ public class MotionLeftMatchCharAction extends MotionActionHandler.ForEachCaret
VimPlugin.getMotion().setLastFTCmd(MotionGroup.LAST_F, argument.getCharacter()); VimPlugin.getMotion().setLastFTCmd(MotionGroup.LAST_F, argument.getCharacter());
return res; return res;
} }
@NotNull
@Override
public MotionType getMotionType() {
return MotionType.EXCLUSIVE;
}
} }

Some files were not shown because too many files have changed in this diff Show More