mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
159 Commits
0.53.2-EAP
...
0.54.2-EAP
Author | SHA1 | Date | |
---|---|---|---|
![]() |
30662a8110 | ||
![]() |
69a273982f | ||
![]() |
eef1b25e9f | ||
![]() |
622de851fe | ||
![]() |
8cecb61d28 | ||
![]() |
77d8d27dfa | ||
![]() |
340f259b17 | ||
![]() |
5cf68a7f06 | ||
![]() |
0ae5abcd0c | ||
![]() |
b6cecb2125 | ||
![]() |
3aa3a9c9a8 | ||
![]() |
2c11ed43e4 | ||
![]() |
be0bee672e | ||
![]() |
b695e3c646 | ||
![]() |
33840dc5cd | ||
![]() |
255f2f59fc | ||
![]() |
d7fca09f0a | ||
![]() |
917b77c8ad | ||
![]() |
a2cd8ec19c | ||
![]() |
6300d39065 | ||
![]() |
2457079724 | ||
![]() |
ba84e723e8 | ||
![]() |
bf75e75d6f | ||
![]() |
c3183a8bd7 | ||
![]() |
7c162fc7ed | ||
![]() |
529c5ac8d7 | ||
![]() |
60e619e45e | ||
![]() |
a89bdcdd3b | ||
![]() |
09fbdf5541 | ||
![]() |
0b517671cb | ||
![]() |
a15dc3ed60 | ||
![]() |
b7d60f4cb5 | ||
![]() |
82a331a940 | ||
![]() |
c31e688f11 | ||
![]() |
0c887027d3 | ||
![]() |
7c7df85d1a | ||
![]() |
a7c025d927 | ||
![]() |
424598b92f | ||
![]() |
dc713c477b | ||
![]() |
7e71edaee2 | ||
![]() |
3f8925cbb0 | ||
![]() |
5f9e24b314 | ||
![]() |
dcd799ad85 | ||
![]() |
ff0d7a4345 | ||
![]() |
d68bad313e | ||
![]() |
bd09917396 | ||
![]() |
eeaa2fe882 | ||
![]() |
32ac0e77fa | ||
![]() |
947a1aa9f5 | ||
![]() |
17a87f80e3 | ||
![]() |
59f4dc8c78 | ||
![]() |
6434a06c08 | ||
![]() |
6133ab509d | ||
![]() |
572a96328a | ||
![]() |
a7ac3bec7f | ||
![]() |
3e78f50a76 | ||
![]() |
a4843e57cb | ||
![]() |
d6d90dda58 | ||
![]() |
c92c5e234c | ||
![]() |
987f06d518 | ||
![]() |
eaf7476785 | ||
![]() |
3b39656280 | ||
![]() |
5c559f921d | ||
![]() |
77f6b3fcb8 | ||
![]() |
f56ed7fd50 | ||
![]() |
a470b579a9 | ||
![]() |
a2eb7d44c0 | ||
![]() |
dfc83a7aea | ||
![]() |
71686e45e3 | ||
![]() |
b0ac35a51b | ||
![]() |
d836320b31 | ||
![]() |
19e7c058c3 | ||
![]() |
f1ae3607e4 | ||
![]() |
d03bfaeb53 | ||
![]() |
33f363cb31 | ||
![]() |
cdb87b6a70 | ||
![]() |
b5497d83a9 | ||
![]() |
802b7c33b6 | ||
![]() |
bb4f81fb84 | ||
![]() |
10a02e98e9 | ||
![]() |
32075ef758 | ||
![]() |
998073ac7f | ||
![]() |
93c7a5bdd2 | ||
![]() |
3fb2ce47e9 | ||
![]() |
61a8217d83 | ||
![]() |
ad5e4341fa | ||
![]() |
5b192795e6 | ||
![]() |
5db9c5d31e | ||
![]() |
ff469a386e | ||
![]() |
3a90cf0e7b | ||
![]() |
07dbad8c70 | ||
![]() |
e8ba919661 | ||
![]() |
390d92b16f | ||
![]() |
d45d56f330 | ||
![]() |
2e7cde3ca5 | ||
![]() |
0594ea0b98 | ||
![]() |
37d09781b4 | ||
![]() |
b0f3a0ea30 | ||
![]() |
8282abf264 | ||
![]() |
4153b58502 | ||
![]() |
b62b940cd4 | ||
![]() |
ca9cf02361 | ||
![]() |
e863ffd949 | ||
![]() |
eb4bb3f238 | ||
![]() |
d3d35bbea1 | ||
![]() |
8eff6d80a2 | ||
![]() |
77c8947ccd | ||
![]() |
48556f6917 | ||
![]() |
2e8dc4234f | ||
![]() |
a6a60b6e71 | ||
![]() |
eba9eaf37a | ||
![]() |
ae31b1c23d | ||
![]() |
535a0532df | ||
![]() |
0579d242f6 | ||
![]() |
b4910ed8f4 | ||
![]() |
2bb1399ae7 | ||
![]() |
062ada96ff | ||
![]() |
bb94238e9c | ||
![]() |
43a40c1f6b | ||
![]() |
639866a9e1 | ||
![]() |
05bbe6b799 | ||
![]() |
e19b1c8bf0 | ||
![]() |
0648d621b5 | ||
![]() |
93c0de9ebb | ||
![]() |
0220b3f3cd | ||
![]() |
1af7f9388d | ||
![]() |
76f0eaebce | ||
![]() |
ae71957236 | ||
![]() |
5004f0280e | ||
![]() |
52967368ff | ||
![]() |
8a63fa42ae | ||
![]() |
05ecb92a88 | ||
![]() |
829619d901 | ||
![]() |
c74b60820b | ||
![]() |
cd741fe7fd | ||
![]() |
3b26cd845a | ||
![]() |
d05cc3cd35 | ||
![]() |
96dff832ba | ||
![]() |
e43339613c | ||
![]() |
e025bc2912 | ||
![]() |
a4be636f9d | ||
![]() |
a2bae6795f | ||
![]() |
28d9bd0c73 | ||
![]() |
8e12c9bef0 | ||
![]() |
88926c3eef | ||
![]() |
8dd774446b | ||
![]() |
46cf112378 | ||
![]() |
5d2520d057 | ||
![]() |
a6ea89162a | ||
![]() |
1039cf661d | ||
![]() |
eaf9f0bbfa | ||
![]() |
9e036176ef | ||
![]() |
31e1edcc72 | ||
![]() |
7d9d8d4a02 | ||
![]() |
71cb43e751 | ||
![]() |
f27e00500e | ||
![]() |
21536fb3ef | ||
![]() |
7c0ee2429d | ||
![]() |
0ddb7f971d |
@@ -263,6 +263,14 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/jorgengranseth)
|
[![icon][github]](https://github.com/jorgengranseth)
|
||||||
|
|
||||||
Jørgen Granseth
|
Jørgen Granseth
|
||||||
|
* [![icon][mail]](mailto:rafal@hajdacki.com)
|
||||||
|
[![icon][github]](https://github.com/hajdamak)
|
||||||
|
|
||||||
|
Rafał Hajdacki
|
||||||
|
* [![icon][mail]](mailto:igrek+github@fastem.com)
|
||||||
|
[![icon][github]](https://github.com/igrekster)
|
||||||
|
|
||||||
|
igrekster
|
||||||
|
|
||||||
If you are a contributor and your name is not listed here, feel free to
|
If you are a contributor and your name is not listed here, feel free to
|
||||||
contact the maintainers.
|
contact the maintainers.
|
||||||
|
71
CHANGES.md
71
CHANGES.md
@@ -8,21 +8,63 @@ 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 `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
|
[To Be Released]
|
||||||
--------------
|
--------------
|
||||||
_Available since 0.53.1 EAP:_
|
|
||||||
|
_Available since 0.54.1 EAP:_
|
||||||
|
|
||||||
**Features:**
|
**Features:**
|
||||||
|
* Surround and Commentary extensions can be repeated with a dot command ([VIM-1118](https://youtrack.jetbrains.com/issue/VIM-1118))
|
||||||
|
* Support XDG settings standard ([VIM-664](https://youtrack.jetbrains.com/issue/VIM-664))
|
||||||
|
* Add option to remove the status bar icon ([VIM-1847](https://youtrack.jetbrains.com/issue/VIM-1847))
|
||||||
|
|
||||||
|
**Fixes:**
|
||||||
|
* [VIM-1823](https://youtrack.jetbrains.com/issue/VIM-1823) Fix multiple carets with ignorecase
|
||||||
|
* [VIM-1053](https://youtrack.jetbrains.com/issue/VIM-1053)
|
||||||
|
[VIM-1038](https://youtrack.jetbrains.com/issue/VIM-1038)
|
||||||
|
Implement gq+motion. Support some double `g` commands (`guu`, `gUU`, `g~~`).
|
||||||
|
* [VIM-1325](https://youtrack.jetbrains.com/issue/VIM-1325)
|
||||||
|
[VIM-1050](https://youtrack.jetbrains.com/issue/VIM-1050)
|
||||||
|
[VIM-1627](https://youtrack.jetbrains.com/issue/VIM-1627)
|
||||||
|
[VIM-1867](https://youtrack.jetbrains.com/issue/VIM-1867)
|
||||||
|
Fix bindings for active lookup
|
||||||
|
* [VIM-1845](https://youtrack.jetbrains.com/issue/VIM-1845) Show ActionGroup popups
|
||||||
|
* [VIM-1424](https://youtrack.jetbrains.com/issue/VIM-1424) CTRL-A doesn't have any restrictions now
|
||||||
|
* [VIM-1454](https://youtrack.jetbrains.com/issue/VIM-1454) Fix CTRL-W with the autocompletion lookup
|
||||||
|
* [VIM-1855](https://youtrack.jetbrains.com/issue/VIM-1855) Fix initialization error
|
||||||
|
* [VIM-1853](https://youtrack.jetbrains.com/issue/VIM-1853) Fix marks for disposed projects
|
||||||
|
* [VIM-1858](https://youtrack.jetbrains.com/issue/VIM-1858) Fix imap for autocomplete
|
||||||
|
* [VIM-1362](https://youtrack.jetbrains.com/issue/VIM-1362) Search with confirm doesn't scroll down far enough
|
||||||
|
|
||||||
|
_To Be Released:_
|
||||||
|
|
||||||
|
**Fixes:**
|
||||||
|
* [VIM-1875](https://youtrack.jetbrains.com/issue/VIM-1875) Fix `isk` in `~/.ideaivmrc`
|
||||||
|
* [VIM-1874](https://youtrack.jetbrains.com/issue/VIM-1874) Fix `set clipboard=unnamed` execution from `~/.ideavimrc`
|
||||||
|
* [VIM-1878](https://youtrack.jetbrains.com/issue/VIM-1878) Fix `c` command after extract method action
|
||||||
|
* [VIM-1884](https://youtrack.jetbrains.com/issue/VIM-1884) Show quickDoc during popup with `CTRL-J`
|
||||||
|
|
||||||
|
0.54, 2019-11-20
|
||||||
|
--------------
|
||||||
|
|
||||||
|
**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
|
||||||
@@ -40,19 +82,9 @@ _Available since 0.53.1 EAP:_
|
|||||||
* [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)
|
||||||
_Available since 0.53.2 EAP:_
|
[VIM-927](https://youtrack.jetbrains.com/issue/VIM-927)
|
||||||
|
Fix mappings to black hole register
|
||||||
**Features:**
|
|
||||||
* Add IdeaVim icon to the status bar ([VIM-943](https://youtrack.jetbrains.com/issue/VIM-943))
|
|
||||||
* EasyMotion plugin emulation ([VIM-820](https://youtrack.jetbrains.com/issue/VIM-820))
|
|
||||||
|
|
||||||
**Changes:**
|
|
||||||
* Remove the default IdeaVim toggle shortcut (<kbd>CTRL</kbd><kbd>ALT</kbd><kbd>V</kbd>)
|
|
||||||
* Rename `refactoring` value of `selectmode` option to `ideaselection`
|
|
||||||
* Remove `template` value of `selectmode` option and replace it with `idearefactormode` option.
|
|
||||||
|
|
||||||
**Fixes:**
|
|
||||||
* [VIM-1804](https://youtrack.jetbrains.com/issue/VIM-1804) Exit insert move after toggling IdeaVim
|
* [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-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-1801](https://youtrack.jetbrains.com/issue/VIM-1801) Fix j/k motions with inline hints
|
||||||
@@ -60,6 +92,7 @@ _Available since 0.53.2 EAP:_
|
|||||||
* [VIM-1819](https://youtrack.jetbrains.com/issue/VIM-1819) Fix execution of some rider actions
|
* [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
|
* [VIM-1604](https://youtrack.jetbrains.com/issue/VIM-1604) Add IdeaVim logo
|
||||||
|
|
||||||
|
|
||||||
0.53, 2019-08-07
|
0.53, 2019-08-07
|
||||||
--------------
|
--------------
|
||||||
* [VIM-1711](https://youtrack.jetbrains.com/issue/VIM-1711) Search is not triggered during surround action
|
* [VIM-1711](https://youtrack.jetbrains.com/issue/VIM-1711) Search is not triggered during surround action
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
### Where to Start
|
### Where to Start
|
||||||
|
|
||||||
In order to contribute to IdeaVim, you should have some understanding of Java or [Kotlin](https://kotlinlang.org/).
|
In order to contribute to IdeaVim, you should have some understanding of [Kotlin](https://kotlinlang.org/) or Java.
|
||||||
|
|
||||||
See also these docs on the IntelliJ API:
|
See also these docs on the IntelliJ API:
|
||||||
|
|
||||||
|
26
README.md
26
README.md
@@ -49,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` | `Get Early Access...`
|
||||||
|
|
||||||
|
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`
|
||||||
@@ -123,29 +127,40 @@ will affect where IdeaVim looks for your .ideavimrc file. For example, if you
|
|||||||
have `-Duser.home=/my/alternate/home` then IdeaVim will source
|
have `-Duser.home=/my/alternate/home` then IdeaVim will source
|
||||||
`/my/alternate/home/.ideavimrc` instead of `~/.ideavimrc`.
|
`/my/alternate/home/.ideavimrc` instead of `~/.ideavimrc`.
|
||||||
|
|
||||||
|
Alternatively, you can set up initialization commands using [XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) standard.
|
||||||
|
Put your settings to `$XDG_CONFIG_HOME$/ideavim/ideavimrc` file. [To Be Released]
|
||||||
|
|
||||||
|
|
||||||
Emulated Vim Plugins
|
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`
|
||||||
|
|
||||||
@@ -201,4 +216,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.
|
||||||
|
@@ -55,8 +55,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
||||||
compile "org.jetbrains:annotations:17.0.0"
|
compileOnly "org.jetbrains:annotations:17.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
|
@@ -13,25 +13,6 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
|||||||
'gdefault' 'gd' the ":substitute" flag 'g' is by default
|
'gdefault' 'gd' the ":substitute" flag 'g' is by default
|
||||||
'history' 'hi' number of command-lines that are remembered
|
'history' 'hi' number of command-lines that are remembered
|
||||||
'hlsearch' 'hls' highlight matches with the last search pattern
|
'hlsearch' 'hls' highlight matches with the last search pattern
|
||||||
|
|
||||||
`ideamarks` `ideamarks` Boolean (default true) - IdeaVim ONLY
|
|
||||||
|
|
||||||
If true, creation of global mark will trigger creation of IDE's bookmark
|
|
||||||
and vice versa.
|
|
||||||
|
|
||||||
`idearefactormode` `idearefactormode` String(default "select") - IdeaVim ONLY [To Be Released]
|
|
||||||
|
|
||||||
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.
|
||||||
'incsearch' 'is' show where search pattern typed so far matches
|
'incsearch' 'is' show where search pattern typed so far matches
|
||||||
@@ -59,12 +40,6 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
|||||||
'matchpairs' 'mps' pairs of characters that "%" can match
|
'matchpairs' 'mps' pairs of characters that "%" can match
|
||||||
'nrformats' 'nf' number formats recognized for CTRL-A command
|
'nrformats' 'nf' number formats recognized for CTRL-A command
|
||||||
'number' 'nu' print the line number in front of each line
|
'number' 'nu' print the line number in front of each line
|
||||||
|
|
||||||
`lookupactions` `lookupactions` String (default "VimLookupUp,VimLookupDown") - IdeaVim Only
|
|
||||||
|
|
||||||
By default all actions are handled by the IDE if lookup is active.
|
|
||||||
This list of comma-separated words enables defined vim actions for active lookup.
|
|
||||||
|
|
||||||
'relativenumber' 'rnu' show the line number relative to the line with
|
'relativenumber' 'rnu' show the line number relative to the line with
|
||||||
the cursor
|
the cursor
|
||||||
'scroll' 'scr' lines to scroll with CTRL-U and CTRL-D
|
'scroll' 'scr' lines to scroll with CTRL-U and CTRL-D
|
||||||
@@ -80,22 +55,16 @@ 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>
|
||||||
ideaselection when IDE sets a selection - IdeaVim ONLY [To Be Released]
|
ideaselection when IDE sets a selection - IdeaVim ONLY
|
||||||
(examples: extend selection, wrap with while, etc.)
|
(examples: extend selection, wrap with while, etc.)
|
||||||
|
|
||||||
Deprecated values: [To Be Released]
|
Deprecated values:
|
||||||
template ~~please use `idearefactormode` option~~
|
template ~~please use `idearefactormode` option~~
|
||||||
when starting a template - IdeaVim ONLY
|
when starting a template - IdeaVim ONLY
|
||||||
refactoring ~~please use ideaselection~~
|
refactoring ~~please use ideaselection~~
|
||||||
same as ideaselection - IdeaVim ONLY
|
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
|
||||||
|
|
||||||
`ideajoin` `ideajoin` Boolean (default false) - IdeaVim ONLY
|
|
||||||
|
|
||||||
If true, join command will be performed via IDE
|
|
||||||
See wiki/`ideajoin` examples
|
|
||||||
|
|
||||||
'sidescroll' 'ss' minimum number of columns to scroll horizontally
|
'sidescroll' 'ss' minimum number of columns to scroll horizontally
|
||||||
'sidescrolloff' 'siso' min. number of columns to left and right of cursor
|
'sidescrolloff' 'siso' min. number of columns to left and right of cursor
|
||||||
'smartcase' 'scs' no ignore case when pattern is uppercase
|
'smartcase' 'scs' no ignore case when pattern is uppercase
|
||||||
@@ -105,6 +74,39 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
|||||||
'viminfo' 'vi' information to remember after restart
|
'viminfo' 'vi' information to remember after restart
|
||||||
'visualbell' 'vb' use visual bell instead of beeping
|
'visualbell' 'vb' use visual bell instead of beeping
|
||||||
'wrapscan' 'ws' searches wrap around the end of file
|
'wrapscan' 'ws' searches wrap around the end of file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IdeaVim only commands:
|
||||||
|
|
||||||
|
`ideamarks` `ideamarks` Boolean (default true)
|
||||||
|
|
||||||
|
If true, creation of global mark will trigger creation of IDE's bookmark
|
||||||
|
and vice versa.
|
||||||
|
|
||||||
|
`idearefactormode` `idearefactormode` String(default "select")
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
`ideajoin` `ideajoin` Boolean (default false)
|
||||||
|
|
||||||
|
If true, join command will be performed via IDE
|
||||||
|
See wiki/`ideajoin` examples
|
||||||
|
|
||||||
|
`ideastatusbar` `ideastatusbar` Boolean (default true) [To Be Released]
|
||||||
|
|
||||||
|
If false, IdeaVim icon won't be shown in the status bar.
|
||||||
|
Works only from `~/.ideavimrc` after the IDE restart.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
[1] - cursor keys, <End>, <Home>, <PageUp> and <PageDown>
|
[1] - cursor keys, <End>, <Home>, <PageUp> and <PageDown>
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
# suppress inspection "UnusedProperty" for whole file
|
# suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
ideaVersion=193-EAP-SNAPSHOT
|
ideaVersion=2019.3
|
||||||
downloadIdeaSources=true
|
downloadIdeaSources=true
|
||||||
instrumentPluginCode=true
|
instrumentPluginCode=true
|
||||||
version=SNAPSHOT
|
version=SNAPSHOT
|
||||||
javaVersion=1.8
|
javaVersion=1.8
|
||||||
kotlinVersion=1.3.50
|
kotlinVersion=1.3.61
|
||||||
publishUsername=username
|
publishUsername=username
|
||||||
publishToken=token
|
publishToken=token
|
||||||
publishChannels=eap
|
publishChannels=eap
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
24
gradle/wrapper/gradle-wrapper.properties
vendored
24
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,24 +1,6 @@
|
|||||||
#
|
#Fri Nov 22 14:42:01 MSK 2019
|
||||||
# IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
#Thu Feb 21 15:20:13 MSK 2019
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
23
resources/META-INF/ApplicationServices.xml
Normal file
23
resources/META-INF/ApplicationServices.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MotionGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.CommandGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MarkGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.FileGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MacroGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.KeyGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.WindowGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.EditorGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.copy.YankGroup"/>
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.copy.PutGroup"/>
|
||||||
|
|
||||||
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
||||||
|
</extensions>
|
||||||
|
</idea-plugin>
|
345
resources/META-INF/VimActions.xml
Normal file
345
resources/META-INF/VimActions.xml
Normal file
@@ -0,0 +1,345 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<extensions defaultExtensionNs="IdeaVIM">
|
||||||
|
<!-- Motions -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.tabs.MotionPreviousTabAction" mappingModes="NXO" keys="gT"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.tabs.MotionNextTabAction" mappingModes="NXO" keys="gt"/>
|
||||||
|
<!-- Left/Right -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionColumnAction" mappingModes="NXO" keys="|"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstColumnAction" mappingModes="NXO" keys="0"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstColumnInsertModeAction" mappingModes="I" keys="«Home»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstScreenColumnAction" mappingModes="NXO" keys="g0,g«Home»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstNonSpaceAction" mappingModes="NXO" keys="^"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstScreenNonSpaceAction" mappingModes="NXO" keys="g^"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastColumnAction" mappingModes="NXO" keys="$"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastColumnInsertAction" mappingModes="I" keys="«End»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastScreenColumnAction" mappingModes="NXO" keys="g$,g«End»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastMatchCharAction" mappingModes="NXO" keys=";"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastMatchCharReverseAction" mappingModes="NXO" keys="«COMMA»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastNonSpaceAction" mappingModes="NXO" keys="g_"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftAction" mappingModes="NXO" keys="h"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftInsertModeAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftWrapAction" mappingModes="NXO" keys="«BS»,«C-H»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftMatchCharAction" mappingModes="NXO" keys="F"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftTillMatchCharAction" mappingModes="NXO" keys="T"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionMiddleColumnAction" mappingModes="NXO" keys="gm"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightAction" mappingModes="NXO" keys="l"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightInsertAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightWrapAction" mappingModes="NXO" keys=" "/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightMatchCharAction" mappingModes="NXO" keys="f"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightTillMatchCharAction" mappingModes="NXO" keys="t"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionHomeAction" mappingModes="NV" keys="«Home»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftHomeAction" mappingModes="NV" keys="«S-Home»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionEndAction" mappingModes="NVO" keys="«End»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftEndAction" mappingModes="NV" keys="«S-End»"/>
|
||||||
|
<!-- Up/Down -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownAction" mappingModes="NXO" keys="j"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownCtrlNAction" mappingModes="NXO" keys="«C-N»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownNotLineWiseAction" mappingModes="NXO" keys="gj,g«Down»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownFirstNonSpaceAction" mappingModes="NXO" keys="+,«C-M»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.EnterNormalAction" mappingModes="NXO" keys="«CR»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownLess1FirstNonSpaceAction" mappingModes="NXO" keys="_"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineFirstAction" mappingModes="NXO" keys="gg,«C-Home»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineFirstInsertAction" mappingModes="I" keys="«C-Home»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastAction" mappingModes="NXO" keys="G"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndAction" mappingModes="NXO" keys="«C-End»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndInsertAction" mappingModes="I" keys="«C-End»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionPercentOrMatchAction" mappingModes="NXO" keys="%"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpAction" mappingModes="NXO" keys="k"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpCtrlPAction" mappingModes="NXO" keys="«C-P»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpNotLineWiseAction" mappingModes="NXO" keys="gk,g«Up»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionUpFirstNonSpaceAction" mappingModes="NXO" keys="-"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionArrowDownAction" mappingModes="NVO"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionArrowUpAction" mappingModes="NVO"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionArrowLeftAction" mappingModes="NXO"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionArrowRightAction" mappingModes="NXO"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.LookupDownAction" mappingModes="I" keys="«C-N»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.LookupUpAction" mappingModes="I" keys="«C-P»"/>
|
||||||
|
<!-- Text -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelEndLeftAction" mappingModes="NXO" keys="]b"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelEndRightAction" mappingModes="NXO" keys="]w"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelLeftAction" mappingModes="NXO" keys="[b"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelRightAction" mappingModes="NXO" keys="[w"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionNthCharacterAction" mappingModes="NXO" keys="go"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordEndLeftAction" mappingModes="NXO" keys="ge"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordEndLeftAction" mappingModes="NXO" keys="gE"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordEndRightAction" mappingModes="NXO" keys="e"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordEndRightAction" mappingModes="NXO" keys="E"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordLeftAction" mappingModes="NXO" keys="b"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordLeftInsertAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordLeftAction" mappingModes="NXO" keys="B,«C-Left»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordRightAction" mappingModes="NXO" keys="w"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordRightInsertAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordRightAction" mappingModes="NXO" keys="W,«C-Right»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentenceNextStartAction" mappingModes="NXO" keys=")"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentencePreviousStartAction" mappingModes="NXO" keys="("/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentenceNextEndAction" mappingModes="NXO" keys="g)"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentencePreviousEndAction" mappingModes="NXO" keys="g("/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionParagraphNextAction" mappingModes="NXO" keys="}"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionParagraphPreviousAction" mappingModes="NXO" keys="{"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceCloseAction" mappingModes="NXO" keys="]}"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceOpenAction" mappingModes="NXO" keys="[{"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedParenCloseAction" mappingModes="NXO" keys="])"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedParenOpenAction" mappingModes="NXO" keys="[("/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionBackwardEndAction" mappingModes="NXO" keys="[]"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionBackwardStartAction" mappingModes="NXO" keys="[["/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionForwardEndAction" mappingModes="NXO" keys="]]"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionForwardStartAction" mappingModes="NXO" keys="]["/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousEndAction" mappingModes="NXO" keys="[M"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousStartAction" mappingModes="NXO" keys="[m"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodNextEndAction" mappingModes="NXO" keys="]M"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodNextStartAction" mappingModes="NXO" keys="]m"/>
|
||||||
|
<!-- Text Objects -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterWordAction" mappingModes="XO" keys="aw"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBigWordAction" mappingModes="XO" keys="aW"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerWordAction" mappingModes="XO" keys="iw"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBigWordAction" mappingModes="XO" keys="iW"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockAngleAction" mappingModes="XO" keys="i>,i<"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBraceAction" mappingModes="XO" keys="iB,i{,i}"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBracketAction" mappingModes="XO" keys="i[,i]"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockParenAction" mappingModes="XO" keys="ib,i(,i)"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockDoubleQuoteAction" mappingModes="XO" keys='i"'/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockSingleQuoteAction" mappingModes="XO" keys="i'"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBackQuoteAction" mappingModes="XO" keys="i`"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockTagAction" mappingModes="XO" keys="it"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockAngleAction" mappingModes="XO" keys="a<,a>"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBraceAction" mappingModes="XO" keys="aB,a{,a}"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBracketAction" mappingModes="XO" keys="a[,a]"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockParenAction" mappingModes="XO" keys="ab,a(,a)"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockDoubleQuoteAction" mappingModes="XO" keys='a"'/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockSingleQuoteAction" mappingModes="XO" keys="a'"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBackQuoteAction" mappingModes="XO" keys="a`"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockTagAction" mappingModes="XO" keys="at"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerParagraphAction" mappingModes="XO" keys="ip"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterParagraphAction" mappingModes="XO" keys="ap"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerSentenceAction" mappingModes="XO" keys="is"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterSentenceAction" mappingModes="XO" keys="as"/>
|
||||||
|
<!-- Marks -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionMarkAction" mappingModes="NX" keys="m"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkAction" mappingModes="XO" keys="`"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkNoSaveJumpAction" mappingModes="XO" keys="g`"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkLineAction" mappingModes="XO" keys="'"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkLineNoSaveJumpAction" mappingModes="XO" keys="g'"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkAction" mappingModes="N" keys="`"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkNoSaveJumpAction" mappingModes="N" keys="g`"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkLineAction" mappingModes="N" keys="'"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkLineNoSaveJumpAction" mappingModes="N" keys="g'"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionJumpNextAction" mappingModes="N" keys="«C-I»,«Tab»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionJumpPreviousAction" mappingModes="N" keys="«C-O»,«C-T»"/>
|
||||||
|
<!-- Screen -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.screen.MotionFirstScreenLineAction" mappingModes="NXO" keys="H"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.screen.MotionLastScreenLineAction" mappingModes="NXO" keys="L"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.screen.MotionMiddleScreenLineAction" mappingModes="NXO" keys="M"/>
|
||||||
|
<!-- Scroll -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLinePageStartAction" mappingModes="NXO" keys="z+"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLineStartAction" mappingModes="NXO" keys="z«CR»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLineAction" mappingModes="NXO" keys="zt"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfPageDownAction" mappingModes="NXO" keys="«C-D»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfPageUpAction" mappingModes="NXO" keys="«C-U»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenLineAction" mappingModes="NXO" keys="zb"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenLinePageStartAction" mappingModes="NXO" keys="z^"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenLineStartAction" mappingModes="NXO" keys="z-"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLineDownAction" mappingModes="NXO" keys="«C-E»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLineUpAction" mappingModes="NXO" keys="«C-Y»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollMiddleScreenLineAction" mappingModes="NXO" keys="zz"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollMiddleScreenLineStartAction" mappingModes="NXO" keys="z."/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownAction" mappingModes="NXO" keys="«C-F»,«PageDown»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownInsertModeAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpAction" mappingModes="NXO" keys="«C-B»,«PageUp»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpInsertModeAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenColumnAction" mappingModes="NXO" keys="zs"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenColumnAction" mappingModes="NXO" keys="ze"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnLeftAction" mappingModes="NXO" keys="zl,z«Right»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnRightAction" mappingModes="NXO" keys="zh,z«Left»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftDownAction" mappingModes="NV" keys="«S-Down»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftUpAction" mappingModes="NV" keys="«S-Up»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftRightAction" mappingModes="NV" keys="«S-Right»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftLeftAction" mappingModes="NV" keys="«S-Left»"/>
|
||||||
|
<!-- Visual -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualExitModeAction" mappingModes="X" keys="«Esc»,«C-[»,«C-C»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualToggleCharacterModeAction" mappingModes="NX" keys="v"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualToggleLineModeAction" mappingModes="NX" keys="V"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualToggleBlockModeAction" mappingModes="NX" keys="«C-q»,«C-v»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSwapEndsAction" mappingModes="X" keys="o"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSwapEndsBlockAction" mappingModes="X" keys="O"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSelectPreviousAction" mappingModes="N" keys="gv"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSwapSelectionsAction" mappingModes="X" keys="gv"/>
|
||||||
|
|
||||||
|
<!-- Select-->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnableCharacterModeAction" mappingModes="N" keys="gh"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnableLineModeAction" mappingModes="N" keys="gH"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnableBlockModeAction" mappingModes="N" keys="g«C-h»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.motion.SelectMotionRightAction" mappingModes="S" keys="«Right»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.motion.SelectMotionLeftAction" mappingModes="S" keys="«Left»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectToggleVisualMode" mappingModes="V" keys="«C-G»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnterAction" mappingModes="S" keys="«enter»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEscapeAction" mappingModes="S" keys="«esc»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectDeleteAction" mappingModes="S" keys="«BS»,«DEL»"/>
|
||||||
|
|
||||||
|
<!-- Insert -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertAfterCursorAction" mappingModes="N" keys="a"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertAfterLineEndAction" mappingModes="N" keys="A"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertAtPreviousInsertAction" mappingModes="N" keys="gi"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertBeforeCursorAction" mappingModes="N" keys="i,«Insert»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertBeforeFirstNonBlankAction" mappingModes="N" keys="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertCharacterAboveCursorAction" mappingModes="I" keys="«C-Y»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertCharacterBelowCursorAction" mappingModes="I" keys="«C-E»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertDeleteInsertedTextAction" mappingModes="I" keys="«C-U»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertDeletePreviousWordAction" mappingModes="I" keys="«C-W»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertEnterAction" mappingModes="I" keys="«C-M»,«CR»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction" mappingModes="I" keys="«C-[»,«C-C»,«Esc»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertLineStartAction" mappingModes="N" keys="gI"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertNewLineAboveAction" mappingModes="N" keys="O"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertNewLineBelowAction" mappingModes="N" keys="o"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertPreviousInsertAction" mappingModes="I" keys="«C-A»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertPreviousInsertExitAction" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertRegisterAction" mappingModes="I" keys="«C-R»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertInsertAction" mappingModes="I" keys="«Ins»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertSingleCommandAction" mappingModes="I" keys="«C-O»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.VisualBlockInsertAction" mappingModes="X" keys="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.VisualBlockAppendAction" mappingModes="X" keys="A"/>
|
||||||
|
|
||||||
|
<!-- Delete -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterAction" mappingModes="N" keys="«DEL»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterLeftAction" mappingModes="N" keys="X"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterRightAction" mappingModes="N" keys="x"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteEndOfLineAction" mappingModes="N" keys="D"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinLinesAction" mappingModes="N" keys="gJ"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinLinesSpacesAction" mappingModes="N" keys="J"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinVisualLinesAction" mappingModes="X" keys="gJ"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinVisualLinesSpacesAction" mappingModes="X" keys="J"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteMotionAction" mappingModes="N" keys="d"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualAction" mappingModes="X" keys="d,x,«Del»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualLinesAction" mappingModes="X" keys="X"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualLinesEndAction" mappingModes="X" keys="D"/>
|
||||||
|
|
||||||
|
<!-- Change -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseLowerMotionAction" mappingModes="N" keys="gu"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseLowerVisualAction" mappingModes="X" keys="u"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseToggleCharacterAction" mappingModes="N" keys="~"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseToggleMotionAction" mappingModes="N" keys="g~"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseToggleVisualAction" mappingModes="X" keys="~"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseUpperMotionAction" mappingModes="N" keys="gU"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseUpperVisualAction" mappingModes="X" keys="U"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCharacterAction" mappingModes="N" keys="r"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCharactersAction" mappingModes="N" keys="s"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeEndOfLineAction" mappingModes="N" keys="C"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLineAction" mappingModes="N" keys="S"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeMotionAction" mappingModes="N" keys="c"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeNumberIncAction" mappingModes="N" keys="«C-A»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeNumberDecAction" mappingModes="N" keys="«C-X»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberIncAction" mappingModes="X" keys="«C-A»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberDecAction" mappingModes="X" keys="«C-X»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberAvalancheIncAction" mappingModes="X" keys="g«C-A»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberAvalancheDecAction" mappingModes="X" keys="g«C-X»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeReplaceAction" mappingModes="N" keys="R"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualAction" mappingModes="X" keys="c,s"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualCharacterAction" mappingModes="X" keys="r"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualLinesAction" mappingModes="X" keys="R,S"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualLinesEndAction" mappingModes="X" keys="C"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterMotionAction" mappingModes="N" keys="!"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.FilterVisualLinesAction" mappingModes="X" keys="!"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.AutoIndentLinesVisualAction" mappingModes="X" keys="="/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ReformatCodeVisualAction" mappingModes="X" keys="gq"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ReformatCodeMotionAction" mappingModes="N" keys="gq"/>
|
||||||
|
|
||||||
|
<!-- Shift -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.AutoIndentMotionAction" mappingModes="N" keys="="/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction" mappingModes="I" keys="«C-D»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction" mappingModes="N" keys="<"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction" mappingModes="X" keys="<"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightLinesAction" mappingModes="I" keys="«C-T»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightMotionAction" mappingModes="N" keys=">"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightVisualAction" mappingModes="X" keys=">"/>
|
||||||
|
|
||||||
|
<!-- Copy -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorAction" mappingModes="N" keys="p"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorAction" mappingModes="N" keys="P"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction" mappingModes="N" keys="]p"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorNoIndentAction" mappingModes="N" keys="[P,]P,[p"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorActionMoveCursor" mappingModes="N" keys="gp"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorActionMoveCursor" mappingModes="N" keys="gP"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.SelectRegisterAction" mappingModes="NXO" keys='"'/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankLineAction" mappingModes="N" keys="Y"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankMotionAction" mappingModes="N" keys="y"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualAction" mappingModes="X" keys="y"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualLinesAction" mappingModes="X" keys="Y"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextAction" mappingModes="X" keys="p,P"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextNoIndentAction" mappingModes="X" keys="[p,]p,]P,[P"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextMoveCursorAction" mappingModes="X" keys="gp,gP"/>
|
||||||
|
|
||||||
|
<!-- File -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileSaveCloseAction" mappingModes="N" keys="ZQ,ZZ"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.file.FilePreviousAction" mappingModes="N"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetAsciiAction" mappingModes="N" keys="ga"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetHexAction" mappingModes="N" keys="g8"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetFileInfoAction" mappingModes="N" keys="«C-G»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetLocationInfoAction" mappingModes="NX" keys="g«C-G»"/>
|
||||||
|
|
||||||
|
<!-- Window -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.VerticalSplitAction" mappingModes="N" keys="«C-W»v,«C-W»«C-V»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.HorizontalSplitAction" mappingModes="N" keys="«C-W»s,«C-W»S,«C-W»«C-S»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.CloseWindowAction" mappingModes="N" keys="«C-W»c"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowOnlyAction" mappingModes="N" keys="«C-W»o,«C-W»«C-O»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowNextAction" mappingModes="N" keys="«C-W»w,«C-W»«C-W»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowPrevAction" mappingModes="N" keys="«C-W»W"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowLeftAction" mappingModes="N" keys="«C-W»h,«C-W»«C-H»,«C-W»«Left»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowRightAction" mappingModes="N" keys="«C-W»l,«C-W»«C-L»,«C-W»«Right»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowUpAction" mappingModes="N" keys="«C-W»k,«C-W»«C-K»,«C-W»«Up»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowDownAction" mappingModes="N" keys="«C-W»j,«C-W»«C-J»,«C-W»«Down»"/>
|
||||||
|
|
||||||
|
<!-- Search -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchEntryFwdAction" mappingModes="NXO" keys="/"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchEntryRevAction" mappingModes="NXO" keys="?"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchAgainNextAction" mappingModes="NXO" keys="n"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchAgainPreviousAction" mappingModes="NXO" keys="N"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction" mappingModes="NXO" keys="*"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWholeWordBackwardAction" mappingModes="NXO" keys="#"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWordForwardAction" mappingModes="NXO" keys="g*"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWordBackwardAction" mappingModes="NXO" keys="g#"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.GotoDeclarationAction" mappingModes="NX" keys="gD,gd,«C-]»"/>
|
||||||
|
|
||||||
|
<!-- Macro -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.macro.ToggleRecordingAction" mappingModes="NX" keys="q"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.macro.PlaybackRegisterAction" mappingModes="N" keys="@"/>
|
||||||
|
|
||||||
|
<!-- Command Line -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.ex.ProcessExEntryAction" mappingModes="C"/>
|
||||||
|
|
||||||
|
<!-- Other -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLastSearchReplaceAction" mappingModes="N" keys="&"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLastGlobalSearchReplaceAction" mappingModes="N" keys="g&"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.RepeatChangeAction" mappingModes="N" keys="."/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.ExEntryAction" mappingModes="NXO" keys=":"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.ResetModeAction" mappingModes="ALL" keys="«C-\»«C-N»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.RedoAction" mappingModes="N" keys="«C-R»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.UndoAction" mappingModes="N"/>
|
||||||
|
|
||||||
|
<!-- Keys -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.change.OperatorAction" mappingModes="N" keys="g@"/>
|
||||||
|
|
||||||
|
<!-- Visual Selection of last Search Pattern (gn) -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.VisualSelectNextSearch" mappingModes="NX" keys="gn"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.VisualSelectPreviousSearch" mappingModes="NX" keys="gN"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.GnNextTextObject" mappingModes="O" keys="gn"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.GnPreviousTextObject" mappingModes="O" keys="gN"/>
|
||||||
|
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.CtrlDownAction" mappingModes="N" keys="«C-Down»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.CtrlUpAction" mappingModes="N" keys="«C-Up»"/>
|
||||||
|
|
||||||
|
<!-- Folds -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimCollapseAllRegions" mappingModes="NX" keys="zM"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimCollapseRegion" mappingModes="NX" keys="zc"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimCollapseRegionRecursively" mappingModes="NX" keys="zC"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimExpandAllRegions" mappingModes="NX" keys="zR"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimExpandRegion" mappingModes="NX" keys="zo"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimExpandRegionRecursively" mappingModes="NX" keys="zO"/>
|
||||||
|
|
||||||
|
<!-- Editor Actions -->
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorBackSpace" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorDelete" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorDown" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorTab" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorUp" mappingModes="I"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimQuickJavaDoc" mappingModes="N" keys="K"/>
|
||||||
|
</extensions>
|
||||||
|
</idea-plugin>
|
64
resources/META-INF/VimExCommands.xml
Normal file
64
resources/META-INF/VimExCommands.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<extensions defaultExtensionNs="IdeaVIM">
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ActionListHandler" names="actionlist"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.AsciiHandler" names="as[cii]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CmdFilterHandler" names="!"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CmdHandler" names="com[mand]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CmdClearHandler" names="comc[lear]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CopyTextHandler" names="co[py],t"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DelCmdHandler" names="delc[ommand]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DeleteLinesHandler" names="d[elete]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DeleteMarksHandler" names="delm[arks]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DigraphHandler" names="dig[raphs]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DumpLineHandler" names="dump[line]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.EditFileHandler" names="bro[wse],e[dit]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ActionHandler" names="action"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.EchoHandler" names="ec[ho]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ExitHandler" names="qa[ll],quita[ll],wqa[ll],xa[ll]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindClassHandler" names="cla[ss]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindFileHandler" names="fin[d]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindSymbolHandler" names="sym[bol]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.GotoCharacterHandler" names="go[to]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.HelpHandler" names="h[elp]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.HistoryHandler" names="his[tory]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.JoinLinesHandler" names="j[oin]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.JumpsHandler" names="ju[mps]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.LetHandler" names="let"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MapHandler"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MarkHandler" names="ma[rk],k"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MarksHandler" names="marks"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MoveTextHandler" names="m[ove]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextFileHandler" names="n[ext]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NoHLSearchHandler" names="noh[lsearch]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.OnlyHandler" names="on[ly]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PreviousFileHandler" names="N[ext],prev[ious]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PromptFindHandler" names="pro[mptfind]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PromptReplaceHandler" names="promptr[epl]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PutLinesHandler" names="pu[t]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.QuitHandler" names="q[uit],clo[se],hid[e]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.RedoHandler" names="red[o]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.RegistersHandler" names="di[splay],reg[isters]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.RepeatHandler" names="@"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SelectFileHandler" names="argu[ment]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SelectFirstFileHandler" names="fir[st],rew[ind]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SelectLastFileHandler" names="la[st]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SetHandler" names="se[t]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ShiftLeftHandler"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ShiftRightHandler"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SourceHandler" names="so[urce]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SortHandler" names="sor[t]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SplitHandler" names="vs[plit],sp[lit]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SubstituteHandler" names="s[ubstitute],&,~"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.UndoHandler" names="u[ndo]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteAllHandler" names="wa[ll]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteHandler" names="w[rite]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteNextFileHandler" names="wn[ext]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WritePreviousFileHandler" names="wN[ext],wp[revious]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteQuitHandler" names="wq,exi[t],x[it]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.YankLinesHandler" names="y[ank]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ShellHandler" names="sh[ell]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextTabHandler" names="tabn[ext]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PreviousTabHandler" names="tabp[revious],tabN[ext]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabOnlyHandler" names="tabo[nly]"/>
|
||||||
|
</extensions>
|
||||||
|
</idea-plugin>
|
7
resources/META-INF/VimExtensions.xml
Normal file
7
resources/META-INF/VimExtensions.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<extensions defaultExtensionNs="IdeaVIM">
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.commentary.CommentaryExtension"/>
|
||||||
|
</extensions>
|
||||||
|
</idea-plugin>
|
@@ -1,12 +1,10 @@
|
|||||||
<idea-plugin url="https://plugins.jetbrains.com/plugin/164">
|
<idea-plugin url="https://plugins.jetbrains.com/plugin/164" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<name>IdeaVim</name>
|
<name>IdeaVim</name>
|
||||||
<id>IdeaVIM</id>
|
<id>IdeaVIM</id>
|
||||||
<change-notes><![CDATA[
|
<change-notes><![CDATA[
|
||||||
<ul>
|
<ul>
|
||||||
<li>EasyMotion plugin emulation</li>
|
<li>Fix `imap jk <ESC>` for the active autocompletion lookup</li>
|
||||||
<li>Support surrounding with a function name</li>
|
<li>Surround and Commentary extensions can be repeated with a dot command</li>
|
||||||
<li>Add IdeaVim logo to status bar</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>
|
||||||
]]></change-notes>
|
]]></change-notes>
|
||||||
@@ -23,6 +21,7 @@
|
|||||||
<vendor>JetBrains</vendor>
|
<vendor>JetBrains</vendor>
|
||||||
|
|
||||||
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
||||||
|
<!-- Check for [Version Update] tag in YouTrack as well -->
|
||||||
<idea-version since-build="183.4284.148"/>
|
<idea-version since-build="183.4284.148"/>
|
||||||
|
|
||||||
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
|
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
|
||||||
@@ -45,447 +44,26 @@
|
|||||||
|
|
||||||
<extensionPoints>
|
<extensionPoints>
|
||||||
<extensionPoint name="vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
|
<extensionPoint name="vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
|
||||||
<extensionPoint name="vimAction" interface="com.maddyhome.idea.vim.handler.EditorActionHandlerBase"/>
|
|
||||||
<extensionPoint name="vimExCommand" interface="com.maddyhome.idea.vim.ex.CommandHandler"/>
|
<extensionPoint name="vimExCommand" beanClass="com.maddyhome.idea.vim.ex.ExBeanClass">
|
||||||
|
<with attribute="implementation" implements="com.maddyhome.idea.vim.ex.CommandHandler"/>
|
||||||
|
</extensionPoint>
|
||||||
|
<extensionPoint name="vimAction" beanClass="com.maddyhome.idea.vim.handler.ActionBeanClass">
|
||||||
|
<with attribute="implementation" implements="com.maddyhome.idea.vim.handler.EditorActionHandlerBase"/>
|
||||||
|
</extensionPoint>
|
||||||
</extensionPoints>
|
</extensionPoints>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
||||||
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MotionGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.CommandGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MarkGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.FileGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MacroGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.KeyGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.WindowGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.EditorGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.copy.YankGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.copy.PutGroup"/>
|
|
||||||
|
|
||||||
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
|
||||||
|
|
||||||
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.StatusBarIconProvider"/>
|
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.StatusBarIconProvider"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="IdeaVIM">
|
<xi:include href="/META-INF/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
|
|
||||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
|
|
||||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.commentary.CommentaryExtension"/>
|
|
||||||
|
|
||||||
|
<xi:include href="/META-INF/VimActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
<!-- Motions -->
|
<xi:include href="/META-INF/VimExCommands.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.tabs.MotionPreviousTabAction"/>
|
<xi:include href="/META-INF/VimExtensions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.tabs.MotionNextTabAction"/>
|
|
||||||
<!-- Left/Right -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstColumnInsertModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstScreenColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstNonSpaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstScreenNonSpaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastColumnInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastScreenColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastMatchCharAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastMatchCharReverseAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLastNonSpaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftInsertModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftWrapAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftMatchCharAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftTillMatchCharAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionMiddleColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightWrapAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightMatchCharAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionRightTillMatchCharAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionHomeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftHomeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftEndAction"/>
|
|
||||||
<!-- Up/Down -->
|
|
||||||
<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.MotionDownFirstNonSpaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.EnterNormalAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionDownLess1FirstNonSpaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineFirstAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineFirstInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndAction"/>
|
|
||||||
<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.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.MotionUpFirstNonSpaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionArrowDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionArrowUpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionArrowLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionArrowRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.LookupDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.LookupUpAction"/>
|
|
||||||
<!-- Text -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelEndLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelEndRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionCamelRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionNthCharacterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordEndLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordEndLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordEndRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordEndRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordLeftInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionWordRightInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionBigWordRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentenceNextStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentencePreviousStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentenceNextEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSentencePreviousEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionParagraphNextAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionParagraphPreviousAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceCloseAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceOpenAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedParenCloseAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedParenOpenAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionBackwardEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionBackwardStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionForwardEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionSectionForwardStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodNextEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.text.MotionMethodNextStartAction"/>
|
|
||||||
<!-- Text Objects -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterWordAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBigWordAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerWordAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBigWordAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockAngleAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBraceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBracketAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockParenAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockDoubleQuoteAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockSingleQuoteAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBackQuoteAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockTagAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockAngleAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBraceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBracketAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockParenAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockDoubleQuoteAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockSingleQuoteAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBackQuoteAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockTagAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerParagraphAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterParagraphAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionInnerSentenceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.object.MotionOuterSentenceAction"/>
|
|
||||||
<!-- Marks -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionMarkAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkNoSaveJumpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkLineNoSaveJumpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkNoSaveJumpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkLineNoSaveJumpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionJumpNextAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.mark.MotionJumpPreviousAction"/>
|
|
||||||
<!-- Screen -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.screen.MotionFirstScreenLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.screen.MotionLastScreenLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.screen.MotionMiddleScreenLineAction"/>
|
|
||||||
<!-- Scroll -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLinePageStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLineStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfPageDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfPageUpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenLinePageStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenLineStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLineDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLineUpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollMiddleScreenLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollMiddleScreenLineStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownInsertModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpInsertModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenColumnAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftUpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftLeftAction"/>
|
|
||||||
<!-- Visual -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualExitModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualToggleCharacterModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualToggleLineModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualToggleBlockModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSwapEndsAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSwapEndsBlockAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSelectPreviousAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.visual.VisualSwapSelectionsAction"/>
|
|
||||||
|
|
||||||
<!-- Select-->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnableCharacterModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnableLineModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnableBlockModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.motion.SelectMotionRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.motion.SelectMotionLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectToggleVisualMode"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEnterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectEscapeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.select.SelectDeleteAction"/>
|
|
||||||
|
|
||||||
<!-- Insert -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertAfterCursorAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertAfterLineEndAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertAtPreviousInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertBeforeCursorAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertBeforeFirstNonBlankAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertCharacterAboveCursorAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertCharacterBelowCursorAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertDeleteInsertedTextAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertDeletePreviousWordAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertEnterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertLineStartAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertNewLineAboveAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertNewLineBelowAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertPreviousInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertPreviousInsertExitAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertRegisterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertSingleCommandAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.VisualBlockInsertAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.VisualBlockAppendAction"/>
|
|
||||||
|
|
||||||
<!-- Delete -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteEndOfLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteJoinLinesAction"/>
|
|
||||||
<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.DeleteJoinVisualLinesSpacesAction"/>
|
|
||||||
<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.DeleteVisualLinesAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteVisualLinesEndAction"/>
|
|
||||||
|
|
||||||
<!-- Change -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseLowerMotionAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseLowerVisualAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseToggleCharacterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseToggleMotionAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseToggleVisualAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseUpperMotionAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCaseUpperVisualAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCharacterAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeCharactersAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeEndOfLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeLineAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeMotionAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeNumberIncAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeNumberDecAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberIncAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberDecAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberAvalancheIncAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberAvalancheDecAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeReplaceAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.change.ChangeVisualCharacterAction"/>
|
|
||||||
<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.FilterMotionAction"/>
|
|
||||||
<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.ReformatCodeVisualAction"/>
|
|
||||||
|
|
||||||
<!-- Shift -->
|
|
||||||
<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.ShiftLeftMotionAction"/>
|
|
||||||
<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.ShiftRightMotionAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.shift.ShiftRightVisualAction"/>
|
|
||||||
|
|
||||||
<!-- Copy -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorNoIndentAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorActionMoveCursor"/>
|
|
||||||
<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.YankLineAction"/>
|
|
||||||
<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.YankVisualLinesAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextNoIndentAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextMoveCursorAction"/>
|
|
||||||
|
|
||||||
<!-- File -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileSaveCloseAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FilePreviousAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetAsciiAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetHexAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetFileInfoAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileGetLocationInfoAction"/>
|
|
||||||
|
|
||||||
<!-- Window -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.VerticalSplitAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.HorizontalSplitAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.CloseWindowAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowOnlyAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowNextAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowPrevAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowLeftAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowRightAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowUpAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.window.WindowDownAction"/>
|
|
||||||
|
|
||||||
<!-- Search -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchEntryFwdAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchEntryRevAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchAgainNextAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchAgainPreviousAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWholeWordBackwardAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWordForwardAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.SearchWordBackwardAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.search.GotoDeclarationAction"/>
|
|
||||||
|
|
||||||
<!-- Macro -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.macro.ToggleRecordingAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.macro.PlaybackRegisterAction"/>
|
|
||||||
|
|
||||||
<!-- Command Line -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.ex.ProcessExEntryAction"/>
|
|
||||||
|
|
||||||
<!-- Other -->
|
|
||||||
<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.RepeatChangeAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.ExEntryAction"/>
|
|
||||||
<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.UndoAction"/>
|
|
||||||
|
|
||||||
<!-- Keys -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.OperatorAction"/>
|
|
||||||
|
|
||||||
<!-- Visual Selection of last Search Pattern (gn) -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.VisualSelectNextSearch"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.VisualSelectPreviousSearch"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.GnNextTextObject"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.gn.GnPreviousTextObject"/>
|
|
||||||
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.CtrlDownAction"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.CtrlUpAction"/>
|
|
||||||
|
|
||||||
<!-- Folds -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimCollapseAllRegions"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimCollapseRegion"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimCollapseRegionRecursively"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimExpandAllRegions"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimExpandRegion"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.fold.VimExpandRegionRecursively"/>
|
|
||||||
|
|
||||||
<!-- Editor Actions -->
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorBackSpace"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorDelete"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorDown"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorTab"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimEditorUp"/>
|
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.editor.VimQuickJavaDoc"/>
|
|
||||||
|
|
||||||
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ActionListHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.AsciiHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CmdFilterHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CmdHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CmdClearHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.CopyTextHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DelCmdHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DeleteLinesHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DeleteMarksHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DigraphHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.DumpLineHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.EditFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ActionHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.EchoHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ExitHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindClassHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindSymbolHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.GotoCharacterHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.HelpHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.HistoryHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.JoinLinesHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.JumpsHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.LetHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MapHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MarkHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MarksHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.MoveTextHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NoHLSearchHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.OnlyHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PreviousFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PromptFindHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PromptReplaceHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PutLinesHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.QuitHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.RedoHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.RegistersHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.RepeatHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SelectFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SelectFirstFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SelectLastFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SetHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ShiftLeftHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ShiftRightHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SourceHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SortHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SplitHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.SubstituteHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.UndoHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteAllHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteNextFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WritePreviousFileHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.WriteQuitHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.YankLinesHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ShellHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextTabHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PreviousTabHandler"/>
|
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabOnlyHandler"/>
|
|
||||||
|
|
||||||
</extensions>
|
|
||||||
|
|
||||||
<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">
|
||||||
|
@@ -32,7 +32,10 @@ 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.intellij.openapi.ui.popup.JBPopupFactory;
|
||||||
|
import com.intellij.openapi.ui.popup.ListPopup;
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction;
|
||||||
|
import com.maddyhome.idea.vim.action.change.VimRepeater;
|
||||||
import com.maddyhome.idea.vim.action.macro.ToggleRecordingAction;
|
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.SearchEntryFwdAction;
|
||||||
import com.maddyhome.idea.vim.action.motion.search.SearchEntryRevAction;
|
import com.maddyhome.idea.vim.action.motion.search.SearchEntryRevAction;
|
||||||
@@ -54,7 +57,9 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -85,7 +90,6 @@ public class KeyHandler {
|
|||||||
* Creates an instance
|
* Creates an instance
|
||||||
*/
|
*/
|
||||||
private KeyHandler() {
|
private KeyHandler() {
|
||||||
reset(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,22 +126,35 @@ public class KeyHandler {
|
|||||||
* @param context The context to run it in
|
* @param context The context to run it in
|
||||||
*/
|
*/
|
||||||
public static boolean executeAction(@NotNull AnAction action, @NotNull DataContext context) {
|
public static boolean executeAction(@NotNull AnAction action, @NotNull DataContext context) {
|
||||||
// Hopefully all the arguments are sufficient. So far they all seem to work OK.
|
|
||||||
// We don't have a specific InputEvent so that is null
|
|
||||||
// What is "place"? Leave it the empty string for now.
|
|
||||||
// Is the template presentation sufficient?
|
|
||||||
// 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.beforeActionPerformedUpdate(event);
|
|
||||||
if (event.getPresentation().isEnabled()) {
|
if (action instanceof ActionGroup && !((ActionGroup)action).canBePerformed(context)) {
|
||||||
action.actionPerformed(event);
|
// Some of the AcitonGroups should not be performed, but shown as a popup
|
||||||
|
ListPopup popup = JBPopupFactory.getInstance()
|
||||||
|
.createActionGroupPopup(event.getPresentation().getText(), (ActionGroup)action, context, false, null, -1);
|
||||||
|
|
||||||
|
Component component = context.getData(PlatformDataKeys.CONTEXT_COMPONENT);
|
||||||
|
if (component != null) {
|
||||||
|
Window window = SwingUtilities.getWindowAncestor(component);
|
||||||
|
if (window != null) {
|
||||||
|
popup.showInCenterOf(window);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
popup.showInFocusCenter();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// beforeActionPerformedUpdate should be called to update the action. It fixes some rider-specific problems
|
||||||
|
// because rider use async update method. See VIM-1819
|
||||||
|
action.beforeActionPerformedUpdate(event);
|
||||||
|
if (event.getPresentation().isEnabled()) {
|
||||||
|
action.actionPerformed(event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,8 +196,6 @@ public class KeyHandler {
|
|||||||
@NotNull KeyStroke key,
|
@NotNull KeyStroke key,
|
||||||
@NotNull DataContext context,
|
@NotNull DataContext context,
|
||||||
boolean allowKeyMappings) {
|
boolean allowKeyMappings) {
|
||||||
if (VimPlugin.Initialization.notInitialized()) return;
|
|
||||||
|
|
||||||
VimPlugin.clearError();
|
VimPlugin.clearError();
|
||||||
// All the editor actions should be performed with top level editor!!!
|
// All the editor actions should be performed with top level editor!!!
|
||||||
// Be careful: all the EditorActionHandler implementation should correctly process InjectedEditors
|
// Be careful: all the EditorActionHandler implementation should correctly process InjectedEditors
|
||||||
@@ -202,9 +217,9 @@ public class KeyHandler {
|
|||||||
if (editorState.getMappingMode() != MappingMode.OP_PENDING ||
|
if (editorState.getMappingMode() != MappingMode.OP_PENDING ||
|
||||||
currentCmd.isEmpty() ||
|
currentCmd.isEmpty() ||
|
||||||
currentCmd.peek().getArgument() == null ||
|
currentCmd.peek().getArgument() == null ||
|
||||||
currentCmd.peek().getArgument().getType() != Argument.Type.OFFSETS) {
|
Objects.requireNonNull(currentCmd.peek().getArgument()).getType() != Argument.Type.OFFSETS) {
|
||||||
return;
|
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
|
||||||
@@ -294,13 +309,13 @@ public class KeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See the description for {@link CommandFlags#FLAG_DUPLICABLE_OPERATOR}
|
* See the description for {@link com.maddyhome.idea.vim.action.DuplicableOperatorAction}
|
||||||
*/
|
*/
|
||||||
private Node mapOpCommand(KeyStroke key, Node node, @NotNull CommandState editorState) {
|
private Node mapOpCommand(KeyStroke key, Node node, @NotNull CommandState editorState) {
|
||||||
if (editorState.getMappingMode() == MappingMode.OP_PENDING && !currentCmd.empty()) {
|
if (editorState.getMappingMode() == MappingMode.OP_PENDING && !currentCmd.empty()) {
|
||||||
EditorActionHandlerBase action = currentCmd.peek().getAction();
|
EditorActionHandlerBase action = currentCmd.peek().getAction();
|
||||||
if (action.getFlags().contains(CommandFlags.FLAG_DUPLICABLE_OPERATOR) &&
|
if (action instanceof DuplicableOperatorAction &&
|
||||||
action.getKeyStrokesSet().stream().anyMatch(o -> o.size() == 1 && o.get(0).equals(key))) {
|
((DuplicableOperatorAction)action).getDuplicateWith() == key.getKeyChar()) {
|
||||||
return editorState.getCurrentNode().get(KeyStroke.getKeyStroke('_'));
|
return editorState.getCurrentNode().get(KeyStroke.getKeyStroke('_'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,9 +418,17 @@ public class KeyHandler {
|
|||||||
Map<Caret, Integer> startOffsets =
|
Map<Caret, Integer> startOffsets =
|
||||||
editor.getCaretModel().getAllCarets().stream().collect(Collectors.toMap(Function.identity(), Caret::getOffset));
|
editor.getCaretModel().getAllCarets().stream().collect(Collectors.toMap(Function.identity(), Caret::getOffset));
|
||||||
|
|
||||||
|
if (extensionHandler.isRepeatable()) {
|
||||||
|
VimRepeater.Extension.INSTANCE.clean();
|
||||||
|
}
|
||||||
processor.executeCommand(editor.getProject(), () -> extensionHandler.execute(editor, context),
|
processor.executeCommand(editor.getProject(), () -> extensionHandler.execute(editor, context),
|
||||||
"Vim " + extensionHandler.getClass().getSimpleName(), null);
|
"Vim " + extensionHandler.getClass().getSimpleName(), null);
|
||||||
|
|
||||||
|
if (extensionHandler.isRepeatable()) {
|
||||||
|
VimRepeater.Extension.INSTANCE.setLastExtensionHandler(extensionHandler);
|
||||||
|
VimRepeater.Extension.INSTANCE.setArgumentCaptured(null);
|
||||||
|
VimRepeater.INSTANCE.setRepeatHandler(true);
|
||||||
|
}
|
||||||
if (isPendingMode &&
|
if (isPendingMode &&
|
||||||
!currentCmd.isEmpty() &&
|
!currentCmd.isEmpty() &&
|
||||||
currentCmd.peek().getArgument() == null) {
|
currentCmd.peek().getArgument() == null) {
|
||||||
@@ -421,9 +444,12 @@ public class KeyHandler {
|
|||||||
commandState.popState();
|
commandState.popState();
|
||||||
}
|
}
|
||||||
else if (startOffset != null && startOffset != caret.getOffset()) {
|
else if (startOffset != null && startOffset != caret.getOffset()) {
|
||||||
|
// Command line motions are always characterwise exclusive
|
||||||
int endOffset = caret.getOffset();
|
int endOffset = caret.getOffset();
|
||||||
if (startOffset < endOffset) {
|
if (startOffset < endOffset) {
|
||||||
endOffset -= 1;
|
endOffset -= 1;
|
||||||
|
} else {
|
||||||
|
startOffset -= 1;
|
||||||
}
|
}
|
||||||
final VimSelection vimSelection = VimSelection.Companion
|
final VimSelection vimSelection = VimSelection.Companion
|
||||||
.create(startOffset, endOffset, SelectionType.CHARACTER_WISE, editor);
|
.create(startOffset, endOffset, SelectionType.CHARACTER_WISE, editor);
|
||||||
@@ -651,22 +677,23 @@ public class KeyHandler {
|
|||||||
@NotNull CommandNode node,
|
@NotNull CommandNode node,
|
||||||
CommandState editorState) {
|
CommandState editorState) {
|
||||||
// The user entered a valid command. Create the command and add it to the stack
|
// The user entered a valid command. Create the command and add it to the stack
|
||||||
Command cmd = new Command(count, node.getAction(), node.getAction().getType(), node.getAction().getFlags(), keys);
|
final EditorActionHandlerBase myAction = node.getActionHolder().getAction();
|
||||||
|
Command cmd = new Command(count, myAction, myAction.getType(), myAction.getFlags(), keys);
|
||||||
currentCmd.push(cmd);
|
currentCmd.push(cmd);
|
||||||
|
|
||||||
if (currentArg != null && !checkArgumentCompatibility(node)) return;
|
if (currentArg != null && !checkArgumentCompatibility(node)) return;
|
||||||
|
|
||||||
if (node.getAction().getArgumentType() == null || stopMacroRecord(node, editorState)) {
|
if (myAction.getArgumentType() == null || stopMacroRecord(node, editorState)) {
|
||||||
state = State.READY;
|
state = State.READY;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentArg = node.getAction().getArgumentType();
|
currentArg = myAction.getArgumentType();
|
||||||
startWaitingForArgument(editor, context, key.getKeyChar(), currentArg, editorState, node.getAction());
|
startWaitingForArgument(editor, context, key.getKeyChar(), currentArg, editorState, myAction);
|
||||||
partialReset(editor);
|
partialReset(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO In the name of God, get rid of EX_STRING, FLAG_COMPLETE_EX and all the related staff
|
// 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)) {
|
if (currentArg == Argument.Type.EX_STRING && myAction.getFlags().contains(CommandFlags.FLAG_COMPLETE_EX)) {
|
||||||
EditorActionHandlerBase action;
|
EditorActionHandlerBase action;
|
||||||
if (forwardSearch) {
|
if (forwardSearch) {
|
||||||
action = new SearchEntryFwdAction();
|
action = new SearchEntryFwdAction();
|
||||||
@@ -687,7 +714,7 @@ public class KeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean stopMacroRecord(CommandNode node, @NotNull CommandState editorState) {
|
private boolean stopMacroRecord(CommandNode node, @NotNull CommandState editorState) {
|
||||||
return editorState.isRecording() && node.getAction() instanceof ToggleRecordingAction;
|
return editorState.isRecording() && node.getActionHolder().getAction() instanceof ToggleRecordingAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startWaitingForArgument(Editor editor,
|
private void startWaitingForArgument(Editor editor,
|
||||||
@@ -703,6 +730,10 @@ public class KeyHandler {
|
|||||||
state = State.CHAR_OR_DIGRAPH;
|
state = State.CHAR_OR_DIGRAPH;
|
||||||
break;
|
break;
|
||||||
case MOTION:
|
case MOTION:
|
||||||
|
if (CommandState.getInstance(editor).isDotRepeatInProgress() && VimRepeater.Extension.INSTANCE.getArgumentCaptured() != null) {
|
||||||
|
currentCmd.peek().setArgument(VimRepeater.Extension.INSTANCE.getArgumentCaptured());
|
||||||
|
state = State.READY;
|
||||||
|
}
|
||||||
editorState.pushState(editorState.getMode(), editorState.getSubMode(), MappingMode.OP_PENDING);
|
editorState.pushState(editorState.getMode(), editorState.getSubMode(), MappingMode.OP_PENDING);
|
||||||
break;
|
break;
|
||||||
case EX_STRING:
|
case EX_STRING:
|
||||||
@@ -717,8 +748,7 @@ public class KeyHandler {
|
|||||||
|
|
||||||
private boolean checkArgumentCompatibility(@NotNull CommandNode node) {
|
private boolean checkArgumentCompatibility(@NotNull CommandNode node) {
|
||||||
if (currentArg == Argument.Type.MOTION &&
|
if (currentArg == Argument.Type.MOTION &&
|
||||||
node.getAction().getType() != Command.Type.MOTION &&
|
node.getActionHolder().getAction().getType() != Command.Type.MOTION) {
|
||||||
!(node.getAction() instanceof ExEntryAction)) {
|
|
||||||
state = State.BAD_COMMAND;
|
state = State.BAD_COMMAND;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -743,7 +773,7 @@ public class KeyHandler {
|
|||||||
*
|
*
|
||||||
* @param editor The editor to reset.
|
* @param editor The editor to reset.
|
||||||
*/
|
*/
|
||||||
private void partialReset(@Nullable Editor editor) {
|
public void partialReset(@Nullable Editor editor) {
|
||||||
count = 0;
|
count = 0;
|
||||||
keys = new ArrayList<>();
|
keys = new ArrayList<>();
|
||||||
CommandState editorState = CommandState.getInstance(editor);
|
CommandState editorState = CommandState.getInstance(editor);
|
||||||
@@ -846,6 +876,7 @@ public class KeyHandler {
|
|||||||
CommandState editorState = CommandState.getInstance(editor);
|
CommandState editorState = CommandState.getInstance(editor);
|
||||||
boolean wasRecording = editorState.isRecording();
|
boolean wasRecording = editorState.isRecording();
|
||||||
|
|
||||||
|
KeyHandler.getInstance().state = State.NEW_COMMAND;
|
||||||
executeVimAction(editor, cmd.getAction(), context);
|
executeVimAction(editor, cmd.getAction(), context);
|
||||||
if (editorState.getMode() == CommandState.Mode.INSERT || editorState.getMode() == CommandState.Mode.REPLACE) {
|
if (editorState.getMode() == CommandState.Mode.INSERT || editorState.getMode() == CommandState.Mode.REPLACE) {
|
||||||
VimPlugin.getChange().processCommand(editor, cmd);
|
VimPlugin.getChange().processCommand(editor, cmd);
|
||||||
@@ -892,8 +923,8 @@ public class KeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int count;
|
private int count;
|
||||||
private List<KeyStroke> keys;
|
private List<KeyStroke> keys = new ArrayList<>();
|
||||||
private State state;
|
private State state = State.NEW_COMMAND;
|
||||||
@NotNull private final Stack<Command> currentCmd = new Stack<>();
|
@NotNull private final Stack<Command> currentCmd = new Stack<>();
|
||||||
@Nullable private Argument.Type currentArg;
|
@Nullable private Argument.Type currentArg;
|
||||||
private TypedActionHandler origHandler;
|
private TypedActionHandler origHandler;
|
||||||
|
@@ -19,6 +19,7 @@ package com.maddyhome.idea.vim;
|
|||||||
|
|
||||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||||
import com.maddyhome.idea.vim.group.KeyGroup;
|
import com.maddyhome.idea.vim.group.KeyGroup;
|
||||||
|
import com.maddyhome.idea.vim.handler.ActionBeanClass;
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||||
import com.maddyhome.idea.vim.key.Shortcut;
|
import com.maddyhome.idea.vim.key.Shortcut;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -29,21 +30,25 @@ import java.awt.event.KeyEvent;
|
|||||||
|
|
||||||
public class RegisterActions {
|
public class RegisterActions {
|
||||||
|
|
||||||
public static final ExtensionPointName<EditorActionHandlerBase> VIM_ACTIONS_EP =
|
public static final ExtensionPointName<ActionBeanClass> VIM_ACTIONS_EP =
|
||||||
ExtensionPointName.create("IdeaVIM.vimAction");
|
ExtensionPointName.create("IdeaVIM.vimAction");
|
||||||
|
private static boolean actionsRegistered = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register all the key/action mappings for the plugin.
|
* Register all the key/action mappings for the plugin.
|
||||||
*/
|
*/
|
||||||
static void registerActions() {
|
static void registerActions() {
|
||||||
|
if (actionsRegistered) return;
|
||||||
|
actionsRegistered = true;
|
||||||
|
|
||||||
registerVimCommandActions();
|
registerVimCommandActions();
|
||||||
registerEmptyShortcuts();
|
registerEmptyShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static EditorActionHandlerBase findAction(@NotNull String id) {
|
public static EditorActionHandlerBase findAction(@NotNull String id) {
|
||||||
return VIM_ACTIONS_EP.extensions().filter(vimActionBean -> vimActionBean.getId().equals(id)).findFirst()
|
return VIM_ACTIONS_EP.extensions().filter(vimActionBean -> vimActionBean.getActionId().equals(id)).findFirst()
|
||||||
.orElse(null);
|
.map(ActionBeanClass::getAction).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@@ -32,6 +32,7 @@ import com.intellij.ui.awt.RelativePoint
|
|||||||
import com.intellij.util.Consumer
|
import com.intellij.util.Consumer
|
||||||
import com.intellij.util.text.VersionComparatorUtil
|
import com.intellij.util.text.VersionComparatorUtil
|
||||||
import com.maddyhome.idea.vim.group.NotificationService
|
import com.maddyhome.idea.vim.group.NotificationService
|
||||||
|
import com.maddyhome.idea.vim.option.OptionsManager
|
||||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable
|
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable
|
||||||
import icons.VimIcons
|
import icons.VimIcons
|
||||||
import java.awt.Point
|
import java.awt.Point
|
||||||
@@ -40,10 +41,10 @@ import javax.swing.Icon
|
|||||||
import javax.swing.SwingConstants
|
import javax.swing.SwingConstants
|
||||||
|
|
||||||
private class StatusBarIconProvider : StatusBarWidgetProvider {
|
private class StatusBarIconProvider : StatusBarWidgetProvider {
|
||||||
override fun getWidget(project: Project) = VimStatusBar
|
override fun getWidget(project: Project): VimStatusBar? = if (OptionsManager.ideastatusbar.isSet) VimStatusBar else null
|
||||||
}
|
}
|
||||||
|
|
||||||
private object VimStatusBar : StatusBarWidget, StatusBarWidget.IconPresentation {
|
object VimStatusBar : StatusBarWidget, StatusBarWidget.IconPresentation {
|
||||||
|
|
||||||
private var statusBar: StatusBar? = null
|
private var statusBar: StatusBar? = null
|
||||||
|
|
||||||
@@ -64,8 +65,7 @@ private object VimStatusBar : StatusBarWidget, StatusBarWidget.IconPresentation
|
|||||||
val popup = VimActionsPopup.getPopup(DataManager.getInstance().getDataContext(component))
|
val popup = VimActionsPopup.getPopup(DataManager.getInstance().getDataContext(component))
|
||||||
val dimension = popup.content.preferredSize
|
val dimension = popup.content.preferredSize
|
||||||
|
|
||||||
// Trying to find the best position. 16 - size of the icon, 1 - height of the delimiter
|
val at = Point(0, -dimension.height)
|
||||||
val at = Point(-dimension.width + 16, -dimension.height - 1)
|
|
||||||
popup.show(RelativePoint(component, at))
|
popup.show(RelativePoint(component, at))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +176,8 @@ private object JoinEap : DumbAwareAction() {
|
|||||||
|
|
||||||
val pluginRef = Ref.create<PluginDownloader>()
|
val pluginRef = Ref.create<PluginDownloader>()
|
||||||
|
|
||||||
|
// [VERSION UPDATE] 193+ remove suppressing
|
||||||
|
@Suppress("UnstableApiUsage")
|
||||||
object : Task.Backgroundable(null, "Checking for IdeaVim EAP version", true) {
|
object : Task.Backgroundable(null, "Checking for IdeaVim EAP version", true) {
|
||||||
override fun run(indicator: ProgressIndicator) {
|
override fun run(indicator: ProgressIndicator) {
|
||||||
val downloaders = mutableListOf<PluginDownloader>()
|
val downloaders = mutableListOf<PluginDownloader>()
|
||||||
@@ -193,6 +195,8 @@ private object JoinEap : DumbAwareAction() {
|
|||||||
pluginRef.set(plugin)
|
pluginRef.set(plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [VERSION UPDATE] 193+ remove suppressing
|
||||||
|
@Suppress("MissingRecentApi", "UnstableApiUsage")
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
val downloader: PluginDownloader = pluginRef.get() ?: run {
|
val downloader: PluginDownloader = pluginRef.get() ?: run {
|
||||||
notificator.notifySubscribedToEap()
|
notificator.notifySubscribedToEap()
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
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
|
||||||
@@ -50,17 +49,9 @@ class VimLocalConfig : PersistentStateComponent<Element> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun loadState(state: Element) {
|
override fun loadState(state: Element) {
|
||||||
val setup = {
|
VimPlugin.getMark().readData(state)
|
||||||
VimPlugin.getMark().readData(state)
|
VimPlugin.getRegister().readData(state)
|
||||||
VimPlugin.getRegister().readData(state)
|
VimPlugin.getSearch().readData(state)
|
||||||
VimPlugin.getSearch().readData(state)
|
VimPlugin.getHistory().readData(state)
|
||||||
VimPlugin.getHistory().readData(state)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ApplicationManager.getApplication().isUnitTestMode) {
|
|
||||||
setup()
|
|
||||||
} else {
|
|
||||||
ApplicationManager.getApplication().executeOnPooledThread(setup)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied
|
* This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied
|
||||||
@@ -91,7 +90,6 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
|
|
||||||
// It is enabled by default to avoid any special configuration after plugin installation
|
// It is enabled by default to avoid any special configuration after plugin installation
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private boolean initialized = false;
|
|
||||||
|
|
||||||
private static final Logger LOG = Logger.getInstance(VimPlugin.class);
|
private static final Logger LOG = Logger.getInstance(VimPlugin.class);
|
||||||
|
|
||||||
@@ -104,11 +102,12 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
|
|
||||||
@NotNull private final VimState state = new VimState();
|
@NotNull private final VimState state = new VimState();
|
||||||
|
|
||||||
|
// [VERSION UPDATE] 193+ replace with com.intellij.openapi.components.PersistentStateComponent.initializeComponent
|
||||||
@Override
|
@Override
|
||||||
public void initComponent() {
|
public void initComponent() {
|
||||||
LOG.debug("initComponent");
|
LOG.debug("initComponent");
|
||||||
|
|
||||||
if (isEnabled()) initializePlugin();
|
if (enabled) turnOnPlugin();
|
||||||
|
|
||||||
LOG.debug("done");
|
LOG.debug("done");
|
||||||
}
|
}
|
||||||
@@ -294,41 +293,17 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
return getNotifications(null);
|
return getNotifications(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializePlugin() {
|
private boolean ideavimrcRegistered = false;
|
||||||
if (initialized) return;
|
|
||||||
initialized = true;
|
|
||||||
|
|
||||||
ApplicationManager.getApplication().invokeLater(this::updateState);
|
private void registerIdeavimrc() {
|
||||||
|
if (ideavimrcRegistered) return;
|
||||||
|
ideavimrcRegistered = true;
|
||||||
|
|
||||||
getEditor().turnOn();
|
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
getSearch().turnOn();
|
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
|
||||||
VimListenerManager.INSTANCE.turnOn();
|
if (ideaVimRc != null) {
|
||||||
|
VimScriptParser.executeFile(ideaVimRc);
|
||||||
|
|
||||||
Runnable asyncSetup = () -> {
|
|
||||||
// Register vim actions in command mode
|
|
||||||
RegisterActions.registerActions();
|
|
||||||
|
|
||||||
// Register ex handlers
|
|
||||||
CommandParser.getInstance().registerHandlers();
|
|
||||||
|
|
||||||
// Register extensions
|
|
||||||
VimExtensionRegistrar.registerExtensions();
|
|
||||||
|
|
||||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
|
||||||
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
|
|
||||||
if (ideaVimRc != null) {
|
|
||||||
VimScriptParser.executeFile(ideaVimRc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Initialization.initialized();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
|
||||||
asyncSetup.run();
|
|
||||||
} else {
|
|
||||||
ApplicationManager.getApplication().executeOnPooledThread(asyncSetup);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,14 +312,16 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [VERSION UPDATE] 193+ remove suppress
|
||||||
|
@SuppressWarnings({"MissingRecentApi", "UnstableApiUsage"})
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
|
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
|
||||||
if (!ApplicationManager.getApplication().isInternal()) {
|
if (!ApplicationManager.getApplication().isInternal()) {
|
||||||
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
|
|
||||||
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
|
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "INTERNAL";
|
return "INTERNAL" + (plugin != null ? " - " + plugin.getVersion() : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,33 +390,29 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Initialization {
|
|
||||||
private static final AtomicBoolean initialized = new AtomicBoolean(false);
|
|
||||||
|
|
||||||
public static boolean notInitialized() {
|
|
||||||
return !(initialized.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initialized() {
|
|
||||||
initialized.set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static VimPlugin getInstance() {
|
private static VimPlugin getInstance() {
|
||||||
return (VimPlugin)ApplicationManager.getApplication().getComponent(IDEAVIM_COMPONENT_NAME);
|
return ApplicationManager.getApplication().getComponent(VimPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void turnOnPlugin() {
|
private void turnOnPlugin() {
|
||||||
if (initialized) {
|
ApplicationManager.getApplication().invokeLater(this::updateState);
|
||||||
KeyHandler.getInstance().fullReset(null);
|
|
||||||
|
|
||||||
getEditor().turnOn();
|
getEditor().turnOn();
|
||||||
getSearch().turnOn();
|
getSearch().turnOn();
|
||||||
VimListenerManager.INSTANCE.turnOn();
|
VimListenerManager.INSTANCE.turnOn();
|
||||||
} else {
|
|
||||||
initializePlugin();
|
// Register vim actions in command mode
|
||||||
}
|
RegisterActions.registerActions();
|
||||||
|
|
||||||
|
// Register ex handlers
|
||||||
|
CommandParser.getInstance().registerHandlers();
|
||||||
|
|
||||||
|
// Register extensions
|
||||||
|
VimExtensionRegistrar.registerExtensions();
|
||||||
|
|
||||||
|
// Execute ~/.ideavimrc
|
||||||
|
registerIdeavimrc();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void turnOffPlugin() {
|
private void turnOffPlugin() {
|
||||||
@@ -451,8 +424,12 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
ExEntryPanel.fullReset();
|
ExEntryPanel.fullReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean stateUpdated = false;
|
||||||
|
|
||||||
private void updateState() {
|
private void updateState() {
|
||||||
|
if (stateUpdated) return;
|
||||||
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
|
stateUpdated = true;
|
||||||
if (SystemInfo.isMac) {
|
if (SystemInfo.isMac) {
|
||||||
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
|
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
|
||||||
final Boolean enabled = keyRepeat.isEnabled();
|
final Boolean enabled = keyRepeat.isEnabled();
|
||||||
@@ -495,35 +472,27 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
|||||||
public void loadState(@NotNull final Element element) {
|
public void loadState(@NotNull final Element element) {
|
||||||
LOG.debug("Loading state");
|
LOG.debug("Loading state");
|
||||||
|
|
||||||
Runnable setup = () -> {
|
// Restore whether the plugin is enabled or not
|
||||||
// Restore whether the plugin is enabled or not
|
Element state = element.getChild("state");
|
||||||
Element state = element.getChild("state");
|
if (state != null) {
|
||||||
if (state != null) {
|
try {
|
||||||
try {
|
previousStateVersion = Integer.parseInt(state.getAttributeValue("version"));
|
||||||
previousStateVersion = Integer.parseInt(state.getAttributeValue("version"));
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ignored) {
|
|
||||||
}
|
|
||||||
enabled = Boolean.parseBoolean(state.getAttributeValue("enabled"));
|
|
||||||
previousKeyMap = state.getAttributeValue("keymap");
|
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException ignored) {
|
||||||
if (previousStateVersion > 0 && previousStateVersion < 5) {
|
|
||||||
// Migrate settings from 4 to 5 version
|
|
||||||
getMark().readData(element);
|
|
||||||
getRegister().readData(element);
|
|
||||||
getSearch().readData(element);
|
|
||||||
getHistory().readData(element);
|
|
||||||
}
|
}
|
||||||
getKey().readData(element);
|
enabled = Boolean.parseBoolean(state.getAttributeValue("enabled"));
|
||||||
getEditor().readData(element);
|
previousKeyMap = state.getAttributeValue("keymap");
|
||||||
this.state.readData(element);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
|
||||||
setup.run();
|
|
||||||
} else {
|
|
||||||
ApplicationManager.getApplication().executeOnPooledThread(setup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (previousStateVersion > 0 && previousStateVersion < 5) {
|
||||||
|
// Migrate settings from 4 to 5 version
|
||||||
|
getMark().readData(element);
|
||||||
|
getRegister().readData(element);
|
||||||
|
getSearch().readData(element);
|
||||||
|
getHistory().readData(element);
|
||||||
|
}
|
||||||
|
getKey().readData(element);
|
||||||
|
getEditor().readData(element);
|
||||||
|
this.state.readData(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
import com.intellij.codeInsight.lookup.Lookup;
|
|
||||||
import com.intellij.codeInsight.lookup.LookupManager;
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
@@ -27,12 +25,9 @@ import com.intellij.openapi.editor.actionSystem.ActionPlan;
|
|||||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
|
||||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||||
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
|
|
||||||
import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts all regular keystrokes and passes them on to the Vim key handler.
|
* Accepts all regular keystrokes and passes them on to the Vim key handler.
|
||||||
@@ -51,40 +46,16 @@ public class VimTypedActionHandler implements TypedActionHandlerEx {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
|
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
|
||||||
if (isEnabled(editor)) {
|
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
|
||||||
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypedActionHandler originalHandler = handler.getOriginalHandler();
|
|
||||||
if (originalHandler instanceof TypedActionHandlerEx) {
|
|
||||||
((TypedActionHandlerEx)originalHandler).beforeExecute(editor, charTyped, context, plan);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
|
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
|
||||||
if (isEnabled(editor) && charTyped != KeyEvent.CHAR_UNDEFINED) {
|
try {
|
||||||
try {
|
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
||||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
|
||||||
}
|
|
||||||
catch (Throwable e) {
|
|
||||||
logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
catch (Throwable e) {
|
||||||
try (VimListenerSuppressor.Locked ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) {
|
logger.error(e);
|
||||||
TypedActionHandler origHandler = handler.getOriginalHandler();
|
|
||||||
origHandler.execute(editor, charTyped, context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEnabled(@NotNull Editor editor) {
|
|
||||||
if (VimPlugin.isEnabled()) {
|
|
||||||
final Lookup lookup = LookupManager.getActiveLookup(editor);
|
|
||||||
return lookup == null || !lookup.isFocused();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
package com.maddyhome.idea.vim.action
|
||||||
|
|
||||||
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
|
interface ComplicatedKeysAction {
|
||||||
|
val keyStrokesSet: Set<List<KeyStroke>>
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package com.maddyhome.idea.vim.action
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There are some double-character commands like `cc`, `dd`, `yy`.
|
||||||
|
* During the execution these commands are replaced with `c_`, `d_`, `y_`, etc.
|
||||||
|
*
|
||||||
|
* This is not any kind of workaround, this is exactly how the original vim works.
|
||||||
|
* The `dd` command (and others) should not be processed as a monolith command, or it will lead to problems
|
||||||
|
* like this: https://youtrack.jetbrains.com/issue/VIM-1189
|
||||||
|
*
|
||||||
|
* If some command implements this interface, and the user enters motion operator that is the same as the command itself, the
|
||||||
|
* motion operator will be replaced with `_`.
|
||||||
|
*/
|
||||||
|
interface DuplicableOperatorAction {
|
||||||
|
val duplicateWith: Char
|
||||||
|
}
|
@@ -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;
|
|
||||||
|
|
||||||
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 ExEntryAction extends VimActionHandler.SingleExecution {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.NXO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet(":");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.OTHER_READONLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
|
||||||
VimPlugin.getProcess().startExCommand(editor, context, cmd);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
33
src/com/maddyhome/idea/vim/action/ExEntryAction.kt
Normal file
33
src/com/maddyhome/idea/vim/action/ExEntryAction.kt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
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.handler.VimActionHandler
|
||||||
|
|
||||||
|
class ExEntryAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
VimPlugin.getProcess().startExCommand(editor, context, cmd)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
|
||||||
import com.intellij.openapi.editor.Editor;
|
|
||||||
import com.maddyhome.idea.vim.KeyHandler;
|
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.HelperKt;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
public class ResetModeAction extends VimActionHandler.SingleExecution {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.ALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<C-\\><C-N>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.RESET;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
|
||||||
KeyHandler.getInstance().fullReset(HelperKt.getTopLevelEditor(editor));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
34
src/com/maddyhome/idea/vim/action/ResetModeAction.kt
Normal file
34
src/com/maddyhome/idea/vim/action/ResetModeAction.kt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
||||||
|
|
||||||
|
class ResetModeAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.RESET
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
KeyHandler.getInstance().fullReset(editor.getTopLevelEditor())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -1,249 +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;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.intellij.codeInsight.lookup.LookupManager;
|
|
||||||
import com.intellij.openapi.actionSystem.*;
|
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
|
||||||
import com.intellij.openapi.editor.Editor;
|
|
||||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
|
||||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
|
||||||
import com.intellij.openapi.project.DumbAware;
|
|
||||||
import com.intellij.openapi.project.Project;
|
|
||||||
import com.intellij.openapi.util.Key;
|
|
||||||
import com.maddyhome.idea.vim.KeyHandler;
|
|
||||||
import com.maddyhome.idea.vim.RegisterActions;
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
|
||||||
import com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction;
|
|
||||||
import com.maddyhome.idea.vim.command.CommandState;
|
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
|
||||||
import com.maddyhome.idea.vim.helper.CommandStateHelper;
|
|
||||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
|
||||||
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.OptionsManager;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.event.InputEvent;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static java.awt.event.KeyEvent.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles Vim keys that are treated as action shortcuts by the IDE.
|
|
||||||
* <p>
|
|
||||||
* These keys are not passed to {@link com.maddyhome.idea.vim.VimTypedActionHandler} and should be handled by actions.
|
|
||||||
*/
|
|
||||||
public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
|
||||||
private static final String ACTION_ID = "VimShortcutKeyAction";
|
|
||||||
|
|
||||||
@NotNull public static final Set<KeyStroke> VIM_ONLY_EDITOR_KEYS = ImmutableSet.<KeyStroke>builder()
|
|
||||||
.addAll(getKeyStrokes(VK_ENTER, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_ESCAPE, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_TAB, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_BACK_SPACE, 0, CTRL_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_INSERT, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_DELETE, 0, CTRL_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_UP, 0, CTRL_MASK, SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_DOWN, 0, CTRL_MASK, SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_LEFT, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_RIGHT, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_HOME, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_END, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_PAGE_UP, 0, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
|
|
||||||
.addAll(getKeyStrokes(VK_PAGE_DOWN, 0, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
@NotNull private static final Set<KeyStroke> NON_FILE_EDITOR_KEYS = ImmutableSet.<KeyStroke>builder()
|
|
||||||
.addAll(getKeyStrokes(VK_ENTER, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_ESCAPE, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_TAB, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_UP, 0))
|
|
||||||
.addAll(getKeyStrokes(VK_DOWN, 0))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
private static final Logger ourLogger = Logger.getInstance(VimShortcutKeyAction.class.getName());
|
|
||||||
private static AnAction ourInstance = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
|
||||||
final Editor editor = getEditor(e);
|
|
||||||
final KeyStroke keyStroke = getKeyStroke(e);
|
|
||||||
if (editor != null && keyStroke != null) {
|
|
||||||
final ShortcutOwner owner = VimPlugin.getKey().getSavedShortcutConflicts().get(keyStroke);
|
|
||||||
if (owner == ShortcutOwner.UNDEFINED) {
|
|
||||||
VimPlugin.getNotifications(editor.getProject()).notifyAboutShortcutConflict(keyStroke);
|
|
||||||
}
|
|
||||||
// Should we use HelperKt.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
|
|
||||||
try {
|
|
||||||
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
|
|
||||||
}
|
|
||||||
catch (ProcessCanceledException ignored) {
|
|
||||||
// Control-flow exceptions (like ProcessCanceledException) should never be logged
|
|
||||||
// See {@link com.intellij.openapi.diagnostic.Logger.checkException}
|
|
||||||
}
|
|
||||||
catch (Throwable throwable) {
|
|
||||||
ourLogger.error(throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(@NotNull AnActionEvent e) {
|
|
||||||
e.getPresentation().setEnabled(isEnabled(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static AnAction getInstance() {
|
|
||||||
if (ourInstance == null) {
|
|
||||||
final AnAction originalAction = ActionManager.getInstance().getAction(ACTION_ID);
|
|
||||||
ourInstance = EmptyAction.wrap(originalAction);
|
|
||||||
}
|
|
||||||
return ourInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isEnabled(@NotNull AnActionEvent e) {
|
|
||||||
if (!VimPlugin.isEnabled()) return false;
|
|
||||||
|
|
||||||
final Editor editor = getEditor(e);
|
|
||||||
final KeyStroke keyStroke = getKeyStroke(e);
|
|
||||||
if (editor != null && keyStroke != null) {
|
|
||||||
// Workaround for smart step into
|
|
||||||
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 (IdeaSpecifics.INSTANCE.aceJumpActive()) return false;
|
|
||||||
|
|
||||||
final int keyCode = keyStroke.getKeyCode();
|
|
||||||
if (LookupManager.getActiveLookup(editor) != null && !passCommandToVimWithLookup(keyStroke)) {
|
|
||||||
return isEnabledForLookup(keyStroke);
|
|
||||||
}
|
|
||||||
if (keyCode == VK_ESCAPE) {
|
|
||||||
return isEnabledForEscape(editor);
|
|
||||||
}
|
|
||||||
if (CommandStateHelper.inInsertMode(editor)) {
|
|
||||||
// XXX: <Tab> won't be recorded in macros
|
|
||||||
if (keyCode == VK_TAB) {
|
|
||||||
VimPlugin.getChange().tabAction = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Debug watch, Python console, etc.
|
|
||||||
if (NON_FILE_EDITOR_KEYS.contains(keyStroke) && !EditorHelper.isFileEditor(editor)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VIM_ONLY_EDITOR_KEYS.contains(keyStroke)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final Map<KeyStroke, ShortcutOwner> savedShortcutConflicts = VimPlugin.getKey().getSavedShortcutConflicts();
|
|
||||||
final ShortcutOwner owner = savedShortcutConflicts.get(keyStroke);
|
|
||||||
if (owner == ShortcutOwner.VIM) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (owner == ShortcutOwner.IDE) {
|
|
||||||
return !isShortcutConflict(keyStroke);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (isShortcutConflict(keyStroke)) {
|
|
||||||
savedShortcutConflicts.put(keyStroke, ShortcutOwner.UNDEFINED);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean passCommandToVimWithLookup(@NotNull KeyStroke keyStroke) {
|
|
||||||
final ListOption popupActions = OptionsManager.INSTANCE.getLookupActions();
|
|
||||||
final List<String> values = popupActions.values();
|
|
||||||
if (values == null) return false;
|
|
||||||
|
|
||||||
return values.stream().anyMatch(actionId -> {
|
|
||||||
final EditorActionHandlerBase action = RegisterActions.findAction(actionId);
|
|
||||||
if (action == null) return false;
|
|
||||||
return action.getKeyStrokesSet().stream()
|
|
||||||
.anyMatch(ks -> !ks.isEmpty() && ks.get(0).equals(keyStroke));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isEnabledForEscape(@NotNull Editor editor) {
|
|
||||||
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
|
|
||||||
return isPrimaryEditor(editor) || (EditorHelper.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the editor is a primary editor in the main editing area.
|
|
||||||
*/
|
|
||||||
private boolean isPrimaryEditor(@NotNull Editor editor) {
|
|
||||||
final Project project = editor.getProject();
|
|
||||||
if (project == null) return false;
|
|
||||||
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
|
|
||||||
if (fileEditorManager == null) return false;
|
|
||||||
return Arrays.stream(fileEditorManager.getAllEditors())
|
|
||||||
.anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isEnabledForLookup(@NotNull KeyStroke keyStroke) {
|
|
||||||
for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) {
|
|
||||||
// XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux
|
|
||||||
if (keys.size() == 1 && keyStroke.equals(keys.get(0))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//noinspection RedundantIfStatement
|
|
||||||
if (keyStroke.equals(KeyStroke.getKeyStroke(VK_BACK_SPACE, 0))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isShortcutConflict(@NotNull KeyStroke keyStroke) {
|
|
||||||
return !VimPlugin.getKey().getKeymapConflicts(keyStroke).isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private static List<KeyStroke> getKeyStrokes(int keyCode, @NotNull int... modifiers) {
|
|
||||||
final List<KeyStroke> keyStrokes = new ArrayList<>();
|
|
||||||
for (int modifier : modifiers) {
|
|
||||||
keyStrokes.add(KeyStroke.getKeyStroke(keyCode, modifier));
|
|
||||||
}
|
|
||||||
return keyStrokes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private KeyStroke getKeyStroke(@NotNull AnActionEvent e) {
|
|
||||||
final InputEvent inputEvent = e.getInputEvent();
|
|
||||||
if (inputEvent instanceof KeyEvent) {
|
|
||||||
final KeyEvent keyEvent = (KeyEvent)inputEvent;
|
|
||||||
return KeyStroke.getKeyStrokeForEvent(keyEvent);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private Editor getEditor(@NotNull AnActionEvent e) {
|
|
||||||
return e.getData(PlatformDataKeys.EDITOR);
|
|
||||||
}
|
|
||||||
}
|
|
224
src/com/maddyhome/idea/vim/action/VimShortcutKeyAction.kt
Normal file
224
src/com/maddyhome/idea/vim/action/VimShortcutKeyAction.kt
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet
|
||||||
|
import com.intellij.codeInsight.lookup.LookupManager
|
||||||
|
import com.intellij.openapi.actionSystem.ActionManager
|
||||||
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
import com.intellij.openapi.actionSystem.EmptyAction
|
||||||
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.intellij.openapi.editor.ex.util.EditorUtil
|
||||||
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
||||||
|
import com.intellij.openapi.progress.ProcessCanceledException
|
||||||
|
import com.intellij.openapi.project.DumbAware
|
||||||
|
import com.intellij.openapi.util.Key
|
||||||
|
import com.intellij.ui.KeyStrokeAdapter
|
||||||
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase.Companion.parseKeysSet
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorDataContext
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.StringHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.inInsertMode
|
||||||
|
import com.maddyhome.idea.vim.helper.inNormalMode
|
||||||
|
import com.maddyhome.idea.vim.key.ShortcutOwner
|
||||||
|
import com.maddyhome.idea.vim.listener.IdeaSpecifics.aceJumpActive
|
||||||
|
import com.maddyhome.idea.vim.option.OptionsManager.lookupKeys
|
||||||
|
import java.awt.event.InputEvent
|
||||||
|
import java.awt.event.KeyEvent
|
||||||
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles Vim keys that are treated as action shortcuts by the IDE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* These keys are not passed to [com.maddyhome.idea.vim.VimTypedActionHandler] and should be handled by actions.
|
||||||
|
*/
|
||||||
|
class VimShortcutKeyAction : AnAction(), DumbAware {
|
||||||
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
|
val editor = getEditor(e)
|
||||||
|
val keyStroke = getKeyStroke(e)
|
||||||
|
if (editor != null && keyStroke != null) {
|
||||||
|
val owner = VimPlugin.getKey().savedShortcutConflicts[keyStroke]
|
||||||
|
if (owner == ShortcutOwner.UNDEFINED) {
|
||||||
|
VimPlugin.getNotifications(editor.project).notifyAboutShortcutConflict(keyStroke)
|
||||||
|
}
|
||||||
|
// Should we use HelperKt.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
|
||||||
|
try {
|
||||||
|
KeyHandler.getInstance().handleKey(editor, keyStroke, EditorDataContext(editor))
|
||||||
|
} catch (ignored: ProcessCanceledException) {
|
||||||
|
// Control-flow exceptions (like ProcessCanceledException) should never be logged
|
||||||
|
// See {@link com.intellij.openapi.diagnostic.Logger.checkException}
|
||||||
|
} catch (throwable: Throwable) {
|
||||||
|
ourLogger.error(throwable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun update(e: AnActionEvent) {
|
||||||
|
e.presentation.isEnabled = isEnabled(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isEnabled(e: AnActionEvent): Boolean {
|
||||||
|
if (!VimPlugin.isEnabled()) return false
|
||||||
|
val editor = getEditor(e)
|
||||||
|
val keyStroke = getKeyStroke(e)
|
||||||
|
if (editor != null && keyStroke != null) {
|
||||||
|
// Workaround for smart step into
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
val 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 (aceJumpActive()) return false
|
||||||
|
val keyCode = keyStroke.keyCode
|
||||||
|
if (LookupManager.getActiveLookup(editor) != null) {
|
||||||
|
return isEnabledForLookup(keyStroke)
|
||||||
|
}
|
||||||
|
if (keyCode == KeyEvent.VK_ESCAPE) {
|
||||||
|
return isEnabledForEscape(editor)
|
||||||
|
}
|
||||||
|
if (editor.inInsertMode) { // XXX: <Tab> won't be recorded in macros
|
||||||
|
if (keyCode == KeyEvent.VK_TAB) {
|
||||||
|
VimPlugin.getChange().tabAction = true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Debug watch, Python console, etc.
|
||||||
|
if (NON_FILE_EDITOR_KEYS.contains(keyStroke) && !EditorHelper.isFileEditor(editor)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (VIM_ONLY_EDITOR_KEYS.contains(keyStroke)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
val savedShortcutConflicts = VimPlugin.getKey().savedShortcutConflicts
|
||||||
|
return when (savedShortcutConflicts[keyStroke]) {
|
||||||
|
ShortcutOwner.VIM -> true
|
||||||
|
ShortcutOwner.IDE -> !isShortcutConflict(keyStroke)
|
||||||
|
else -> {
|
||||||
|
if (isShortcutConflict(keyStroke)) {
|
||||||
|
savedShortcutConflicts[keyStroke] = ShortcutOwner.UNDEFINED
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isEnabledForEscape(editor: Editor): Boolean {
|
||||||
|
return isPrimaryEditor(editor) || EditorHelper.isFileEditor(editor) && !editor.inNormalMode
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the editor is a primary editor in the main editing area.
|
||||||
|
*/
|
||||||
|
private fun isPrimaryEditor(editor: Editor): Boolean {
|
||||||
|
val project = editor.project ?: return false
|
||||||
|
val fileEditorManager = FileEditorManagerEx.getInstanceEx(project) ?: return false
|
||||||
|
return fileEditorManager.allEditors.any { fileEditor -> editor == EditorUtil.getEditorEx(fileEditor) }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isEnabledForLookup(keyStroke: KeyStroke): Boolean {
|
||||||
|
val notAllowedKeys = parseKeysSet(
|
||||||
|
"<Tab>", "<Down>", "<Up>", "<Enter>", "<Left>", "<Right>",
|
||||||
|
// New line in vim, but QuickDoc on MacOs
|
||||||
|
"<C-J>"
|
||||||
|
)
|
||||||
|
for (keys in notAllowedKeys) {
|
||||||
|
if (keyStroke == keys[0]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We allow users to set custom keys that will work with lookup in case devs forgot something
|
||||||
|
val popupActions = lookupKeys
|
||||||
|
val values = popupActions.values()
|
||||||
|
for (value in values) {
|
||||||
|
val keys = StringHelper.parseKeys(value)
|
||||||
|
if (keys.size >= 1 && keyStroke == keys[0]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isShortcutConflict(keyStroke: KeyStroke): Boolean {
|
||||||
|
return VimPlugin.getKey().getKeymapConflicts(keyStroke).isNotEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getDefaultKeyStroke is needed for NEO layout keyboard VIM-987
|
||||||
|
* but we should cache the value because on the second call (isEnabled -> actionPerformed)
|
||||||
|
* the event is already consumed
|
||||||
|
*/
|
||||||
|
private var keyStrokeCache: Pair<KeyEvent?, KeyStroke?> = null to null
|
||||||
|
|
||||||
|
private fun getKeyStroke(e: AnActionEvent): KeyStroke? {
|
||||||
|
val inputEvent = e.inputEvent
|
||||||
|
if (inputEvent is KeyEvent) {
|
||||||
|
val defaultKeyStroke = KeyStrokeAdapter.getDefaultKeyStroke(inputEvent)
|
||||||
|
val strokeCache = keyStrokeCache
|
||||||
|
if (defaultKeyStroke != null) {
|
||||||
|
keyStrokeCache = inputEvent to defaultKeyStroke
|
||||||
|
return defaultKeyStroke
|
||||||
|
} else if (strokeCache.first === inputEvent) {
|
||||||
|
keyStrokeCache = null to null
|
||||||
|
return strokeCache.second
|
||||||
|
}
|
||||||
|
return KeyStroke.getKeyStrokeForEvent(inputEvent)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getEditor(e: AnActionEvent): Editor? = e.getData(PlatformDataKeys.EDITOR)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmField
|
||||||
|
val VIM_ONLY_EDITOR_KEYS: Set<KeyStroke> = ImmutableSet.builder<KeyStroke>().addAll(getKeyStrokes(KeyEvent.VK_ENTER, 0)).addAll(getKeyStrokes(KeyEvent.VK_ESCAPE, 0))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_TAB, 0)).addAll(getKeyStrokes(KeyEvent.VK_BACK_SPACE, 0, InputEvent.CTRL_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_INSERT, 0)).addAll(getKeyStrokes(KeyEvent.VK_DELETE, 0, InputEvent.CTRL_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_UP, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK)).addAll(getKeyStrokes(KeyEvent.VK_DOWN, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_LEFT, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_RIGHT, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_HOME, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_END, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_PAGE_UP, 0, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_PAGE_DOWN, 0, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK)).build()
|
||||||
|
|
||||||
|
private const val ACTION_ID = "VimShortcutKeyAction"
|
||||||
|
|
||||||
|
private val NON_FILE_EDITOR_KEYS: Set<KeyStroke> = ImmutableSet.builder<KeyStroke>()
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_ENTER, 0))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_ESCAPE, 0))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_TAB, 0))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_UP, 0))
|
||||||
|
.addAll(getKeyStrokes(KeyEvent.VK_DOWN, 0))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
private val ourLogger = Logger.getInstance(VimShortcutKeyAction::class.java.name)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val instance: AnAction by lazy {
|
||||||
|
EmptyAction.wrap(ActionManager.getInstance().getAction(ACTION_ID))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getKeyStrokes(keyCode: Int, vararg modifiers: Int) = modifiers.map { KeyStroke.getKeyStroke(keyCode, it) }
|
||||||
|
}
|
||||||
|
}
|
@@ -1,91 +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.KeyHandler;
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
|
||||||
import com.maddyhome.idea.vim.command.*;
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
|
||||||
import com.maddyhome.idea.vim.group.MotionGroup;
|
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.MessageHelper;
|
|
||||||
import com.maddyhome.idea.vim.key.OperatorFunction;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class OperatorAction extends VimActionHandler.SingleExecution {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("g@");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.OTHER_SELF_SYNCHRONIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Argument.Type getArgumentType() {
|
|
||||||
return Argument.Type.MOTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
|
||||||
final OperatorFunction operatorFunction = VimPlugin.getKey().getOperatorFunction();
|
|
||||||
if (operatorFunction != null) {
|
|
||||||
final Argument argument = cmd.getArgument();
|
|
||||||
if (argument != null) {
|
|
||||||
final Command motion = argument.getMotion();
|
|
||||||
final TextRange range = MotionGroup
|
|
||||||
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(),
|
|
||||||
cmd.getRawCount(), argument);
|
|
||||||
if (range != null) {
|
|
||||||
VimPlugin.getMark().setChangeMarks(editor, range);
|
|
||||||
final SelectionType selectionType = SelectionType.fromCommandFlags(motion.getFlags());
|
|
||||||
KeyHandler.getInstance().reset(editor);
|
|
||||||
return operatorFunction.apply(editor, context, selectionType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
VimPlugin.showMessage(MessageHelper.message("E774"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
63
src/com/maddyhome/idea/vim/action/change/OperatorAction.kt
Normal file
63
src/com/maddyhome/idea/vim/action/change/OperatorAction.kt
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* 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.KeyHandler
|
||||||
|
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.SelectionType
|
||||||
|
import com.maddyhome.idea.vim.group.MotionGroup
|
||||||
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.commandState
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class OperatorAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
val operatorFunction = VimPlugin.getKey().operatorFunction
|
||||||
|
if (operatorFunction != null) {
|
||||||
|
val argument = cmd.argument
|
||||||
|
if (argument != null) {
|
||||||
|
if (!editor.commandState.isDotRepeatInProgress) {
|
||||||
|
VimRepeater.Extension.argumentCaptured = argument
|
||||||
|
}
|
||||||
|
val motion = argument.motion
|
||||||
|
val range = MotionGroup
|
||||||
|
.getMotionRange(editor, editor.caretModel.primaryCaret, context, cmd.count, cmd.rawCount, argument)
|
||||||
|
if (range != null) {
|
||||||
|
VimPlugin.getMark().setChangeMarks(editor, range)
|
||||||
|
val selectionType = SelectionType.fromCommandFlags(motion.flags)
|
||||||
|
KeyHandler.getInstance().reset(editor)
|
||||||
|
return operatorFunction.apply(editor, context, selectionType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
VimPlugin.showMessage(MessageHelper.message("E774"))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
@@ -1,57 +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.handler.VimActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
public class RedoAction extends VimActionHandler.SingleExecution {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<C-R>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 UndoRedoHelper.INSTANCE.redo(context);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -15,28 +15,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* 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.change
|
||||||
|
|
||||||
package com.maddyhome.idea.vim.option;
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.UndoRedoHelper.redo
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
class RedoAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||||
|
|
||||||
import java.util.EventObject;
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean = redo(context)
|
||||||
|
|
||||||
/**
|
|
||||||
* This event indicates that the value of the option has changed
|
|
||||||
*/
|
|
||||||
public class OptionChangeEvent extends EventObject {
|
|
||||||
public OptionChangeEvent(Option option) {
|
|
||||||
super(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the changed option.
|
|
||||||
*
|
|
||||||
* @return The changed option
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
public Option getOption() {
|
|
||||||
return (Option)getSource();
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -1,98 +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.KeyHandler;
|
|
||||||
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.CommandState;
|
|
||||||
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 RepeatChangeAction 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 command) {
|
|
||||||
CommandState state = CommandState.getInstance(editor);
|
|
||||||
Command cmd = state.getLastChangeCommand();
|
|
||||||
|
|
||||||
if (cmd != null) {
|
|
||||||
if (command.getRawCount() > 0) {
|
|
||||||
cmd.setCount(command.getCount());
|
|
||||||
Argument arg = cmd.getArgument();
|
|
||||||
if (arg != null) {
|
|
||||||
Command mot = arg.getMotion();
|
|
||||||
mot.setCount(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Command save = state.getCommand();
|
|
||||||
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
|
|
||||||
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
|
|
||||||
|
|
||||||
state.setCommand(cmd);
|
|
||||||
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
|
|
||||||
char reg = VimPlugin.getRegister().getCurrentRegister();
|
|
||||||
VimPlugin.getRegister().selectRegister(state.getLastChangeRegister());
|
|
||||||
try {
|
|
||||||
KeyHandler.executeVimAction(editor, cmd.getAction(), context);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
// oops
|
|
||||||
}
|
|
||||||
state.popState();
|
|
||||||
if (save != null) {
|
|
||||||
state.setCommand(save);
|
|
||||||
}
|
|
||||||
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
|
|
||||||
state.saveLastChangeCommand(cmd);
|
|
||||||
VimPlugin.getRegister().selectRegister(reg);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
141
src/com/maddyhome/idea/vim/action/change/RepeatChangeAction.kt
Normal file
141
src/com/maddyhome/idea/vim/action/change/RepeatChangeAction.kt
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
* 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.command.CommandProcessor
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
|
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.extension.VimExtensionHandler
|
||||||
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.commandState
|
||||||
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
|
class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_WRITABLE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
val state = editor.commandState
|
||||||
|
val lastCommand = VimRepeater.lastChangeCommand
|
||||||
|
|
||||||
|
if (lastCommand == null && VimRepeater.Extension.lastExtensionHandler == null) return false
|
||||||
|
|
||||||
|
// Save state
|
||||||
|
val save = state.command
|
||||||
|
val lastFTCmd = VimPlugin.getMotion().lastFTCmd
|
||||||
|
val lastFTChar = VimPlugin.getMotion().lastFTChar
|
||||||
|
val reg = VimPlugin.getRegister().currentRegister
|
||||||
|
val lastHandler = VimRepeater.Extension.lastExtensionHandler
|
||||||
|
val repeatHandler = VimRepeater.repeatHandler
|
||||||
|
|
||||||
|
state.isDotRepeatInProgress = true
|
||||||
|
VimPlugin.getRegister().selectRegister(VimRepeater.lastChangeRegister)
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (repeatHandler && lastHandler != null) {
|
||||||
|
val processor = CommandProcessor.getInstance()
|
||||||
|
processor.executeCommand(editor.project, { lastHandler.execute(editor, context) }, "Vim " + lastHandler.javaClass.simpleName, null)
|
||||||
|
} else if (!repeatHandler && lastCommand != null) {
|
||||||
|
if (cmd.rawCount > 0) {
|
||||||
|
lastCommand.count = cmd.count
|
||||||
|
val arg = lastCommand.argument
|
||||||
|
if (arg != null) {
|
||||||
|
val mot = arg.motion
|
||||||
|
mot.count = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state.setCommand(lastCommand)
|
||||||
|
|
||||||
|
KeyHandler.executeVimAction(editor, lastCommand.action, context)
|
||||||
|
|
||||||
|
VimRepeater.saveLastChange(lastCommand)
|
||||||
|
}
|
||||||
|
} catch (ignored: Exception) {
|
||||||
|
}
|
||||||
|
|
||||||
|
state.isDotRepeatInProgress = false
|
||||||
|
|
||||||
|
// Restore state
|
||||||
|
if (save != null) state.setCommand(save)
|
||||||
|
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar)
|
||||||
|
if (lastHandler != null) VimRepeater.Extension.lastExtensionHandler = lastHandler
|
||||||
|
VimRepeater.repeatHandler = repeatHandler
|
||||||
|
VimRepeater.Extension.reset()
|
||||||
|
VimPlugin.getRegister().selectRegister(reg)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object VimRepeater {
|
||||||
|
var repeatHandler = false
|
||||||
|
|
||||||
|
var lastChangeCommand: Command? = null
|
||||||
|
private set
|
||||||
|
var lastChangeRegister = VimPlugin.getRegister().defaultRegister
|
||||||
|
private set
|
||||||
|
|
||||||
|
fun saveLastChange(command: Command) {
|
||||||
|
lastChangeCommand = command
|
||||||
|
lastChangeRegister = VimPlugin.getRegister().currentRegister
|
||||||
|
}
|
||||||
|
|
||||||
|
object Extension {
|
||||||
|
var lastExtensionHandler: VimExtensionHandler? = null
|
||||||
|
var argumentCaptured: Argument? = null
|
||||||
|
|
||||||
|
private val keyStrokes = mutableListOf<KeyStroke>()
|
||||||
|
private val strings = mutableListOf<String>()
|
||||||
|
|
||||||
|
private var keystrokePointer = 0
|
||||||
|
private var stringPointer = 0
|
||||||
|
|
||||||
|
fun addKeystroke(key: KeyStroke) = keyStrokes.add(key)
|
||||||
|
fun addString(key: String) = strings.add(key)
|
||||||
|
|
||||||
|
fun consumeKeystroke(): KeyStroke? {
|
||||||
|
if (keystrokePointer in keyStrokes.indices) {
|
||||||
|
keystrokePointer += 1
|
||||||
|
return keyStrokes[keystrokePointer - 1]
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun consumeString(): String? {
|
||||||
|
if (stringPointer in strings.indices) {
|
||||||
|
stringPointer += 1
|
||||||
|
return strings[stringPointer - 1]
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun reset() {
|
||||||
|
keystrokePointer = 0
|
||||||
|
stringPointer = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clean() {
|
||||||
|
keyStrokes.clear()
|
||||||
|
strings.clear()
|
||||||
|
keystrokePointer = 0
|
||||||
|
stringPointer = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.handler.VimActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
|
|
||||||
|
|
||||||
|
|
||||||
public class UndoAction extends VimActionHandler.SingleExecution {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
Set<List<KeyStroke>> keys = new HashSet<>();
|
|
||||||
keys.add(parseKeys("u"));
|
|
||||||
keys.add(Collections.singletonList(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0)));
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 UndoRedoHelper.INSTANCE.undo(context);
|
|
||||||
}
|
|
||||||
}
|
|
39
src/com/maddyhome/idea/vim/action/change/UndoAction.kt
Normal file
39
src/com/maddyhome/idea/vim/action/change/UndoAction.kt
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.action.ComplicatedKeysAction
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.StringHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.UndoRedoHelper.undo
|
||||||
|
import java.awt.event.KeyEvent
|
||||||
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
|
class UndoAction : VimActionHandler.SingleExecution(), ComplicatedKeysAction {
|
||||||
|
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
|
||||||
|
StringHelper.parseKeys("u"),
|
||||||
|
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
|
||||||
|
)
|
||||||
|
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean = undo(context)
|
||||||
|
}
|
@@ -1,77 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class AutoIndentLinesVisualAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("=");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
VimPlugin.getChange().autoIndentRange(editor, caret, context, range.toVimTextRange(true));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class AutoIndentLinesVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
VimPlugin.getChange().autoIndentRange(editor, caret, context, range.toVimTextRange(true))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -1,76 +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.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 com.maddyhome.idea.vim.helper.CharacterHelper;
|
|
||||||
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 ChangeCaseLowerMotionAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("gu");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Argument.Type getArgumentType() {
|
|
||||||
return Argument.Type.MOTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return argument != null &&
|
|
||||||
VimPlugin.getChange()
|
|
||||||
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction
|
||||||
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||||
|
|
||||||
|
class ChangeCaseLowerMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
|
override val duplicateWith: Char = 'u'
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange()
|
||||||
|
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,80 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
|
||||||
import com.maddyhome.idea.vim.helper.HelperKt;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeCaseLowerVisualAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("u");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
final Editor topLevelEditor = HelperKt.getTopLevelEditor(editor);
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeCaseRange(topLevelEditor, caret, range.toVimTextRange(false), CharacterHelper.CASE_LOWER);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeCaseLowerVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
val topLevelEditor = editor.getTopLevelEditor()
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeCaseRange(topLevelEditor, caret, range.toVimTextRange(false), CharacterHelper.CASE_LOWER)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.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 ChangeCaseToggleCharacterAction 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) {
|
|
||||||
return VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class ChangeCaseToggleCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,76 +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.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 com.maddyhome.idea.vim.helper.CharacterHelper;
|
|
||||||
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 ChangeCaseToggleMotionAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("g~");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Argument.Type getArgumentType() {
|
|
||||||
return Argument.Type.MOTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return argument != null &&
|
|
||||||
VimPlugin.getChange()
|
|
||||||
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction
|
||||||
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||||
|
|
||||||
|
class ChangeCaseToggleMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
|
override val duplicateWith: Char = '~'
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange()
|
||||||
|
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,78 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeCaseToggleVisualAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("~");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeCaseRange(editor, caret, range.toVimTextRange(false), CharacterHelper.CASE_TOGGLE);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeCaseToggleVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeCaseRange(editor, caret, range.toVimTextRange(false), CharacterHelper.CASE_TOGGLE)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,76 +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.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 com.maddyhome.idea.vim.helper.CharacterHelper;
|
|
||||||
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 ChangeCaseUpperMotionAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("gU");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Argument.Type getArgumentType() {
|
|
||||||
return Argument.Type.MOTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return argument != null &&
|
|
||||||
VimPlugin.getChange()
|
|
||||||
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_UPPER, argument);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction
|
||||||
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||||
|
|
||||||
|
class ChangeCaseUpperMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
|
override val duplicateWith: Char = 'U'
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange()
|
||||||
|
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_UPPER, argument)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,78 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeCaseUpperVisualAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("U");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeCaseRange(editor, caret, range.toVimTextRange(false), CharacterHelper.CASE_UPPER);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeCaseUpperVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeCaseRange(editor, caret, range.toVimTextRange(false), CharacterHelper.CASE_UPPER)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,79 +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.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 ChangeCharacterAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("r");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Argument.Type getArgumentType() {
|
|
||||||
return Argument.Type.DIGRAPH;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_ALLOW_DIGRAPH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return argument != null && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.getCharacter());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.DIGRAPH
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_ALLOW_DIGRAPH)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return argument != null && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.character)
|
||||||
|
}
|
||||||
|
}
|
@@ -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.change;
|
|
||||||
|
|
||||||
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 ChangeCharactersAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("s");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_MULTIKEY_UNDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return VimPlugin.getChange().changeCharacters(editor, caret, count);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeCharactersAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_NO_REPEAT_INSERT, CommandFlags.FLAG_MULTIKEY_UNDO)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().changeCharacters(editor, caret, count)
|
||||||
|
}
|
||||||
|
}
|
@@ -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.change;
|
|
||||||
|
|
||||||
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 ChangeEndOfLineAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("C");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_MULTIKEY_UNDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return VimPlugin.getChange().changeEndOfLine(editor, caret, count);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeEndOfLineAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_NO_REPEAT_INSERT, CommandFlags.FLAG_MULTIKEY_UNDO)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().changeEndOfLine(editor, caret, count)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,67 +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.Argument;
|
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.ex.LineRange;
|
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
public class ChangeLastGlobalSearchReplaceAction extends ChangeEditorActionHandler.SingleExecution {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("g&");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.OTHER_SELF_SYNCHRONIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
|
|
||||||
return VimPlugin.getSearch()
|
|
||||||
.searchAndReplace(editor, editor.getCaretModel().getPrimaryCaret(), range, "s", "//~/&");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.ex.LineRange
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
|
||||||
|
class ChangeLastGlobalSearchReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
val range = LineRange(0, EditorHelper.getLineCount(editor) - 1)
|
||||||
|
return VimPlugin.getSearch()
|
||||||
|
.searchAndReplace(editor, editor.caretModel.primaryCaret, range, "s", "//~/&")
|
||||||
|
}
|
||||||
|
}
|
@@ -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.change;
|
|
||||||
|
|
||||||
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.ex.LineRange;
|
|
||||||
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 ChangeLastSearchReplaceAction extends ChangeEditorActionHandler.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,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
boolean result = true;
|
|
||||||
for (Caret caret : editor.getCaretModel().getAllCarets()) {
|
|
||||||
final int line = caret.getLogicalPosition().line;
|
|
||||||
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, new LineRange(line, line), "s", "//~/")) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.ex.LineRange
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class ChangeLastSearchReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
var result = true
|
||||||
|
for (caret in editor.caretModel.allCarets) {
|
||||||
|
val line = caret.logicalPosition.line
|
||||||
|
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, LineRange(line, line), "s", "//~/")) {
|
||||||
|
result = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
@@ -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.change;
|
|
||||||
|
|
||||||
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 ChangeLineAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("S");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_MULTIKEY_UNDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return VimPlugin.getChange().changeLine(editor, caret, count, context);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeLineAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_NO_REPEAT_INSERT, CommandFlags.FLAG_MULTIKEY_UNDO)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().changeLine(editor, caret, count, context)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,79 +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.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 ChangeMotionAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("c");
|
|
||||||
}
|
|
||||||
|
|
||||||
@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_DUPLICABLE_OPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return argument != null && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction
|
||||||
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class ChangeMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
|
override val duplicateWith: Char = 'c'
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return argument != null && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,72 +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.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 ChangeReplaceAction extends ChangeEditorActionHandler.SingleExecution {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("R");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
VimPlugin.getChange().changeReplace(editor, context);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MULTIKEY_UNDO)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
VimPlugin.getChange().changeReplace(editor, context)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -1,77 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeVisualAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("c", "s");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
|
|
||||||
return VimPlugin.getChange().changeRange(editor, caret, range.toVimTextRange(false), range.getType(), context);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange().changeRange(editor, caret, range.toVimTextRange(false), range.type, context)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,86 +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.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.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeVisualCharacterAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("r");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Argument.Type getArgumentType() {
|
|
||||||
return Argument.Type.DIGRAPH;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_ALLOW_DIGRAPH, CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
final Argument argument = cmd.getArgument();
|
|
||||||
return argument != null &&
|
|
||||||
VimPlugin.getChange().changeCharacterRange(editor, range.toVimTextRange(false), argument.getCharacter());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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.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.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeVisualCharacterAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.DIGRAPH
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_ALLOW_DIGRAPH, CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
val argument = cmd.argument
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange().changeCharacterRange(editor, range.toVimTextRange(false), argument.character)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,83 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeVisualLinesAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("R", "S");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
final TextRange textRange = range.toVimTextRange(true);
|
|
||||||
|
|
||||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, textRange.getStartOffset()),
|
|
||||||
EditorHelper.getLineEndForOffset(editor, textRange.getEndOffset()) + 1);
|
|
||||||
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE, context);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.SelectionType
|
||||||
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeVisualLinesAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
val textRange = range.toVimTextRange(true)
|
||||||
|
val lineRange = TextRange(EditorHelper.getLineStartForOffset(editor, textRange.startOffset),
|
||||||
|
EditorHelper.getLineEndForOffset(editor, textRange.endOffset) + 1)
|
||||||
|
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE, context)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,96 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ChangeVisualLinesEndAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("C");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
TextRange vimTextRange = range.toVimTextRange(true);
|
|
||||||
if (range.getType() == SelectionType.BLOCK_WISE && vimTextRange.isMultiple()) {
|
|
||||||
final int[] starts = vimTextRange.getStartOffsets();
|
|
||||||
final int[] ends = vimTextRange.getEndOffsets();
|
|
||||||
for (int i = 0; i < starts.length; i++) {
|
|
||||||
if (ends[i] > starts[i]) {
|
|
||||||
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final TextRange blockRange = new TextRange(starts, ends);
|
|
||||||
return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE, context);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final TextRange lineRange =
|
|
||||||
new TextRange(EditorHelper.getLineStartForOffset(editor, vimTextRange.getStartOffset()),
|
|
||||||
EditorHelper.getLineEndForOffset(editor, vimTextRange.getEndOffset()) + 1);
|
|
||||||
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.SelectionType
|
||||||
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ChangeVisualLinesEndAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
val vimTextRange = range.toVimTextRange(true)
|
||||||
|
return if (range.type == SelectionType.BLOCK_WISE && vimTextRange.isMultiple) {
|
||||||
|
val starts = vimTextRange.startOffsets
|
||||||
|
val ends = vimTextRange.endOffsets
|
||||||
|
for (i in starts.indices) {
|
||||||
|
if (ends[i] > starts[i]) {
|
||||||
|
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val blockRange = TextRange(starts, ends)
|
||||||
|
VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE, context)
|
||||||
|
} else {
|
||||||
|
val lineRange = TextRange(EditorHelper.getLineStartForOffset(editor, vimTextRange.startOffset),
|
||||||
|
EditorHelper.getLineEndForOffset(editor, vimTextRange.endOffset) + 1)
|
||||||
|
VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -21,28 +21,21 @@ package com.maddyhome.idea.vim.action.change.change
|
|||||||
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.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction
|
||||||
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.group.MotionGroup
|
import com.maddyhome.idea.vim.group.MotionGroup
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.endOffsetInclusive
|
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() {
|
class FilterMotionAction : VimActionHandler.SingleExecution(), DuplicableOperatorAction {
|
||||||
override val mappingModes: Set<MappingMode> = MappingMode.N
|
|
||||||
|
|
||||||
override val keyStrokesSet: Set<List<KeyStroke>> = parseKeysSet("!")
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.CHANGE
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_DUPLICABLE_OPERATOR)
|
override val duplicateWith: Char = '!'
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
val argument = cmd.argument ?: return false
|
val argument = cmd.argument ?: return false
|
||||||
|
@@ -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.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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler;
|
|
||||||
import com.maddyhome.idea.vim.helper.ModeHelper;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class FilterVisualLinesAction extends VimActionHandler.SingleExecution {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
|
||||||
VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
|
|
||||||
ModeHelper.exitVisualMode(editor);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import com.maddyhome.idea.vim.helper.exitVisualMode
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class FilterVisualLinesAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
VimPlugin.getProcess().startFilterCommand(editor, context, cmd)
|
||||||
|
editor.exitVisualMode()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.DuplicableOperatorAction
|
||||||
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class ReformatCodeMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||||
|
|
||||||
|
override val duplicateWith: Char = 'q'
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange().reformatCodeMotion(editor, caret, context, count, rawCount, argument)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,77 +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.Caret;
|
|
||||||
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.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author vlan
|
|
||||||
*/
|
|
||||||
final public class ReformatCodeVisualAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("gq");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
VimPlugin.getChange().reformatCode(editor, range);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.Caret
|
||||||
|
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.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
class ReformatCodeVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
VimPlugin.getChange().reformatCodeSelection(editor, caret, range)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.number;
|
|
||||||
|
|
||||||
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 ChangeNumberDecAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<C-X>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@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) {
|
|
||||||
return VimPlugin.getChange().changeNumber(editor, caret, -count);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.number
|
||||||
|
|
||||||
|
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.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class ChangeNumberDecAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().changeNumber(editor, caret, -count)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.number;
|
|
||||||
|
|
||||||
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 ChangeNumberIncAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<C-A>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@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) {
|
|
||||||
return VimPlugin.getChange().changeNumber(editor, caret, count);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.number
|
||||||
|
|
||||||
|
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.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class ChangeNumberIncAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().changeNumber(editor, caret, count)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,74 +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.number;
|
|
||||||
|
|
||||||
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.Command;
|
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
final public class ChangeVisualNumberAvalancheDecAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("g<C-X>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.getCount(), true);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.number
|
||||||
|
|
||||||
|
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.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeVisualNumberAvalancheDecAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.count, true)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,74 +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.number;
|
|
||||||
|
|
||||||
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.Command;
|
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
final public class ChangeVisualNumberAvalancheIncAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("g<C-A>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.getCount(), true);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.number
|
||||||
|
|
||||||
|
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.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeVisualNumberAvalancheIncAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, true)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,74 +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.number;
|
|
||||||
|
|
||||||
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.Command;
|
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
final public class ChangeVisualNumberDecAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<C-X>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.getCount(), false);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.number
|
||||||
|
|
||||||
|
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.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeVisualNumberDecAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.count, false)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,74 +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.number;
|
|
||||||
|
|
||||||
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.Command;
|
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags;
|
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
final public class ChangeVisualNumberIncAction extends VisualOperatorActionHandler.ForEachCaret {
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<C-A>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public Command.Type getType() {
|
|
||||||
return Command.Type.CHANGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
final public EnumSet<CommandFlags> getFlags() {
|
|
||||||
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeAction(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
@NotNull Command cmd,
|
|
||||||
@NotNull VimSelection range) {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.getCount(), false);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.number
|
||||||
|
|
||||||
|
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.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class ChangeVisualNumberIncAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
|
override fun executeAction(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
cmd: Command,
|
||||||
|
range: VimSelection): Boolean {
|
||||||
|
return VimPlugin.getChange()
|
||||||
|
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, false)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.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 DeleteCharacterAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("<DEL>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.DELETE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return VimPlugin.getChange().deleteCharacter(editor, caret, 1, false);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class DeleteCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.DELETE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().deleteCharacter(editor, caret, 1, false)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.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 DeleteCharacterLeftAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("X");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.DELETE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class DeleteCharacterLeftAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.DELETE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +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.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 DeleteCharacterRightAction extends ChangeEditorActionHandler.ForEachCaret {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<MappingMode> getMappingModes() {
|
|
||||||
return MappingMode.N;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
|
||||||
return parseKeysSet("x");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Command.Type getType() {
|
|
||||||
return Command.Type.DELETE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(@NotNull Editor editor,
|
|
||||||
@NotNull Caret caret,
|
|
||||||
@NotNull DataContext context,
|
|
||||||
int count,
|
|
||||||
int rawCount,
|
|
||||||
@Nullable Argument argument) {
|
|
||||||
return VimPlugin.getChange().deleteCharacter(editor, caret, count, false);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
|
class DeleteCharacterRightAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
|
override val type: Command.Type = Command.Type.DELETE
|
||||||
|
|
||||||
|
override fun execute(editor: Editor,
|
||||||
|
caret: Caret,
|
||||||
|
context: DataContext,
|
||||||
|
count: Int,
|
||||||
|
rawCount: Int,
|
||||||
|
argument: Argument?): Boolean {
|
||||||
|
return VimPlugin.getChange().deleteCharacter(editor, caret, count, false)
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user