mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
371 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e89e0466eb | ||
![]() |
c9d0d7aef6 | ||
![]() |
90c7d5a74a | ||
![]() |
b19e11b5b6 | ||
![]() |
2d002c044d | ||
![]() |
9a7b2bd158 | ||
![]() |
461c874de6 | ||
![]() |
992ff97877 | ||
![]() |
96689eab23 | ||
![]() |
0dd47c192b | ||
![]() |
5875ce58fb | ||
![]() |
1c21968259 | ||
![]() |
1d8ac4fc02 | ||
![]() |
0a863f32b2 | ||
![]() |
cd0d503402 | ||
![]() |
0bac6bf8b6 | ||
![]() |
6436a59528 | ||
![]() |
2dc54ea882 | ||
![]() |
63db148aae | ||
![]() |
78f1c8499a | ||
![]() |
26dae9b4e0 | ||
![]() |
10f1d75f2e | ||
![]() |
5b3984ce7a | ||
![]() |
43810ba730 | ||
![]() |
5bf2818b2a | ||
![]() |
76587d672f | ||
![]() |
890d48769f | ||
![]() |
fffe8e2499 | ||
![]() |
fffc2d3b11 | ||
![]() |
007f33be0b | ||
![]() |
fa17af8d33 | ||
![]() |
eabe43061c | ||
![]() |
64502fb31b | ||
![]() |
d693906905 | ||
![]() |
cf25f7e201 | ||
![]() |
df3a533515 | ||
![]() |
53a687fd53 | ||
![]() |
2091bbc025 | ||
![]() |
eb46ed8f00 | ||
![]() |
3096c2e7ad | ||
![]() |
f8d66f354a | ||
![]() |
67c5601fdc | ||
![]() |
62601686aa | ||
![]() |
e92c0d5098 | ||
![]() |
5ca0298497 | ||
![]() |
7321099a0f | ||
![]() |
63d9a33d80 | ||
![]() |
a7ba6d6004 | ||
![]() |
5008d5c8c4 | ||
![]() |
33f8a00679 | ||
![]() |
be0adb833f | ||
![]() |
8f90ff8a65 | ||
![]() |
c8a1938155 | ||
![]() |
3cf42c86f3 | ||
![]() |
632e9fad2e | ||
![]() |
a5de935192 | ||
![]() |
111c1ebe32 | ||
![]() |
8a42bff6ad | ||
![]() |
d878c3e05d | ||
![]() |
d08da77b2f | ||
![]() |
86d6876db4 | ||
![]() |
a7985e1e9b | ||
![]() |
879ca456f7 | ||
![]() |
1863cbdef0 | ||
![]() |
ac4755a6ff | ||
![]() |
61600b07a4 | ||
![]() |
6be6e7f173 | ||
![]() |
e597e06324 | ||
![]() |
4cebaa865b | ||
![]() |
589e43f825 | ||
![]() |
61a70704c5 | ||
![]() |
174f86f91e | ||
![]() |
77a462702e | ||
![]() |
d20955900d | ||
![]() |
b952d2b96a | ||
![]() |
428d1d6699 | ||
![]() |
35863581e9 | ||
![]() |
041f6af607 | ||
![]() |
0e8a1bfc87 | ||
![]() |
442e739447 | ||
![]() |
47bb155989 | ||
![]() |
bd733b72a7 | ||
![]() |
e01327ab29 | ||
![]() |
2a10247653 | ||
![]() |
e3b7ed7657 | ||
![]() |
d4357ce801 | ||
![]() |
5bdeaed416 | ||
![]() |
a44d93283f | ||
![]() |
804f69e9c8 | ||
![]() |
086c2f201b | ||
![]() |
0b22360891 | ||
![]() |
808fb24bbc | ||
![]() |
febd8eccf0 | ||
![]() |
22b1209eb5 | ||
![]() |
485c5501b3 | ||
![]() |
81ceba8926 | ||
![]() |
3edd95da4e | ||
![]() |
c1bb364cbe | ||
![]() |
db8fa31503 | ||
![]() |
1a5a65dcb1 | ||
![]() |
1c96f4491e | ||
![]() |
30ddb4071f | ||
![]() |
dccc793fc7 | ||
![]() |
f070a57148 | ||
![]() |
2dde2cfb3b | ||
![]() |
e0fef4f017 | ||
![]() |
3a40b9689c | ||
![]() |
3937a395b7 | ||
![]() |
7e3d532075 | ||
![]() |
4f658c4734 | ||
![]() |
26aa753d9e | ||
![]() |
bd9c40aabc | ||
![]() |
008edc7e33 | ||
![]() |
2901bf45b7 | ||
![]() |
24e7f655fc | ||
![]() |
ab8de509d9 | ||
![]() |
4fc4ed7675 | ||
![]() |
b35ad2bb9d | ||
![]() |
895c7f1af1 | ||
![]() |
fbca5712e3 | ||
![]() |
58850960b8 | ||
![]() |
1c874d3957 | ||
![]() |
a42a19a174 | ||
![]() |
bbe39d5942 | ||
![]() |
f5fb844442 | ||
![]() |
cb186a686e | ||
![]() |
0c22bb2f4f | ||
![]() |
49756c5c2f | ||
![]() |
7efc2e1631 | ||
![]() |
ed23f5958c | ||
![]() |
0ea53f3445 | ||
![]() |
4531b38c89 | ||
![]() |
2114725dab | ||
![]() |
6877ffcb47 | ||
![]() |
c4a3cc6718 | ||
![]() |
a53ed1705a | ||
![]() |
ae13eed152 | ||
![]() |
2c2c023200 | ||
![]() |
1dbe7735df | ||
![]() |
a321e77e2e | ||
![]() |
9b52b496b2 | ||
![]() |
deeddc22be | ||
![]() |
680693448f | ||
![]() |
b4b5c0c77e | ||
![]() |
3f3305706d | ||
![]() |
bd942e2ea1 | ||
![]() |
a4c3fd8f0b | ||
![]() |
f54fc09a37 | ||
![]() |
fd6bdde5b0 | ||
![]() |
85c8007084 | ||
![]() |
8a82d60172 | ||
![]() |
8b3f5d5e81 | ||
![]() |
e222294c6e | ||
![]() |
a04b536df8 | ||
![]() |
2a0bd8722e | ||
![]() |
742187919f | ||
![]() |
aece559400 | ||
![]() |
8b6e41afb8 | ||
![]() |
9eed5802d6 | ||
![]() |
437932d023 | ||
![]() |
e8dd4f2e59 | ||
![]() |
93cdf3828b | ||
![]() |
99a91404ce | ||
![]() |
28ae3a104a | ||
![]() |
bc08839b16 | ||
![]() |
15ebcb5b6a | ||
![]() |
93fd8b0ff7 | ||
![]() |
6d0f280f19 | ||
![]() |
3b26a4c26d | ||
![]() |
60315744d1 | ||
![]() |
40a6617816 | ||
![]() |
a6964a37ac | ||
![]() |
9249ae073c | ||
![]() |
2a216728f1 | ||
![]() |
b186cb585e | ||
![]() |
4e26f62391 | ||
![]() |
ddb502acb3 | ||
![]() |
89cb6867d4 | ||
![]() |
f7892b33c8 | ||
![]() |
e04e0e69f3 | ||
![]() |
7172faf7b5 | ||
![]() |
6e1761a1f5 | ||
![]() |
baa7d4f098 | ||
![]() |
baa5557010 | ||
![]() |
5ce25ebc23 | ||
![]() |
1f4d5b0140 | ||
![]() |
ddd1a0a5f0 | ||
![]() |
802c887b60 | ||
![]() |
e15fd8fa24 | ||
![]() |
034cc3a725 | ||
![]() |
f34dcc0386 | ||
![]() |
a7b278553f | ||
![]() |
bd52eb12bd | ||
![]() |
2d9a0a7559 | ||
![]() |
67d3698a40 | ||
![]() |
7b40281875 | ||
![]() |
dc1d01c91d | ||
![]() |
1e2618fddc | ||
![]() |
85194b772b | ||
![]() |
5a048139d6 | ||
![]() |
7809842348 | ||
![]() |
c7948374fd | ||
![]() |
f8afdf304b | ||
![]() |
29d617f7bb | ||
![]() |
0e7b05e360 | ||
![]() |
5f18e99128 | ||
![]() |
b2e0af587f | ||
![]() |
b0b0817668 | ||
![]() |
a6ef654c05 | ||
![]() |
e428b9fa0a | ||
![]() |
7008185735 | ||
![]() |
e4bbc7b962 | ||
![]() |
68704a2e3d | ||
![]() |
6f0222c55e | ||
![]() |
e0646541e8 | ||
![]() |
2d1fee0516 | ||
![]() |
149899c34e | ||
![]() |
c6573b48c2 | ||
![]() |
476ba265d2 | ||
![]() |
9904de1946 | ||
![]() |
e73aec2e9e | ||
![]() |
d6658a1771 | ||
![]() |
583988034b | ||
![]() |
e57d6f3d97 | ||
![]() |
55e553c2a0 | ||
![]() |
44a3263a86 | ||
![]() |
80723a6cad | ||
![]() |
ca15c60d52 | ||
![]() |
8be075b36a | ||
![]() |
ca203f8297 | ||
![]() |
934c3065b9 | ||
![]() |
5d95917727 | ||
![]() |
a53b67f0ef | ||
![]() |
eff13180b3 | ||
![]() |
354aec4713 | ||
![]() |
d2acb88dd4 | ||
![]() |
e96ece23b8 | ||
![]() |
a3a3db9bc8 | ||
![]() |
ede0737261 | ||
![]() |
dc7efad420 | ||
![]() |
423d51a6f9 | ||
![]() |
c350650f9c | ||
![]() |
8c3cbc49b3 | ||
![]() |
786b7193d0 | ||
![]() |
2a6acba07f | ||
![]() |
e5a5d112ca | ||
![]() |
9e2cfe548b | ||
![]() |
f4d595f5c2 | ||
![]() |
c1e5b7d111 | ||
![]() |
1eccc60cb3 | ||
![]() |
9f8095ae52 | ||
![]() |
3674cf4aad | ||
![]() |
6b0d2157c8 | ||
![]() |
5a629d6256 | ||
![]() |
b8909f97aa | ||
![]() |
8c83ed6b55 | ||
![]() |
b161346171 | ||
![]() |
330e717518 | ||
![]() |
dafc031ef6 | ||
![]() |
b00a2d3b79 | ||
![]() |
c64ec34a1f | ||
![]() |
8ed709c7bb | ||
![]() |
8e8e52c6f9 | ||
![]() |
f3e806c4a6 | ||
![]() |
3bae95ae5b | ||
![]() |
0adde753f4 | ||
![]() |
5f28a22666 | ||
![]() |
a975b53894 | ||
![]() |
98aee5d0ab | ||
![]() |
f57af8bf9e | ||
![]() |
c6c3b6643e | ||
![]() |
af94079b92 | ||
![]() |
7203cc5cb3 | ||
![]() |
028423cf58 | ||
![]() |
2ead6af96a | ||
![]() |
bf853e3c0c | ||
![]() |
660b243056 | ||
![]() |
c85f41e65b | ||
![]() |
2759bed1b2 | ||
![]() |
89c2a8ec9b | ||
![]() |
aa2c1257ac | ||
![]() |
f9fa15b7ac | ||
![]() |
93a9be41bc | ||
![]() |
ecd2f2032c | ||
![]() |
de5ce5f635 | ||
![]() |
2eb6fd6819 | ||
![]() |
22ea4e7ffa | ||
![]() |
3d98f3035f | ||
![]() |
ec1d6ac477 | ||
![]() |
0dc236cb5b | ||
![]() |
98349a49fd | ||
![]() |
ab8be2cada | ||
![]() |
b8c22d0928 | ||
![]() |
c6cf77e4b8 | ||
![]() |
6c0511a898 | ||
![]() |
366c862bcf | ||
![]() |
03493e2390 | ||
![]() |
8f9c71dd55 | ||
![]() |
11beb1e331 | ||
![]() |
01b4dc233a | ||
![]() |
9f1e80e969 | ||
![]() |
7e319e11c6 | ||
![]() |
d11bf1c4d2 | ||
![]() |
3e2f18b757 | ||
![]() |
61677aa811 | ||
![]() |
fb04e835ef | ||
![]() |
bb133922d6 | ||
![]() |
44dd5ef872 | ||
![]() |
bcc8e1c055 | ||
![]() |
71117ed335 | ||
![]() |
de07fb3b74 | ||
![]() |
e31d5a4dcf | ||
![]() |
e14aae761d | ||
![]() |
47db2a247c | ||
![]() |
e449bb9692 | ||
![]() |
b8fc72b6a7 | ||
![]() |
64c01c1bd1 | ||
![]() |
0a0e3df42b | ||
![]() |
949c69a7e9 | ||
![]() |
69caf7a604 | ||
![]() |
23860ad5f9 | ||
![]() |
ace5234d8d | ||
![]() |
4654f821a9 | ||
![]() |
927e0e7865 | ||
![]() |
d47c9735b5 | ||
![]() |
6100433636 | ||
![]() |
43f79e8183 | ||
![]() |
f58fda0c87 | ||
![]() |
64b49e37d7 | ||
![]() |
e44418d410 | ||
![]() |
ca8d05ff13 | ||
![]() |
626871e34d | ||
![]() |
4b659fe643 | ||
![]() |
d5055506b0 | ||
![]() |
55f54b2e82 | ||
![]() |
1b18065e68 | ||
![]() |
053dc02152 | ||
![]() |
b8cb4a1295 | ||
![]() |
cd2cbf68a1 | ||
![]() |
73f3be8af0 | ||
![]() |
8cce059fb4 | ||
![]() |
db641ec6f6 | ||
![]() |
9d8239b68d | ||
![]() |
4ec0bac275 | ||
![]() |
613c234cfb | ||
![]() |
83dca71f69 | ||
![]() |
f7ea9cdb6e | ||
![]() |
762cb1804f | ||
![]() |
962cfb7ae2 | ||
![]() |
9bc2ec7d8a | ||
![]() |
8415d104e9 | ||
![]() |
abd0f9b961 | ||
![]() |
7de08e08d0 | ||
![]() |
a4cd94847e | ||
![]() |
a0a7386b51 | ||
![]() |
535a72000f | ||
![]() |
60531b9cd2 | ||
![]() |
8f86ad696d | ||
![]() |
c9bda98a6a | ||
![]() |
9ea08da133 | ||
![]() |
5762ec0518 | ||
![]() |
7db74460fa | ||
![]() |
2f148255f7 | ||
![]() |
cb00b8b335 | ||
![]() |
559b56c8a2 | ||
![]() |
158cea51db | ||
![]() |
33d34f35e9 | ||
![]() |
1f4f40fd7c | ||
![]() |
7c908b247e | ||
![]() |
41c822fde1 | ||
![]() |
2a6569742d |
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,6 +1,13 @@
|
|||||||
*.swp
|
*.swp
|
||||||
/.gradle/
|
/.gradle/
|
||||||
|
|
||||||
/.idea/
|
/.idea/
|
||||||
|
!/.idea/scopes
|
||||||
|
!/.idea/copyright
|
||||||
|
!/.idea/icon.png
|
||||||
|
|
||||||
/build/
|
/build/
|
||||||
/out/
|
/out/
|
||||||
/tmp/
|
/tmp/
|
||||||
|
|
||||||
|
*.DS_Store
|
6
.idea/copyright/IdeaVim.xml
generated
Normal file
6
.idea/copyright/IdeaVim.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="IdeaVim - Vim emulator for IDEs based on the IntelliJ platform Copyright (C) 2003-&#36;today.year 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/>." />
|
||||||
|
<option name="myName" value="IdeaVim" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
7
.idea/copyright/profiles_settings.xml
generated
Normal file
7
.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings>
|
||||||
|
<module2copyright>
|
||||||
|
<element module="Copyright" copyright="IdeaVim" />
|
||||||
|
</module2copyright>
|
||||||
|
</settings>
|
||||||
|
</component>
|
BIN
.idea/icon.png
generated
Normal file
BIN
.idea/icon.png
generated
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
3
.idea/scopes/Copyright.xml
generated
Normal file
3
.idea/scopes/Copyright.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="Copyright" pattern="file[IdeaVIM.main]:com//*||file[IdeaVIM.test]:*/" />
|
||||||
|
</component>
|
36
AUTHORS.md
36
AUTHORS.md
@@ -287,6 +287,42 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/kevin70)
|
[![icon][github]](https://github.com/kevin70)
|
||||||
|
|
||||||
kk
|
kk
|
||||||
|
* [![icon][mail]](mailto:runforprogram@163.com)
|
||||||
|
[![icon][github]](https://github.com/runforprogram)
|
||||||
|
|
||||||
|
runforprogram
|
||||||
|
* [![icon][mail]](mailto:valery.isaev@jetbrains.com)
|
||||||
|
[![icon][github]](https://github.com/valis)
|
||||||
|
|
||||||
|
valis
|
||||||
|
* [![icon][mail]](mailto:pmikulski@voleon.com)
|
||||||
|
[![icon][github]](https://github.com/pmnoxx)
|
||||||
|
|
||||||
|
Piotr Mikulski
|
||||||
|
* [![icon][mail]](mailto:14farresa@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/adriafarres)
|
||||||
|
|
||||||
|
Adrià Farrés
|
||||||
|
* [![icon][mail]](mailto:patrick.j.elmquist@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/patrick-elmquist)
|
||||||
|
|
||||||
|
Patrick Elmquist
|
||||||
|
* [![icon][mail]](mailto:rieon@rieon.cn)
|
||||||
|
[![icon][github]](https://github.com/rieonke)
|
||||||
|
|
||||||
|
Rieon Ke
|
||||||
|
* [![icon][mail]](mailto:jiirra@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/KostkaBrukowa)
|
||||||
|
|
||||||
|
KostkaBrukowa
|
||||||
|
* [![icon][mail]](mailto:wangyaohuicn@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/yaohui-wyh)
|
||||||
|
|
||||||
|
Yaohui Wang
|
||||||
|
* [![icon][mail]](mailto:iain.ballard@bjss.com)
|
||||||
|
[![icon][github]](https://github.com/i-e-b)
|
||||||
|
|
||||||
|
Iain Ballard
|
||||||
|
|
||||||
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.
|
||||||
|
98
CHANGES.md
98
CHANGES.md
@@ -22,6 +22,104 @@ 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.
|
||||||
|
|
||||||
|
0.60, 2020-10-09
|
||||||
|
-----------
|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
* Support of `virtualedit=onemore` ([VIM-844](https://youtrack.jetbrains.com/issue/VIM-844))
|
||||||
|
|
||||||
|
**Fixes:**
|
||||||
|
* [VIM-2097](https://youtrack.jetbrains.com/issue/VIM-2097) Do not apply mappings for register selecting
|
||||||
|
* [VIM-2080](https://youtrack.jetbrains.com/issue/VIM-2080) Fix S command with count
|
||||||
|
* [VIM-2099](https://youtrack.jetbrains.com/issue/VIM-2099) Fix operations with backward inclusive motions
|
||||||
|
* [VIM-2104](https://youtrack.jetbrains.com/issue/VIM-2104) Use `sidescrolloff` for horizontal offset
|
||||||
|
* [VIM-1080](https://youtrack.jetbrains.com/issue/VIM-1080) Fix `zt` for virtual space enabled
|
||||||
|
* [VIM-1556](https://youtrack.jetbrains.com/issue/VIM-1556) Fix horizontal scrolling
|
||||||
|
* [VIM-1770](https://youtrack.jetbrains.com/issue/VIM-1770) Fix goto end with large inline hints
|
||||||
|
* [VIM-2110](https://youtrack.jetbrains.com/issue/VIM-2110) Fix scrolling for non-monospaced fonts
|
||||||
|
|
||||||
|
**Changes:**
|
||||||
|
* `:w` works as `:wa` by default. This can be disabled with `ideawrite` option.
|
||||||
|
|
||||||
|
Now features like `Prettier on save` or `Run on save for files` would work with `:w` command as well.
|
||||||
|
|
||||||
|
See [VIM-1968](https://youtrack.jetbrains.com/issue/VIM-1968).
|
||||||
|
|
||||||
|
**Merged PRs:**
|
||||||
|
* [248](https://github.com/JetBrains/ideavim/pull/248) by [Yaohui Wang](https://github.com/yaohui-wyh): Check if project is disposed when editorDeinit
|
||||||
|
* [242](https://github.com/JetBrains/ideavim/pull/242) by [Iain Ballard](https://github.com/i-e-b): Partial implementation of virtualedit config
|
||||||
|
* [252](https://github.com/JetBrains/ideavim/pull/252) by [Matt Ellis](https://github.com/citizenmatt): Fixes for scrolling
|
||||||
|
|
||||||
|
0.59, 2020-08-25
|
||||||
|
------------
|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
* `vim-highlightedyank` plugin emulation ([VIM-1970](https://youtrack.jetbrains.com/issue/VIM-1970) | [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank)).
|
||||||
|
|
||||||
|
* <details>
|
||||||
|
<summary><strong>Click to see details</strong></summary>
|
||||||
|
<img src="resources/changes/0.59/highlight_yank.gif" alt="highlight yank"/>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
* [VIM-2068](https://youtrack.jetbrains.com/issue/VIM-2068) `:tabclose` command
|
||||||
|
|
||||||
|
**Fixes:**
|
||||||
|
* [VIM-1421](https://youtrack.jetbrains.com/issue/VIM-1421) Escape key finishes `t` and `f` motions
|
||||||
|
* [VIM-2075](https://youtrack.jetbrains.com/issue/VIM-2075) Fix zR command
|
||||||
|
* [VIM-2059](https://youtrack.jetbrains.com/issue/VIM-2059) Fixed macro editing
|
||||||
|
|
||||||
|
**Merged PRs:**
|
||||||
|
* [237](https://github.com/JetBrains/ideavim/pull/237) by [Adrià Farrés](https://github.com/adriafarres): Reset operator-pending commands on escape
|
||||||
|
* [241](https://github.com/JetBrains/ideavim/pull/241) by [Patrick Elmquist](https://github.com/patrick-elmquist): Properly reset when pressing Esc in the middle of command
|
||||||
|
* [244](https://github.com/JetBrains/ideavim/pull/244) by [Rieon Ke](https://github.com/rieonke): Implement tabc[lose] ex command
|
||||||
|
* [240](https://github.com/JetBrains/ideavim/pull/240) by [Rieon Ke](https://github.com/rieonke): add support for putting & editing macros
|
||||||
|
* [245](https://github.com/JetBrains/ideavim/pull/245) by [KostkaBrukowa](https://github.com/KostkaBrukowa): VIM-1970 | Working solution of plugin vim-highlightedyank
|
||||||
|
|
||||||
|
0.58, 2020-07-07
|
||||||
|
-------------
|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
* `exchange` plugin emulation ([VIM-921](https://youtrack.jetbrains.com/issue/VIM-921) | [vim-exchange](https://github.com/tommcdo/vim-exchange)).
|
||||||
|
* `~/.ideavimrc` file can be reloaded using the new floating action.
|
||||||
|
|
||||||
|
* <details>
|
||||||
|
<summary><strong>Click to see details</strong></summary>
|
||||||
|
<img src="resources/changes/0.58/reload_ideavimrc.png" alt="IdeaVimRc reload"/>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
* Add `:buffer` command.
|
||||||
|
|
||||||
|
**Changes:**
|
||||||
|
* Support IntelliJ's smooth scrolling. Use "Enable smooth scrolling" checkbox in _Preferences | Editor | General_ to disable.
|
||||||
|
|
||||||
|
**Fixes:**
|
||||||
|
* [VIM-1994](https://youtrack.jetbrains.com/issue/VIM-1994) Correct paste after `y}P` command.
|
||||||
|
* [VIM-1924](https://youtrack.jetbrains.com/issue/VIM-1924) Select next occurrence doesn't become block selection.
|
||||||
|
* [VIM-2038](https://youtrack.jetbrains.com/issue/VIM-2038) Last line is now accessible in normal mode
|
||||||
|
* [VIM-1934](https://youtrack.jetbrains.com/issue/VIM-1934) Line number is not clipped for relative line numbers
|
||||||
|
* [VIM-1852](https://youtrack.jetbrains.com/issue/VIM-1852) Line number doesn't flickers for relative line numbers
|
||||||
|
* [VIM-2021](https://youtrack.jetbrains.com/issue/VIM-2021) Line numbers don't reactivating
|
||||||
|
* Fix mappings to `"\<SPACE>"` including `let mapleader="\<SPACE>"`
|
||||||
|
|
||||||
|
|
||||||
|
**Merged PRs:**
|
||||||
|
* [233](https://github.com/JetBrains/ideavim/pull/233) by [valis](https://github.com/valis): [VIM-1994] Correct paste after `y}P` command.
|
||||||
|
* [224](https://github.com/JetBrains/ideavim/pull/224) by [pmnoxx](https://github.com/pmnoxx): Populate intelij navigation history together with ideavim jumplist.
|
||||||
|
* [227](https://github.com/JetBrains/ideavim/pull/227) by [angelbot](https://github.com/angelbot): Add support for buffer command.
|
||||||
|
* [230](https://github.com/JetBrains/ideavim/pull/230) by [fan-tom](https://github.com/fan-tom): VIM-1924.
|
||||||
|
* [231](https://github.com/JetBrains/ideavim/pull/231) by [citizenmatt](https://github.com/citizenmatt): Support smooth scrolling.
|
||||||
|
* [239](https://github.com/JetBrains/ideavim/pull/239) by [citizenmatt](https://github.com/citizenmatt): Use new API for relative line numbers
|
||||||
|
|
||||||
|
0.57, 2020-04-28
|
||||||
|
-------------
|
||||||
|
|
||||||
|
**Fixes:**
|
||||||
|
* [VIM-1992](https://youtrack.jetbrains.com/issue/VIM-1992) Fix mappings to `<S-Letter>`
|
||||||
|
* [VIM-1991](https://youtrack.jetbrains.com/issue/VIM-1991) Fix working with number registers
|
||||||
|
|
||||||
|
**Merged PRs:**
|
||||||
|
* [234](https://github.com/JetBrains/ideavim/pull/234) by [runforprogram](https://github.com/runforprogram): [VIM-1991] fix >0 number register not work
|
||||||
|
|
||||||
0.56, 2020-04-09
|
0.56, 2020-04-09
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
210
CONTRIBUTING.md
210
CONTRIBUTING.md
@@ -1,124 +1,140 @@
|
|||||||
<div>
|
[![TeamCity Build][teamcity-build-status-svg]][teamcity-build-status]
|
||||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20183&guest=1">
|
|
||||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20183)/statusIcon.svg?guest=1"/>
|
|
||||||
</a>
|
|
||||||
<span>2018.3 Tests</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20191&guest=1">
|
|
||||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20191)/statusIcon.svg?guest=1"/>
|
|
||||||
</a>
|
|
||||||
<span>2019.1 Tests</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20192&guest=1">
|
|
||||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20192)/statusIcon.svg?guest=1"/>
|
|
||||||
</a>
|
|
||||||
<span>2019.2 Tests</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20193&guest=1">
|
|
||||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20193)/statusIcon.svg?guest=1"/>
|
|
||||||
</a>
|
|
||||||
<span>2019.3 Tests</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20201&guest=1">
|
|
||||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20201)/statusIcon.svg?guest=1"/>
|
|
||||||
</a>
|
|
||||||
<span>2020.1 Tests</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
IdeaVim is an open source project created by 60+ contributors. Would you like to make it even better? That’s wonderful!
|
||||||
|
|
||||||
### Where to Start
|
This page is created to help you start contributing. And who knows, maybe in a few days this project will be brighter than ever!
|
||||||
|
|
||||||
In order to contribute to IdeaVim, you should have some understanding of [Kotlin](https://kotlinlang.org/) or Java.
|
## Before you begin
|
||||||
|
|
||||||
See also these docs on the IntelliJ API:
|
- The project is written in Kotlin and Java. Choose whichever language you feel more comfortable with,
|
||||||
|
or maybe one that you’d like to get to know better (why not start [learning Kotlin](https://kotlinlang.org/docs/tutorials/) right now?).
|
||||||
|
|
||||||
* [IntelliJ architectural overview](https://www.jetbrains.org/intellij/sdk/docs/platform/fundamentals.html)
|
- If you come across some IntelliJ Platform code, these links may prove helpful:
|
||||||
* [IntelliJ plugin development resources](https://www.jetbrains.org/intellij/sdk/docs/welcome.html)
|
|
||||||
|
|
||||||
You can start by:
|
* [IntelliJ architectural overview](https://www.jetbrains.org/intellij/sdk/docs/platform/fundamentals.html)
|
||||||
|
* [IntelliJ plugin development resources](https://www.jetbrains.org/intellij/sdk/docs/welcome.html)
|
||||||
|
|
||||||
- Picking relatively simple tasks that are tagged with
|
- Having any difficulties?
|
||||||
|
Join the brand new
|
||||||
|
[](https://gitter.im/JetBrains/ideavim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
for IdeaVim developers and contributors!
|
||||||
|
|
||||||
|
OK, ready to do some coding?
|
||||||
|
|
||||||
|
## Yes, I'm ready for some coding
|
||||||
|
|
||||||
|
* Fork the repository and clone it to the local machine.
|
||||||
|
* Open the project with IntelliJ IDEA.
|
||||||
|
|
||||||
|
Yoo hoo! You’re all set to begin contributing. Here are some useful gradle commands:
|
||||||
|
|
||||||
|
* `./gradlew runIde` — start the dev version of IntelliJ IDEA with IdeaVim installed.
|
||||||
|
* `./gradlew test` — run tests.
|
||||||
|
* `./gradlew buildPlugin` — build the plugin. The result will be located in `build/distributions`. This file can be
|
||||||
|
installed by using `Settings | Plugin | >Gear Icon< | Install Plugin from Disk...`. You can stay with your personal build
|
||||||
|
for a few days or send it to a friend for testing.
|
||||||
|
|
||||||
|
## Warmup
|
||||||
|
|
||||||
|
- Pick a few relatively simple tasks that are tagged with
|
||||||
[#patch_welcome](https://youtrack.jetbrains.com/issues/VIM?q=%23patch_welcome%20%23Unresolved%20sort%20by:%20votes%20)
|
[#patch_welcome](https://youtrack.jetbrains.com/issues/VIM?q=%23patch_welcome%20%23Unresolved%20sort%20by:%20votes%20)
|
||||||
in the issue tracker.
|
in the issue tracker.
|
||||||
- Read about the `@VimBehaviorDiffers` annotation and fix the corresponding functionality.
|
- Read the javadoc for the `@VimBehaviorDiffers` annotation in the source code and fix the corresponding functionality.
|
||||||
|
- Implement one of the requested [#vim plugin](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved%20tag:%20%7Bvim%20plugin%7D%20sort%20by:%20votes%20)s.
|
||||||
|
|
||||||
|
> :small_orange_diamond: Selected an issue to work on? Leave a comment in a YouTrack ticket or create a draft PR
|
||||||
|
> to indicate that you've started working on it so that you might get additional guidance and feedback from the maintainers.
|
||||||
|
|
||||||
|
## Where to start in the codebase
|
||||||
|
|
||||||
|
If you are looking for:
|
||||||
|
|
||||||
|
- Vim commands (`w`, `<C-O>`, `p`, etc.):
|
||||||
|
- Any particular command: `package-info.java`.
|
||||||
|
- How commands are executed in common: `EditorActionHandlerBase`.
|
||||||
|
- Key mapping: `KeyHandler.handleKey()`.
|
||||||
|
|
||||||
|
- Ex commands (`:set`, `:s`, `:nohlsearch`):
|
||||||
|
- Any particular ex command: package `com.maddyhome.idea.vim.ex.handler`.
|
||||||
|
- Ex command executor: `CommandHandler`.
|
||||||
|
|
||||||
|
- Extensions:
|
||||||
|
- Extensions handler: `VimExtensionHandler`.
|
||||||
|
- Available extensions: package `com/maddyhome/idea/vim/extension`.
|
||||||
|
|
||||||
|
- Common features:
|
||||||
|
- State machine. How every particular keystroke is parsed in IdeaVim: `KeyHandler.handleKey()`.
|
||||||
|
- Options (`incsearch`, `iskeyword`, `relativenumber`): `OptionsManager`.
|
||||||
|
- Plugin startup: `PluginStartup`.
|
||||||
|
- Notifications: `NotificationService`.
|
||||||
|
- Status bar icon: `StatusBar.kt`.
|
||||||
|
- On/off switch: `VimPlugin.setEnabled()`.
|
||||||
|
|
||||||
|
|
||||||
### Development Environment
|
## Testing
|
||||||
|
|
||||||
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
|
Here are some guides for testing:
|
||||||
|
|
||||||
2. Import the project from the existing sources in IntelliJ IDEA 2018.1 or newer (Community or
|
1. Read the javadoc for the `@VimBehaviorDiffers` annotation in the source code.
|
||||||
Ultimate), by selecting "File | New | Project from Existing Sources..." or selecting "Import
|
|
||||||
Project" from the Welcome screen.
|
|
||||||
|
|
||||||
* In the project wizard, select "Import project from external model | Gradle".
|
2. Please avoid senseless text like "dhjkwaldjwa", "asdasdasd", "123 123 123 123", etc. Try to choose an example
|
||||||
|
text that is easy to read and understand what is wrong if the test fails. For example, take a few lines from your
|
||||||
|
favorite poem, or use Vladimir Nabokov’s “A Discovery" if you don't have one.
|
||||||
|
|
||||||
* Select your Java 8+ JDK as the Gradle JVM; leave other parameters unchanged.
|
3. Don't forget to test your functionality with line start, line end, file start, file end, empty line, multiple
|
||||||
|
carets, dollar motion, etc.
|
||||||
|
|
||||||
|
##### Neovim
|
||||||
|
IdeaVim has an experimental integration with neovim in tests. Tests that are performed with `doTest` also executed in
|
||||||
|
neovim instance, and the state of IdeaVim is asserted to be the same as the state of neovim.
|
||||||
|
- Only tests that use `doTest` are checked with neovim.
|
||||||
|
- Tests with `@VimBehaviorDiffers` or `@TestWithoutNeovim` annotations don't use neovim.
|
||||||
|
|
||||||
3. Run your IdeaVim plugin within IntelliJ via a Gradle task:
|
#### Property-based tests
|
||||||
|
Property-based tests are located under `propertybased` package. These tests a flaky by nature
|
||||||
|
although in most cases they are stable. If the test fails on your TeamCity run, try to check the test output and understand
|
||||||
|
if the fail is caused by your changes. If it's not, just ignore the test.
|
||||||
|
|
||||||
* Select the "View | Tool Windows | Gradle" tool window.
|
|
||||||
|
|
||||||
* Launch "ideavim | intellij | runIde" from the tool window.
|
|
||||||
|
|
||||||
4. Run IdeaVim tests via a Gradle task:
|
## A common direction
|
||||||
|
|
||||||
* Select the "View | Tool Windows | Gradle" tool window.
|
We’re trying to make IdeaVim close to the original Vim both in terms of functionality and architecture.
|
||||||
|
|
||||||
* Launch "ideavim | verification | test" from the tool window.
|
|
||||||
|
|
||||||
5. Build the plugin distribution by running `./gradlew clean buildPlugin` in the
|
- Vim motions can be [either inclusive, exclusive, or linewise](http://vimdoc.sourceforge.net/htmldoc/motion.html#inclusive).
|
||||||
terminal in your project root.
|
In IdeaVim, you can use `MotionType` for that.
|
||||||
|
- Have you read the [interesting things](https://github.com/JetBrains/ideavim#some-facts-about-vim) about IdeaVim?
|
||||||
|
Do you remember how `dd`, `yy`, and other similar commands work? `DuplicableOperatorAction` will help you with that.
|
||||||
|
And we also translate it to `d_` and `y_`: `KeyHandler.mapOpCommand()`.
|
||||||
|
- All IdeaVim extensions use the same command names as the originals (e.g. `<Plug>(CommentMotion)`, `<Plug>ReplaceWithRegisterLine`),
|
||||||
|
so you can reuse your `.vimrc` settings.
|
||||||
|
We also support proper command mappings (functions are mapped to `<Plug>...`), the operator function (`OperatorFunction`), and so on.
|
||||||
|
- Magic is supported as well. See `Magic`.
|
||||||
|
|
||||||
* The resulting distribution file will be located at build/distributions/IdeaVim-VERSION.zip
|
-----
|
||||||
|
|
||||||
* You can install this file by selecting "Settings | Plugins | Install plugin
|
### I read the whole page but something is still unclear.
|
||||||
from disk...".
|
|
||||||
|
|
||||||
### Copyright
|
Oh no! No cookies for the maintainers today! Please [tell us](https://github.com/JetBrains/ideavim#contact-maintainers) about it so we can help.
|
||||||
|
|
||||||
1. Go to `Preferences | Appearance & Behavior | Scopes`, press "+" button, `Shared`.
|
|
||||||
Name: Copyright scope
|
|
||||||
Pattern: `file[IdeaVIM.main]:com//*||file[IdeaVIM.test]:*/`
|
|
||||||
|
|
||||||
2. Go to `Preferences | Editor | Copyright | Copyright Profiles` and click the "+" button.
|
### I’ve found a bug in this documentation.
|
||||||
Name: IdeaVim
|
|
||||||
Text:
|
|
||||||
|
|
||||||
IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
|
||||||
Copyright (C) 2003-$today.year 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/>.
|
|
||||||
|
|
||||||
3. Go to `Preferences | Editor | Copyright`, click the "+" button.
|
|
||||||
Scope: Copyright scope
|
|
||||||
Copyright: IdeaVim
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
1. Read about the `@VimBehaviorDiffers` annotation.
|
No beer in the bar for us unless it's fixed. [Let us know](https://github.com/JetBrains/ideavim#contact-maintainers) situation so we might be able to fix it.
|
||||||
|
|
||||||
2. Please avoid senseless text like "dhjkwaldjwa", "asdasdasd",
|
|
||||||
"123 123 123 123", etc. Try to choose an example text that is easy to
|
|
||||||
read and understand what is wrong if the test fails.
|
|
||||||
For example, take a few lines from your favorite poem, or use
|
|
||||||
"Vladimir Nabokov – A Discovery" if you don't have one.
|
|
||||||
|
|
||||||
3. Test your functionality properly.
|
### The lack of documentation or a javadoc/ktdoc makes it difficult to start contributing.
|
||||||
Especially check whether your command works with:
|
|
||||||
line start, line end, file start, file end, empty line, multiple carets, dollar motion, etc.
|
This is just terrible. [You know what to do](https://github.com/JetBrains/ideavim#contact-maintainers).
|
||||||
|
|
||||||
|
### Resources:
|
||||||
|
|
||||||
|
* [Continuous integration builds](https://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
|
||||||
|
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
|
||||||
|
* [Chat on gitter](https://gitter.im/JetBrains/ideavim)
|
||||||
|
* [Unofficial discord server](https://jb.gg/bi6zp7)
|
||||||
|
* [Plugin homepage](https://plugins.jetbrains.com/plugin/164-ideavim)
|
||||||
|
* [Changelog](CHANGES.md)
|
||||||
|
* [Contributors listing](AUTHORS.md)
|
||||||
|
|
||||||
|
[teamcity-build-status]: https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20201&guest=1
|
||||||
|
[teamcity-build-status-svg]: https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20201)/statusIcon.svg?guest=1
|
||||||
|
317
README.md
317
README.md
@@ -3,45 +3,47 @@
|
|||||||
IdeaVim
|
IdeaVim
|
||||||
===
|
===
|
||||||
|
|
||||||
<div>
|
[![Official JetBrains Project][jb-official-svg]][jb-official]
|
||||||
<a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
|
[![Contributions welcome][contributions-welcome-svg]][contributions-welcome]
|
||||||
<img src="https://jb.gg/badges/official.svg" alt="official JetBrains project"/>
|
[![Downloads][plugin-downloads-svg]][plugin-repo]
|
||||||
</a>
|
[![Rating][plugin-rating-svg]][plugin-repo]
|
||||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20201&guest=1">
|
[![Version][plugin-version-svg]][plugin-repo]
|
||||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20201)/statusIcon.svg?guest=1" alt="TeamCity Build"/>
|
[![Gitter][gitter-svg]][gitter]
|
||||||
</a>
|
[![Twitter][twitter-svg]][twitter]
|
||||||
</div>
|
|
||||||
|
|
||||||
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform.
|
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform.
|
||||||
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
|
|
||||||
RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
|
|
||||||
|
|
||||||
Resources:
|
##### Contact maintainers:
|
||||||
|
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
|
||||||
|
* [@IdeaVim](https://twitter.com/ideavim) on Twitter
|
||||||
|
* [Chat on gitter](https://gitter.im/JetBrains/ideavim)
|
||||||
|
* [Unofficial discord server](https://jb.gg/bi6zp7)
|
||||||
|
|
||||||
|
##### Resources:
|
||||||
|
|
||||||
* [Plugin homepage](https://plugins.jetbrains.com/plugin/164-ideavim)
|
* [Plugin homepage](https://plugins.jetbrains.com/plugin/164-ideavim)
|
||||||
* [Changelog](CHANGES.md)
|
* [Changelog](CHANGES.md)
|
||||||
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
|
|
||||||
* [Continuous integration builds](https://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
|
* [Continuous integration builds](https://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
|
||||||
* [@IdeaVim](https://twitter.com/ideavim) in Twitter
|
|
||||||
|
|
||||||
|
#### Compatibility
|
||||||
|
|
||||||
Installation
|
IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive,
|
||||||
|
Android Studio and other IntelliJ platform based IDEs.
|
||||||
|
|
||||||
|
Setup
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Use the IDE's plugin manager to install the latest version of the plugin.
|
- IdeaVim can be installed via `Settings | Plugins`.
|
||||||
Start the IDE normally and enable the Vim emulation using "Tools | Vim
|
See the [detailed instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#).
|
||||||
Emulator" menu item. At this point you must use Vim keystrokes in all editors.
|
|
||||||
|
|
||||||
If you wish to disable the plugin, select the "Tools | Vim Emulator" menu so
|
- Use `Tools | Vim Emulator` to enable or disable emulation.
|
||||||
it is unchecked. At this point your IDE will work with its regular keyboard
|
|
||||||
shortcuts.
|
|
||||||
|
|
||||||
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
|
- Use the `~/.ideavimrc` file as an analog of `~/.vimrc` ([learn more](#Files)). The XDG standard is supported, as well.
|
||||||
resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
|
|
||||||
Keymap" on Linux & Windows, and via "Preferences | Editor | Vim Emulation",
|
|
||||||
"Preferences | Keymap" on macOS. They can also be resolved by key-mapping
|
|
||||||
commands in your ~/.ideavimrc file.
|
|
||||||
|
|
||||||
|
- Shortcut conflicts can be resolved by using:
|
||||||
|
- On Linux & Windows: `File | Settings | Editor | Vim Emulation` & `File | Settings | Keymap`,
|
||||||
|
- On macOS: `Preferences | Editor | Vim Emulation` & `Preferences | Keymap`,
|
||||||
|
- Regular Vim mappings in the `~/.ideavimrc` file.
|
||||||
|
|
||||||
Get Early Access
|
Get Early Access
|
||||||
-------------------
|
-------------------
|
||||||
@@ -49,7 +51,9 @@ 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...`
|
1. Click the IdeaVim icon <img src="resources/META-INF/pluginIcon_noBorders.svg" width="16" height="16" alt="icon"/>
|
||||||
|
in the status bar | `EAP` | `Get Early Access...`
|
||||||
|
|
||||||
|
|
||||||
Or subscribe to EAP updates manually:
|
Or subscribe to EAP updates manually:
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ Or subscribe to EAP updates manually:
|
|||||||
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`
|
||||||
|
|
||||||
See [the changelog](CHANGES.md) for the list of hot unreleased features.
|
See [the changelog](CHANGES.md) for the list of unreleased features.
|
||||||
|
|
||||||
It is important to distinguish EAP builds from traditional pre-release software.
|
It is important to distinguish EAP builds 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
|
||||||
@@ -71,27 +75,18 @@ You can always leave your feedback with:
|
|||||||
Summary of Supported Vim Features
|
Summary of Supported Vim Features
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Supported:
|
Here are some examples of supported vim features and commands:
|
||||||
|
|
||||||
* Motion keys
|
* Normal / insert / visual / select / etc. modes
|
||||||
* Deletion/changing
|
* Motion / deletion / change / window / etc. commands
|
||||||
* Insert mode commands
|
|
||||||
* Marks
|
|
||||||
* Registers
|
|
||||||
* Undo/redo
|
|
||||||
* Visual mode commands
|
|
||||||
* Some Ex commands
|
|
||||||
* Some [:set options](doc/set-commands.md)
|
|
||||||
* Full Vim regexps for search and search/replace
|
|
||||||
* Key mappings
|
* Key mappings
|
||||||
* Macros
|
* Marks / Macros / Digraphs / Registers
|
||||||
* Digraphs
|
* Some [set commands](doc/set-commands.md)
|
||||||
* Command line and search history
|
* Full Vim regexps for search and search/replace
|
||||||
* Window commands
|
|
||||||
* Vim web help
|
* Vim web help
|
||||||
* Select mode
|
* `~/.ideavimrc` configuration file
|
||||||
|
|
||||||
Emulated Vim plugins:
|
[Emulated Vim plugins](doc/emulated-plugins.md):
|
||||||
|
|
||||||
* vim-easymotion
|
* vim-easymotion
|
||||||
* vim-surround
|
* vim-surround
|
||||||
@@ -100,100 +95,120 @@ Emulated Vim plugins:
|
|||||||
* argtextobj.vim
|
* argtextobj.vim
|
||||||
* vim-textobj-entire
|
* vim-textobj-entire
|
||||||
* ReplaceWithRegister
|
* ReplaceWithRegister
|
||||||
|
* vim-exchange
|
||||||
Not supported (yet):
|
* vim-highlightedyank
|
||||||
|
|
||||||
* Jump lists
|
|
||||||
* Various less-used commands
|
|
||||||
|
|
||||||
See also:
|
See also:
|
||||||
|
|
||||||
* [The list of all supported commands](src/com/maddyhome/idea/vim/package-info.java)
|
* [The list of all supported commands](src/com/maddyhome/idea/vim/package-info.java)
|
||||||
* [Top features and bugs](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
|
* [Top feature requests and bugs](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
|
||||||
|
|
||||||
|
|
||||||
Files
|
Files
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* ~/.ideavimrc
|
* `~/.ideavimrc`
|
||||||
* Your IdeaVim-specific Vim initialization commands
|
* Your IdeaVim-specific Vim initialization commands
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Example</strong> (click to see)</summary>
|
||||||
|
|
||||||
You can read your ~/.vimrc file from ~/.ideavimrc with this command:
|
```vim
|
||||||
|
""" Map leader to space ---------------------
|
||||||
|
let mapleader=" "
|
||||||
|
|
||||||
|
""" Plugins --------------------------------
|
||||||
|
set surround
|
||||||
|
set multiple-cursors
|
||||||
|
set commentary
|
||||||
|
set argtextobj
|
||||||
|
set easymotion
|
||||||
|
set textobj-entire
|
||||||
|
set ReplaceWithRegister
|
||||||
|
|
||||||
|
""" Plugin settings -------------------------
|
||||||
|
let g:argtextobj_pairs="[:],(:),<:>"
|
||||||
|
|
||||||
|
""" Common settings -------------------------
|
||||||
|
set showmode
|
||||||
|
set so=5
|
||||||
|
set incsearch
|
||||||
|
set nu
|
||||||
|
|
||||||
|
""" Idea specific settings ------------------
|
||||||
|
set ideajoin
|
||||||
|
set ideastatusicon=gray
|
||||||
|
set idearefactormode=keep
|
||||||
|
|
||||||
|
""" Mappings --------------------------------
|
||||||
|
map <leader>f <Plug>(easymotion-s)
|
||||||
|
map <leader>e <Plug>(easymotion-f)
|
||||||
|
|
||||||
|
map <leader>d :action Debug<CR>
|
||||||
|
map <leader>r :action RenameElement<CR>
|
||||||
|
map <leader>c :action Stop<CR>
|
||||||
|
map <leader>z :action ToggleDistractionFreeMode<CR>
|
||||||
|
|
||||||
|
map <leader>s :action SelectInProjectView<CR>
|
||||||
|
map <leader>a :action Annotate<CR>
|
||||||
|
map <leader>h :action Vcs.ShowTabbedFileHistory<CR>
|
||||||
|
map <S-Space> :action GotoNextError<CR>
|
||||||
|
|
||||||
|
map <leader>b :action ToggleLineBreakpoint<CR>
|
||||||
|
map <leader>o :action FileStructurePopup<CR>
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You can read your `~/.vimrc` file from `~/.ideavimrc` with this command:
|
||||||
|
|
||||||
source ~/.vimrc
|
source ~/.vimrc
|
||||||
|
|
||||||
Note, that IdeaVim currently parses ~/.ideavimrc file via simple pattern matching.
|
Please note that IdeaVim currently parses `~/.ideavimrc` & `~/.vimrc` files via simple pattern-matching.
|
||||||
See [VIM-669](https://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
|
See [VIM-669](https://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
|
||||||
of VimL files.
|
of VimL files.
|
||||||
|
|
||||||
Also note that if you have overridden the `user.home` JVM option, this
|
Also note that if you have overridden the `user.home` JVM option, this
|
||||||
will affect where IdeaVim looks for your .ideavimrc file. For example, if you
|
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.
|
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.
|
Put your settings to `$XDG_CONFIG_HOME/ideavim/ideavimrc` file.
|
||||||
|
|
||||||
|
|
||||||
Emulated Vim Plugins
|
Emulated Vim Plugins
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
IdeaVim extensions emulate some plugins of the original Vim. In order to use
|
See [doc/emulated-plugins.md](doc/emulated-plugins.md)
|
||||||
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
|
|
||||||
|
|
||||||
set <extension-name>
|
|
||||||
|
|
||||||
Available extensions:
|
|
||||||
|
|
||||||
* easymotion
|
|
||||||
* Setup:
|
|
||||||
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
|
|
||||||
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
|
|
||||||
* `set easymotion`
|
|
||||||
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
|
|
||||||
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
|
|
||||||
|
|
||||||
* surround
|
|
||||||
* Setup: `set surround`
|
|
||||||
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
|
|
||||||
* Commands: `ys`, `cs`, `ds`, `S`
|
|
||||||
|
|
||||||
* multiple-cursors
|
|
||||||
* Setup: `set multiple-cursors`
|
|
||||||
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
|
|
||||||
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
|
||||||
|
|
||||||
* commentary
|
|
||||||
* Setup: `set commentary`
|
|
||||||
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
|
|
||||||
* Commands: `gcc`, `gc + motion`, `v_gc`
|
|
||||||
|
|
||||||
* ReplaceWithRegister
|
|
||||||
* Setup: `set ReplaceWithRegister`
|
|
||||||
* Emulates [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister)
|
|
||||||
* Commands: `gr`, `grr`
|
|
||||||
|
|
||||||
* argtextobj
|
|
||||||
* Setup:
|
|
||||||
* `set argtextobj`
|
|
||||||
* By default, only the arguments inside parenthesis are considered. To extend the functionality
|
|
||||||
to other types of brackets, set `g:argtextobj_pairs` variable to a comma-separated
|
|
||||||
list of colon-separated pairs (same as VIM's `matchpairs` option), like
|
|
||||||
`let g:argtextobj_pairs="(:),{:},<:>"`. The order of pairs matters when
|
|
||||||
handling symbols that can also be operators: `func(x << 5, 20) >> 17`. To handle
|
|
||||||
this syntax parenthesis, must come before angle brackets in the list.
|
|
||||||
* Emulates [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699)
|
|
||||||
* Additional text objects: `aa`, `ia`
|
|
||||||
|
|
||||||
* textobj-entire
|
|
||||||
* Setup: `set textobj-entire`
|
|
||||||
* Emulates [vim-textobj-entire](https://github.com/kana/vim-textobj-entire)
|
|
||||||
* Additional text objects: `ae`, `ie`
|
|
||||||
|
|
||||||
|
|
||||||
Changes to the IDE
|
Changes to the IDE
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
### Executing IDE Actions
|
||||||
|
|
||||||
|
IdeaVim adds two commands for listing and executing arbitrary IDE actions as
|
||||||
|
Ex commands or via `:map` command mappings:
|
||||||
|
|
||||||
|
* `:actionlist [pattern]`
|
||||||
|
* Find IDE actions by name or keymap pattern (E.g. `:actionlist extract`, `:actionlist <C-D`)
|
||||||
|
* `:action {name}`
|
||||||
|
* Execute an action named `NAME`
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Map \r to the Reformat Code action
|
||||||
|
:map \r :action ReformatCode<CR>
|
||||||
|
|
||||||
|
" Map <leader>d to start debug
|
||||||
|
:map <leader>d :action Debug<CR>
|
||||||
|
|
||||||
|
" Map \b to toggle the breakpoint on the current line
|
||||||
|
:map \b :action ToggleLineBreakpoint<CR>
|
||||||
|
```
|
||||||
|
|
||||||
### Undo/Redo
|
### Undo/Redo
|
||||||
|
|
||||||
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ Platform,
|
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ Platform,
|
||||||
@@ -212,25 +227,12 @@ improvement.
|
|||||||
|
|
||||||
See also [unresolved escape issues](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
|
See also [unresolved escape issues](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
|
||||||
|
|
||||||
### Executing IDE Actions
|
:gem: Contributing
|
||||||
|
|
||||||
IdeaVim adds two commands for listing and executing arbitrary IDE actions as
|
|
||||||
Ex commands or via `:map` command mappings:
|
|
||||||
|
|
||||||
* `:actionlist [pattern]`
|
|
||||||
* Find IDE actions by name or keymap pattern (E.g. `:actionlist extract`, `:actionlist <C-D`)
|
|
||||||
* `:action {name}`
|
|
||||||
* Execute an action named `NAME`
|
|
||||||
|
|
||||||
For example, here `\r` is mapped to the Reformat Code action:
|
|
||||||
|
|
||||||
:map \r :action ReformatCode<CR>
|
|
||||||
|
|
||||||
|
|
||||||
Contributing
|
|
||||||
------------
|
------------
|
||||||
|
|
||||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
The power of contributing drives IdeaVim :muscle:. Even small contributions matter!
|
||||||
|
|
||||||
|
See [CONTRIBUTING.md](CONTRIBUTING.md) to start bringing your value to the project.
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
@@ -238,9 +240,76 @@ Authors
|
|||||||
See [AUTHORS.md](AUTHORS.md)
|
See [AUTHORS.md](AUTHORS.md)
|
||||||
for a list of authors and contributors.
|
for a list of authors and contributors.
|
||||||
|
|
||||||
|
IdeaVim tips and tricks
|
||||||
|
-------
|
||||||
|
|
||||||
|
- Use the power of IJ and Vim:
|
||||||
|
- `set ideajoin` to enable join via the IDE. See the [examples](https://jb.gg/f9zji9).
|
||||||
|
- Make sure `ideaput` is enabled for `clipboard` to enable native IJ insertion in Vim.
|
||||||
|
- Sync IJ bookmarks and Vim marks: `set ideamarks`
|
||||||
|
- Check out more [ex commands](doc/set-commands.md).
|
||||||
|
|
||||||
|
- Use your vim settings with IdeaVim. Put `source ~/.vimrc` in `~/.ideavimrc`.
|
||||||
|
> :warning: Please note that IdeaVim currently parses `~/.ideavimrc` & `~/.vimrc` files via simple pattern-matching.
|
||||||
|
See [VIM-669](https://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
|
||||||
|
of VimL files.
|
||||||
|
|
||||||
|
- Control the status bar icon via the [`ideastatusicon` option](doc/set-commands.md).
|
||||||
|
- Not familiar with the default behaviour during a refactoring? See the [`idearefactormode` option](doc/set-commands.md).
|
||||||
|
|
||||||
|
Some facts about Vim
|
||||||
|
-------
|
||||||
|
|
||||||
|
Let’s relax and have some fun now! Here are a few things we've found interesting during development
|
||||||
|
and would like to share with you.
|
||||||
|
|
||||||
|
- There are no such commands as `dd`, `yy`, or `cc`. For example, `dd` is not a separate command for deleting the line,
|
||||||
|
but a `d` command with a `d` motion.
|
||||||
|
Wait, but there isn't a `d` motion in Vim! That’s right, and that’s why Vim has a dedicated set of commands
|
||||||
|
for which it checks whether the
|
||||||
|
[command equals to motion](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/normal.c#L6468)
|
||||||
|
and if so, it executes `_` motion instead.
|
||||||
|
`_` is an interesting motion that isn't even documented in vi, and it refers to the current line.
|
||||||
|
So, commands like `dd`, `yy`, and similar ones are simply translated to `d_`, `y_`, etc.
|
||||||
|
[Here](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/normal.c#L6502)
|
||||||
|
is the source of this knowledge.
|
||||||
|
|
||||||
|
- `x`, `D`, and `&` are not separate commands either. They are synonyms of `dl`, `d$`, and `:s\r`, respectively.
|
||||||
|
[Here](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/normal.c#L5365)
|
||||||
|
is the full list of synonyms.
|
||||||
|
|
||||||
|
- Have you ever used `U` after `dd`? [Don't even try](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/ops.c#L874).
|
||||||
|
|
||||||
|
- A lot of variables that refers to visual mode start with two uppercase letters, e.g. `VIsual_active`. [Some examples](https://github.com/vim/vim/blob/master/src/normal.c#L17).
|
||||||
|
|
||||||
|
- Other [strange things](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/ex_docmd.c#L1845) from vi:
|
||||||
|
* ":3" jumps to line 3
|
||||||
|
* ":3|..." prints line 3
|
||||||
|
* ":|" prints current line
|
||||||
|
|
||||||
|
- Vim script doesn't skip white space before comma. `F(a ,b)` => E475.
|
||||||
|
|
||||||
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.
|
or any later version.
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Badges -->
|
||||||
|
[jb-official]: https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub
|
||||||
|
[jb-official-svg]: https://jb.gg/badges/official.svg
|
||||||
|
|
||||||
|
[plugin-repo]: https://plugins.jetbrains.com/plugin/164-ideavim
|
||||||
|
[plugin-downloads-svg]: http://img.shields.io/jetbrains/plugin/d/IdeaVIM
|
||||||
|
[plugin-rating-svg]: http://img.shields.io/jetbrains/plugin/r/rating/IdeaVIM
|
||||||
|
[plugin-version-svg]: https://img.shields.io/jetbrains/plugin/v/ideavim?label=version
|
||||||
|
|
||||||
|
[gitter-svg]: https://badges.gitter.im/JetBrains/ideavim.svg
|
||||||
|
[gitter]: https://gitter.im/JetBrains/ideavim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
||||||
|
|
||||||
|
[twitter]: https://twitter.com/ideavim
|
||||||
|
[twitter-svg]: https://img.shields.io/twitter/follow/ideavim?label=twitter%20%40ideavim
|
||||||
|
|
||||||
|
[contributions-welcome-svg]: http://img.shields.io/badge/contributions-welcome-brightgreen
|
||||||
|
[contributions-welcome]: https://github.com/JetBrains/ideavim/blob/master/CONTRIBUTING.md
|
||||||
|
24
build.gradle
24
build.gradle
@@ -9,7 +9,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.jetbrains.intellij' version '0.4.16'
|
id 'org.jetbrains.intellij' version '0.4.18'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
@@ -37,11 +37,7 @@ intellij {
|
|||||||
downloadSources Boolean.valueOf(downloadIdeaSources)
|
downloadSources Boolean.valueOf(downloadIdeaSources)
|
||||||
instrumentCode Boolean.valueOf(instrumentPluginCode)
|
instrumentCode Boolean.valueOf(instrumentPluginCode)
|
||||||
intellijRepo = "https://www.jetbrains.com/intellij-repository"
|
intellijRepo = "https://www.jetbrains.com/intellij-repository"
|
||||||
if (!Boolean.valueOf(legacyNoJavaPlugin)) {
|
plugins = ['java']
|
||||||
// Since 192 version of IJ java plugin should be defined separately
|
|
||||||
// Set `legacyNoJavaPlugin` to true if you are going to run tests under idea version < 192
|
|
||||||
plugins = ['java']
|
|
||||||
}
|
|
||||||
|
|
||||||
publishPlugin {
|
publishPlugin {
|
||||||
channels publishChannels.split(',')
|
channels publishChannels.split(',')
|
||||||
@@ -57,6 +53,9 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
||||||
compileOnly "org.jetbrains:annotations:19.0.0"
|
compileOnly "org.jetbrains:annotations:19.0.0"
|
||||||
|
|
||||||
|
// https://mvnrepository.com/artifact/com.ensarsarajcic.neovim.java/neovim-api
|
||||||
|
compile group: 'com.ensarsarajcic.neovim.java', name: 'neovim-api', version: '0.1.16'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
@@ -70,6 +69,11 @@ compileTestKotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task testWithNeovim(type : Test) {
|
||||||
|
group = "verification"
|
||||||
|
systemProperty "ideavim.neovim.test", 'true'
|
||||||
|
}
|
||||||
|
|
||||||
tasks.register("slackEapNotification") {
|
tasks.register("slackEapNotification") {
|
||||||
doLast {
|
doLast {
|
||||||
if (!slackUrl) return
|
if (!slackUrl) return
|
||||||
@@ -77,16 +81,16 @@ tasks.register("slackEapNotification") {
|
|||||||
def changeLog = extractChangelog()
|
def changeLog = extractChangelog()
|
||||||
changeLog = changeLog.replace("* ", "• ") // Replace stars with bullets
|
changeLog = changeLog.replace("* ", "• ") // Replace stars with bullets
|
||||||
changeLog = changeLog.replace("**", "*") // Enable bold text
|
changeLog = changeLog.replace("**", "*") // Enable bold text
|
||||||
changeLog = changeLog.replaceAll("\\[(.+)]\\(([^)]+)\\)", '<$2|$1>') // Enable links
|
changeLog = changeLog.replaceAll("\\[([^]]+)]\\(([^)]+)\\)", '<$2|$1>') // Enable links
|
||||||
def message ="""
|
def message ="""
|
||||||
{
|
{
|
||||||
"text": "Danny Torrence left a 1 star review for your property.",
|
"text": "New version of IdeaVim",
|
||||||
"blocks": [
|
"blocks": [
|
||||||
{
|
{
|
||||||
"type": "section",
|
"type": "section",
|
||||||
"text": {
|
"text": {
|
||||||
"type": "mrkdwn",
|
"type": "mrkdwn",
|
||||||
"text": "New EAP released: $version\\n$changeLog"
|
"text": "IdeaVim EAP $version has been released\\n$changeLog"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -126,4 +130,4 @@ def extractChangelog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.toString()
|
return res.toString()
|
||||||
}
|
}
|
||||||
|
84
doc/emulated-plugins.md
Normal file
84
doc/emulated-plugins.md
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
Emulated Vim Plugins
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
IdeaVim extensions emulate plugins of the original Vim. In order to use
|
||||||
|
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
|
||||||
|
|
||||||
|
set <extension-name>
|
||||||
|
|
||||||
|
Available extensions:
|
||||||
|
|
||||||
|
## easymotion
|
||||||
|
|
||||||
|
* Setup:
|
||||||
|
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
|
||||||
|
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
|
||||||
|
* `set easymotion`
|
||||||
|
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
|
||||||
|
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
|
||||||
|
|
||||||
|
## surround
|
||||||
|
|
||||||
|
* Setup: `set surround`
|
||||||
|
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
|
||||||
|
* Commands: `ys`, `cs`, `ds`, `S`
|
||||||
|
|
||||||
|
## multiple-cursors
|
||||||
|
|
||||||
|
* Setup: `set multiple-cursors`
|
||||||
|
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
|
||||||
|
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
||||||
|
|
||||||
|
## commentary
|
||||||
|
|
||||||
|
* Setup: `set commentary`
|
||||||
|
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
|
||||||
|
* Commands: `gcc`, `gc + motion`, `v_gc`
|
||||||
|
* By [Daniel Leong](https://github.com/dhleong)
|
||||||
|
|
||||||
|
## ReplaceWithRegister
|
||||||
|
|
||||||
|
* Setup: `set ReplaceWithRegister`
|
||||||
|
* Emulates [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister)
|
||||||
|
* Commands: `gr`, `grr`
|
||||||
|
* By [igrekster](https://github.com/igrekster)
|
||||||
|
|
||||||
|
## argtextobj
|
||||||
|
|
||||||
|
* Setup:
|
||||||
|
* `set argtextobj`
|
||||||
|
* By default, only the arguments inside parenthesis are considered. To extend the functionality
|
||||||
|
to other types of brackets, set `g:argtextobj_pairs` variable to a comma-separated
|
||||||
|
list of colon-separated pairs (same as VIM's `matchpairs` option), like
|
||||||
|
`let g:argtextobj_pairs="(:),{:},<:>"`. The order of pairs matters when
|
||||||
|
handling symbols that can also be operators: `func(x << 5, 20) >> 17`. To handle
|
||||||
|
this syntax parenthesis, must come before angle brackets in the list.
|
||||||
|
* Emulates [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699)
|
||||||
|
* Additional text objects: `aa`, `ia`
|
||||||
|
|
||||||
|
## exchange
|
||||||
|
|
||||||
|
* Setup: `set exchange`
|
||||||
|
* Emulates [vim-exchange](https://github.com/tommcdo/vim-exchange)
|
||||||
|
* Commands: `cx`, `cxx`, `X`, `cxc`
|
||||||
|
* By [fan-tom](https://github.com/fan-tom)
|
||||||
|
|
||||||
|
## textobj-entire
|
||||||
|
|
||||||
|
* Setup: `set textobj-entire`
|
||||||
|
* Emulates [vim-textobj-entire](https://github.com/kana/vim-textobj-entire)
|
||||||
|
* Additional text objects: `ae`, `ie`
|
||||||
|
* By [Alexandre Grison](https://github.com/agrison)
|
||||||
|
|
||||||
|
## highlightedyank
|
||||||
|
|
||||||
|
* Setup:
|
||||||
|
* `set highlightedyank`
|
||||||
|
* if you want to optimize highlight duration, assign a time in milliseconds:
|
||||||
|
`let g:highlightedyank_highlight_duration = "1000"`
|
||||||
|
A negative number makes the highlight persistent.
|
||||||
|
`let g:highlightedyank_highlight_duration = "-1"`
|
||||||
|
* if you want to change background color of highlight you can provide the rgba of the color you want e.g.
|
||||||
|
`let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"`
|
||||||
|
* Emulates [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank)
|
||||||
|
* By [KostkaBrukowa](https://github.com/KostkaBrukowa)
|
@@ -38,6 +38,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
|||||||
acts like startsel is enabled
|
acts like startsel is enabled
|
||||||
|
|
||||||
'matchpairs' 'mps' pairs of characters that "%" can match
|
'matchpairs' 'mps' pairs of characters that "%" can match
|
||||||
|
'more' 'more' When on, listings pause when the whole screen is filled.
|
||||||
'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
|
||||||
'relativenumber' 'rnu' show the line number relative to the line with
|
'relativenumber' 'rnu' show the line number relative to the line with
|
||||||
@@ -118,8 +119,13 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
|||||||
- enabled - icon is shown in the status bar
|
- enabled - icon is shown in the status bar
|
||||||
- gray - use the gray version of the icon
|
- gray - use the gray version of the icon
|
||||||
- disabled - hide the icon
|
- disabled - hide the icon
|
||||||
|
|
||||||
Works only from `~/.ideavimrc` after the IDE restart.
|
`ideawrite` `ideawrite` String (default "all")
|
||||||
|
"file" or "all". Defines the behaviour of ":w" command.
|
||||||
|
Value "all" enables execution of ":wa" (save all) command on ":w" (save).
|
||||||
|
This feature exists because some IJ options like "Prettier on save" or "ESlint on save"
|
||||||
|
work only with "save all" action. If this option is set to "all", these actions work
|
||||||
|
also with ":w" command.
|
||||||
|
|
||||||
`lookupkeys` `lookupkeys` List of strings
|
`lookupkeys` `lookupkeys` List of strings
|
||||||
|
|
||||||
|
@@ -1,16 +1,13 @@
|
|||||||
# suppress inspection "UnusedProperty" for whole file
|
# suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
ideaVersion=201-EAP-SNAPSHOT
|
ideaVersion=LATEST-EAP-SNAPSHOT
|
||||||
downloadIdeaSources=true
|
downloadIdeaSources=true
|
||||||
instrumentPluginCode=true
|
instrumentPluginCode=true
|
||||||
version=SNAPSHOT
|
version=SNAPSHOT
|
||||||
javaVersion=1.8
|
javaVersion=1.8
|
||||||
kotlinVersion=1.3.70
|
kotlinVersion=1.3.71
|
||||||
publishUsername=username
|
publishUsername=username
|
||||||
publishToken=token
|
publishToken=token
|
||||||
publishChannels=eap
|
publishChannels=eap
|
||||||
# Since 192 version of IJ java plugin should be defined separately
|
|
||||||
# Set this value to true if you are going to run tests under idea version < 192
|
|
||||||
legacyNoJavaPlugin=false
|
|
||||||
|
|
||||||
slackUrl=
|
slackUrl=
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
|||||||
#Fri Mar 20 11:41:45 MSK 2020
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
31
gradlew
vendored
31
gradlew
vendored
@@ -82,6 +82,7 @@ esac
|
|||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
@@ -129,6 +130,7 @@ fi
|
|||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -175,14 +177,9 @@ save () {
|
|||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
4
gradlew.bat
vendored
4
gradlew.bat
vendored
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
|||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*
|
|||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
@@ -150,6 +150,8 @@
|
|||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenColumnAction" mappingModes="NXO" keys="ze"/>
|
<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.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.scroll.MotionScrollColumnRightAction" mappingModes="NXO" keys="zh,z«Left»"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfWidthLeftAction" mappingModes="NXO" keys="zL"/>
|
||||||
|
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfWidthRightAction" mappingModes="NXO" keys="zH"/>
|
||||||
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftDownAction" mappingModes="NV" keys="«S-Down»"/>
|
<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.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.MotionShiftRightAction" mappingModes="NV" keys="«S-Right»"/>
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ActionHandler" names="action"/>
|
<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.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.ExitHandler" names="qa[ll],quita[ll],wqa[ll],xa[ll]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FileHandler" names="f[ile]"/>
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindClassHandler" names="cla[ss]"/>
|
<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.FindFileHandler" names="fin[d]"/>
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindSymbolHandler" names="sym[bol]"/>
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindSymbolHandler" names="sym[bol]"/>
|
||||||
@@ -60,6 +61,8 @@
|
|||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextTabHandler" names="tabn[ext]"/>
|
<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.PreviousTabHandler" names="tabp[revious],tabN[ext]"/>
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabOnlyHandler" names="tabo[nly]"/>
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabOnlyHandler" names="tabo[nly]"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabCloseHandler" names="tabc[lose]"/>
|
||||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.BufferListHandler" names="buffers,ls,files"/>
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.BufferListHandler" names="buffers,ls,files"/>
|
||||||
|
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.BufferHandler" names="b[uffer]"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
@@ -6,5 +6,7 @@
|
|||||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.textobjentire.VimTextObjEntireExtension"/>
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.textobjentire.VimTextObjEntireExtension"/>
|
||||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.argtextobj.VimArgTextObjExtension"/>
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.argtextobj.VimArgTextObjExtension"/>
|
||||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.replacewithregister.ReplaceWithRegister"/>
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.replacewithregister.ReplaceWithRegister"/>
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension"/>
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.highlightedyank.VimHighlightedYank"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
25
resources/META-INF/includes/VimListeners.xml
Normal file
25
resources/META-INF/includes/VimListeners.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<applicationListeners>
|
||||||
|
<listener class="com.maddyhome.idea.vim.ui.ExEntryPanel$LafListener"
|
||||||
|
topic="com.intellij.ide.ui.LafManagerListener"/>
|
||||||
|
</applicationListeners>
|
||||||
|
<projectListeners>
|
||||||
|
<listener class="com.maddyhome.idea.vim.ui.ExOutputPanel$LafListener"
|
||||||
|
topic="com.intellij.ide.ui.LafManagerListener"/>
|
||||||
|
|
||||||
|
<listener class="com.maddyhome.idea.vim.listener.VimListenerManager$VimFileEditorManagerListener"
|
||||||
|
topic="com.intellij.openapi.fileEditor.FileEditorManagerListener"/>
|
||||||
|
|
||||||
|
<listener class="com.maddyhome.idea.vim.listener.IdeaSpecifics$VimActionListener"
|
||||||
|
topic="com.intellij.openapi.actionSystem.ex.AnActionListener"/>
|
||||||
|
|
||||||
|
<listener class="com.maddyhome.idea.vim.listener.IdeaSpecifics$VimTemplateManagerListener"
|
||||||
|
topic="com.intellij.codeInsight.template.TemplateManagerListener"/>
|
||||||
|
|
||||||
|
<listener class="com.maddyhome.idea.vim.group.MarkGroup$MarkListener"
|
||||||
|
topic="com.intellij.ide.bookmarks.BookmarksListener"/>
|
||||||
|
|
||||||
|
<listener class="com.maddyhome.idea.vim.listener.IdeaSpecifics$VimFindModelListener"
|
||||||
|
topic="com.intellij.find.FindModelListener"/>
|
||||||
|
</projectListeners>
|
||||||
|
</idea-plugin>
|
@@ -3,13 +3,8 @@
|
|||||||
<id>IdeaVIM</id>
|
<id>IdeaVIM</id>
|
||||||
<change-notes><![CDATA[
|
<change-notes><![CDATA[
|
||||||
<ul>
|
<ul>
|
||||||
<li>Support ReplaceWithRegister plugin emulation</li>
|
<li>Support of `virtualedit=onemore`</li>
|
||||||
<li>Support argtextobj.vim plugin emulation</li>
|
<li>A lot of fixes for scrolling</li>
|
||||||
<li>Support vim-textobj-entire plugin emulation</li>
|
|
||||||
<li>Support showcmd command</li>
|
|
||||||
<li>Support ls/buffers/files command</li>
|
|
||||||
<li>Control the icon in the status bar using an `ideastatusicon` option</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>
|
||||||
@@ -27,7 +22,7 @@
|
|||||||
|
|
||||||
<!-- 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 -->
|
<!-- Check for [Version Update] tag in YouTrack as well -->
|
||||||
<idea-version since-build="183.4284.148"/>
|
<idea-version since-build="201.5985.32"/>
|
||||||
|
|
||||||
<!-- 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 -->
|
||||||
<depends>com.intellij.modules.lang</depends>
|
<depends>com.intellij.modules.lang</depends>
|
||||||
@@ -55,30 +50,54 @@
|
|||||||
<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"/>
|
||||||
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
||||||
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.StatusBarIconProvider"/>
|
<statusBarWidgetFactory implementation="com.maddyhome.idea.vim.ui.StatusBarIconFactory"/>
|
||||||
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.ui.ShowCmdStatusBarWidget"/>
|
<statusBarWidgetFactory implementation="com.maddyhome.idea.vim.ui.ShowCmdStatusBarWidgetFactory" order="first"/>
|
||||||
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimLocalConfig"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.config.VimLocalConfig"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimPlugin"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimPlugin"/>
|
||||||
|
|
||||||
<postStartupActivity implementation="com.maddyhome.idea.vim.PluginStartup"/>
|
<!-- Initialise as early as possible so that we're ready to edit quickly. This is especially important for Rider,
|
||||||
|
which (at least for 2020.1) has some long running activities that block other startup extensions. None of the
|
||||||
|
core platform activities have IDs, so we can't use "before ID". We have to use "first" -->
|
||||||
|
<postStartupActivity implementation="com.maddyhome.idea.vim.PluginStartup" order="first"/>
|
||||||
|
|
||||||
|
<editorFloatingToolbarProvider implementation="com.maddyhome.idea.vim.ui.ReloadFloatingToolbar"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|
||||||
<xi:include href="/META-INF/includes/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
<xi:include href="/META-INF/includes/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
|
|
||||||
<xi:include href="/META-INF/includes/VimActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
<xi:include href="/META-INF/includes/VimActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
<xi:include href="/META-INF/includes/VimExCommands.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
<xi:include href="/META-INF/includes/VimExCommands.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
<xi:include href="/META-INF/includes/VimExtensions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
<xi:include href="/META-INF/includes/VimExtensions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
|
<xi:include href="/META-INF/includes/VimListeners.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||||
|
|
||||||
<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">
|
||||||
<add-to-group group-id="ToolsMenu" anchor="last"/>
|
<add-to-group group-id="ToolsMenu" anchor="last"/>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
<!-- Internal -->
|
<!-- Internal -->
|
||||||
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Add Test Inlays | IdeaVim Internal" internal="true"/>
|
<action id="VimInternalAddBlockInlays" class="com.maddyhome.idea.vim.action.internal.AddBlockInlaysAction" text="Add Test Block Inlays | IdeaVim Internal" internal="true"/>
|
||||||
|
<action id="VimInternalAddInlineInlays" class="com.maddyhome.idea.vim.action.internal.AddInlineInlaysAction" text="Add Test Inline Inlays | IdeaVim Internal" internal="true"/>
|
||||||
|
|
||||||
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
|
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction"/>
|
||||||
<action id="VimActions" class="com.maddyhome.idea.vim.VimActions" text="Vim Actions"/>
|
<action id="VimActions" class="com.maddyhome.idea.vim.ui.VimActions"/>
|
||||||
|
|
||||||
|
<!-- [Version Update] 202+ use-shortcut-of="ExternalSystem.ProjectRefreshAction" -->
|
||||||
|
<group id="IdeaVim.ReloadVimRc.group" class="com.maddyhome.idea.vim.ui.ReloadFloatingToolbarActionGroup">
|
||||||
|
<action id="IdeaVim.ReloadVimRc.reload" class="com.maddyhome.idea.vim.ui.ReloadVimRc">
|
||||||
|
<keyboard-shortcut first-keystroke="control shift O" keymap="$default"/>
|
||||||
|
<keyboard-shortcut first-keystroke="control shift O" keymap="Eclipse" remove="true"/>
|
||||||
|
<keyboard-shortcut first-keystroke="control shift O" keymap="NetBeans 6.5" remove="true"/>
|
||||||
|
<keyboard-shortcut first-keystroke="control shift O" keymap="Visual Studio" remove="true"/>
|
||||||
|
<keyboard-shortcut first-keystroke="meta shift O" keymap="Mac OS X" replace-all="true"/>
|
||||||
|
<keyboard-shortcut first-keystroke="meta shift O" keymap="Eclipse (Mac OS X)" replace-all="true" remove="true"/>
|
||||||
|
<keyboard-shortcut first-keystroke="meta shift O" keymap="Xcode" replace-all="true" remove="true"/>
|
||||||
|
<keyboard-shortcut first-keystroke="meta shift I" keymap="Mac OS X 10.5+" replace-all="true"/>
|
||||||
|
</action>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<action id="VimFindActionIdAction"
|
||||||
|
class="com.maddyhome.idea.vim.listener.FindActionIdAction" text="IdeaVim: Track Action Ids"
|
||||||
|
description="Starts tracking ids of executed actions"/>
|
||||||
</actions>
|
</actions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
9
resources/META-INF/pluginIcon_noBorders.svg
Normal file
9
resources/META-INF/pluginIcon_noBorders.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="ideavim_plugin-a" x1="-6.748%" x2="47.286%" y1="33.61%" y2="85.907%">
|
||||||
|
<stop offset="0%" stop-color="#3BEA62"/>
|
||||||
|
<stop offset="100%" stop-color="#087CFA"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd" points="29.019 0 13.988 26.119 13.988 0 0 0 0 40 16.953 40 40 0"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 450 B |
BIN
resources/changes/0.58/reload_ideavimrc.png
Normal file
BIN
resources/changes/0.58/reload_ideavimrc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
BIN
resources/changes/0.59/highlight_yank.gif
Normal file
BIN
resources/changes/0.59/highlight_yank.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 128 KiB |
@@ -70,3 +70,10 @@ unkopt=Unknown option: {0}
|
|||||||
e_invarg=Invalid argument: {0}
|
e_invarg=Invalid argument: {0}
|
||||||
E475=E475: Invalid argument: {0}
|
E475=E475: Invalid argument: {0}
|
||||||
E774=E774: 'operatorfunc' is empty
|
E774=E774: 'operatorfunc' is empty
|
||||||
|
|
||||||
|
action.VimPluginToggle.text=Vim Emulator
|
||||||
|
description.VimPluginToggle.description=Toggle the vim plugin On/off
|
||||||
|
|
||||||
|
action.VimShortcutKeyAction.text=Shortcuts
|
||||||
|
|
||||||
|
action.VimActions.text=Vim Actions
|
||||||
|
@@ -19,15 +19,9 @@
|
|||||||
package com.maddyhome.idea.vim;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
import com.intellij.codeInsight.lookup.LookupManager;
|
import com.intellij.codeInsight.lookup.LookupManager;
|
||||||
import com.intellij.codeInsight.template.TemplateManager;
|
|
||||||
import com.intellij.codeInsight.template.TemplateManagerListener;
|
|
||||||
import com.intellij.find.FindManager;
|
|
||||||
import com.intellij.find.FindModelListener;
|
|
||||||
import com.intellij.ide.bookmarks.BookmarksListener;
|
|
||||||
import com.intellij.openapi.Disposable;
|
import com.intellij.openapi.Disposable;
|
||||||
import com.intellij.openapi.actionSystem.AnAction;
|
import com.intellij.openapi.actionSystem.AnAction;
|
||||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||||
import com.intellij.openapi.actionSystem.ex.AnActionListener;
|
|
||||||
import com.intellij.openapi.editor.Document;
|
import com.intellij.openapi.editor.Document;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.EditorFactory;
|
import com.intellij.openapi.editor.EditorFactory;
|
||||||
@@ -35,10 +29,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
|||||||
import com.intellij.openapi.editor.actionSystem.TypedAction;
|
import com.intellij.openapi.editor.actionSystem.TypedAction;
|
||||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||||
import com.intellij.openapi.editor.event.*;
|
import com.intellij.openapi.editor.event.*;
|
||||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
|
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.util.Disposer;
|
|
||||||
import com.intellij.util.messages.MessageBusConnection;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -46,8 +37,6 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author vlan
|
* @author vlan
|
||||||
@@ -56,7 +45,6 @@ public class EventFacade {
|
|||||||
private static final @NotNull EventFacade ourInstance = new EventFacade();
|
private static final @NotNull EventFacade ourInstance = new EventFacade();
|
||||||
|
|
||||||
private @Nullable TypedActionHandler myOriginalTypedActionHandler;
|
private @Nullable TypedActionHandler myOriginalTypedActionHandler;
|
||||||
private Map<Project, MessageBusConnection> connections = new HashMap<>();
|
|
||||||
|
|
||||||
private EventFacade() {
|
private EventFacade() {
|
||||||
}
|
}
|
||||||
@@ -88,35 +76,10 @@ public class EventFacade {
|
|||||||
action.registerCustomShortcutSet(shortcutSet, component, disposable);
|
action.registerCustomShortcutSet(shortcutSet, component, disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterCustomShortcutSet(@NotNull AnAction action, @Nullable JComponent component) {
|
public void unregisterCustomShortcutSet(@NotNull AnAction action, @NotNull JComponent component) {
|
||||||
action.unregisterCustomShortcutSet(component);
|
action.unregisterCustomShortcutSet(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connectFileEditorManagerListener(@NotNull Project project, @NotNull FileEditorManagerListener listener) {
|
|
||||||
final MessageBusConnection connection = getConnection(project);
|
|
||||||
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connectAnActionListener(@NotNull Project project, @NotNull AnActionListener listener) {
|
|
||||||
final MessageBusConnection connection = getConnection(project);
|
|
||||||
connection.subscribe(AnActionListener.TOPIC, listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connectTemplateStartedListener(@NotNull Project project, @NotNull TemplateManagerListener listener) {
|
|
||||||
final MessageBusConnection connection = getConnection(project);
|
|
||||||
connection.subscribe(TemplateManager.TEMPLATE_STARTED_TOPIC, listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connectBookmarkListener(@NotNull Project project, @NotNull BookmarksListener bookmarksListener) {
|
|
||||||
final MessageBusConnection connection = getConnection(project);
|
|
||||||
connection.subscribe(BookmarksListener.TOPIC, bookmarksListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connectFindModelListener(@NotNull Project project, @NotNull FindModelListener findModelListener) {
|
|
||||||
final MessageBusConnection connection = getConnection(project);
|
|
||||||
connection.subscribe(FindManager.FIND_MODEL_TOPIC, findModelListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
|
public void addDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
|
||||||
document.addDocumentListener(listener);
|
document.addDocumentListener(listener);
|
||||||
}
|
}
|
||||||
@@ -168,30 +131,14 @@ public class EventFacade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerLookupListener(@NotNull Project project, @NotNull PropertyChangeListener propertyChangeListener) {
|
public void registerLookupListener(@NotNull Project project, @NotNull PropertyChangeListener propertyChangeListener) {
|
||||||
LookupManager.getInstance(project).addPropertyChangeListener(propertyChangeListener, project);
|
VimProjectService parentDisposable = VimProjectService.getInstance(project);
|
||||||
|
LookupManager.getInstance(project).addPropertyChangeListener(propertyChangeListener, parentDisposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLookupListener(@NotNull Project project, @NotNull PropertyChangeListener propertyChangeListener) {
|
public void removeLookupListener(@NotNull Project project, @NotNull PropertyChangeListener propertyChangeListener) {
|
||||||
LookupManager.getInstance(project).removePropertyChangeListener(propertyChangeListener);
|
LookupManager.getInstance(project).removePropertyChangeListener(propertyChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableBusConnection() {
|
|
||||||
connections.values().forEach(MessageBusConnection::disconnect);
|
|
||||||
connections.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private MessageBusConnection getConnection(Project project) {
|
|
||||||
if (!connections.containsKey(project)) {
|
|
||||||
final MessageBusConnection connection = project.getMessageBus().connect();
|
|
||||||
connections.put(project, connection);
|
|
||||||
Disposer.register(project, () -> {
|
|
||||||
connection.disconnect();
|
|
||||||
connections.remove(project);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return connections.get(project);
|
|
||||||
}
|
|
||||||
|
|
||||||
private @NotNull TypedAction getTypedAction() {
|
private @NotNull TypedAction getTypedAction() {
|
||||||
return EditorActionManager.getInstance().getTypedAction();
|
return EditorActionManager.getInstance().getTypedAction();
|
||||||
}
|
}
|
||||||
|
@@ -337,7 +337,8 @@ public class KeyHandler {
|
|||||||
|
|
||||||
if (commandBuilder.isAwaitingCharOrDigraphArgument()
|
if (commandBuilder.isAwaitingCharOrDigraphArgument()
|
||||||
|| commandBuilder.isBuildingMultiKeyCommand()
|
|| commandBuilder.isBuildingMultiKeyCommand()
|
||||||
|| isMappingDisabledForKey(key, commandState)) {
|
|| isMappingDisabledForKey(key, commandState)
|
||||||
|
|| commandState.getSubMode() == CommandState.SubMode.REGISTER_PENDING) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,18 +561,33 @@ public class KeyHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("RedundantIfStatement")
|
||||||
private boolean isCommandCountKey(char chKey, @NotNull CommandState editorState) {
|
private boolean isCommandCountKey(char chKey, @NotNull CommandState editorState) {
|
||||||
// Make sure to avoid handling '0' as the start of a count.
|
// Make sure to avoid handling '0' as the start of a count.
|
||||||
final CommandBuilder commandBuilder = editorState.getCommandBuilder();
|
final CommandBuilder commandBuilder = editorState.getCommandBuilder();
|
||||||
return (editorState.getMode() == CommandState.Mode.COMMAND || editorState.getMode() == CommandState.Mode.VISUAL)
|
boolean notRegisterPendingCommand = editorState.getMode() == CommandState.Mode.COMMAND &&
|
||||||
&& commandBuilder.isExpectingCount() && Character.isDigit(chKey) && (commandBuilder.getCount() > 0 || chKey != '0');
|
editorState.getSubMode() != CommandState.SubMode.REGISTER_PENDING;
|
||||||
|
boolean visualMode = editorState.getMode() == CommandState.Mode.VISUAL;
|
||||||
|
boolean opPendingMode = editorState.getMode() == CommandState.Mode.OP_PENDING;
|
||||||
|
if (notRegisterPendingCommand || visualMode || opPendingMode) {
|
||||||
|
if (commandBuilder.isExpectingCount() &&
|
||||||
|
Character.isDigit(chKey) &&
|
||||||
|
(commandBuilder.getCount() > 0 || chKey != '0')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDeleteCommandCountKey(@NotNull KeyStroke key, @NotNull CommandState editorState) {
|
private boolean isDeleteCommandCountKey(@NotNull KeyStroke key, @NotNull CommandState editorState) {
|
||||||
// See `:help N<Del>`
|
// See `:help N<Del>`
|
||||||
final CommandBuilder commandBuilder = editorState.getCommandBuilder();
|
final CommandBuilder commandBuilder = editorState.getCommandBuilder();
|
||||||
return (editorState.getMode() == CommandState.Mode.COMMAND || editorState.getMode() == CommandState.Mode.VISUAL)
|
return (editorState.getMode() == CommandState.Mode.COMMAND ||
|
||||||
&& commandBuilder.isExpectingCount() && commandBuilder.getCount() > 0 && key.getKeyCode() == KeyEvent.VK_DELETE;
|
editorState.getMode() == CommandState.Mode.VISUAL ||
|
||||||
|
editorState.getMode() == CommandState.Mode.OP_PENDING) &&
|
||||||
|
commandBuilder.isExpectingCount() &&
|
||||||
|
commandBuilder.getCount() > 0 &&
|
||||||
|
key.getKeyCode() == KeyEvent.VK_DELETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
|
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
|
||||||
@@ -798,7 +814,7 @@ public class KeyHandler {
|
|||||||
if (editorState.isDotRepeatInProgress() && VimRepeater.Extension.INSTANCE.getArgumentCaptured() != null) {
|
if (editorState.isDotRepeatInProgress() && VimRepeater.Extension.INSTANCE.getArgumentCaptured() != null) {
|
||||||
commandBuilder.completeCommandPart(VimRepeater.Extension.INSTANCE.getArgumentCaptured());
|
commandBuilder.completeCommandPart(VimRepeater.Extension.INSTANCE.getArgumentCaptured());
|
||||||
}
|
}
|
||||||
editorState.pushModes(editorState.getMode(), CommandState.SubMode.OP_PENDING);
|
editorState.pushModes(CommandState.Mode.OP_PENDING, CommandState.SubMode.NONE);
|
||||||
break;
|
break;
|
||||||
case DIGRAPH:
|
case DIGRAPH:
|
||||||
// Command actions represent the completion of a command. Showcmd relies on this - if the action represents a
|
// Command actions represent the completion of a command. Showcmd relies on this - if the action represents a
|
||||||
|
@@ -18,17 +18,14 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim
|
package com.maddyhome.idea.vim
|
||||||
|
|
||||||
import com.intellij.openapi.project.DumbAware
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.startup.StartupActivity
|
import com.intellij.openapi.startup.StartupActivity
|
||||||
import com.maddyhome.idea.vim.listener.VimListenerManager
|
import com.maddyhome.idea.vim.listener.VimListenerManager
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alex Plate
|
* @author Alex Plate
|
||||||
*
|
|
||||||
* [VERSION UPDATE] 193+ Use StartupActivity.DumbAware
|
|
||||||
*/
|
*/
|
||||||
class PluginStartup : StartupActivity, DumbAware {
|
class PluginStartup : StartupActivity.DumbAware {
|
||||||
|
|
||||||
private var firstInitializationOccurred = false
|
private var firstInitializationOccurred = false
|
||||||
|
|
||||||
|
@@ -17,9 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.maddyhome.idea.vim;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
import com.intellij.openapi.extensions.ExtensionPointListener;
|
|
||||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
|
||||||
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.ActionBeanClass;
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||||
@@ -34,33 +32,6 @@ public class RegisterActions {
|
|||||||
|
|
||||||
public static final ExtensionPointName<ActionBeanClass> VIM_ACTIONS_EP =
|
public static final ExtensionPointName<ActionBeanClass> VIM_ACTIONS_EP =
|
||||||
ExtensionPointName.create("IdeaVIM.vimAction");
|
ExtensionPointName.create("IdeaVIM.vimAction");
|
||||||
private static boolean initialRegistration = false;
|
|
||||||
|
|
||||||
static {
|
|
||||||
// IdeaVim doesn't support contribution to VIM_ACTIONS_EP extension point, so technically we can skip this update,
|
|
||||||
// but let's support dynamic plugins in a more classic way and reload actions on every EP change.
|
|
||||||
// TODO: [VERSION UPDATE] since 191 use
|
|
||||||
// ExtensionPoint.addExtensionPointListener(ExtensionPointListener<T>, boolean, Disposable)
|
|
||||||
// TODO: [VERSION UPDATE] since 201 use
|
|
||||||
// ExtensionPoint.addExtensionPointListener(ExtensionPointChangeListener, boolean, Disposable)
|
|
||||||
VIM_ACTIONS_EP.getPoint(null).addExtensionPointListener(new ExtensionPointListener<ActionBeanClass>() {
|
|
||||||
@Override
|
|
||||||
public void extensionAdded(@NotNull ActionBeanClass extension, PluginDescriptor pluginDescriptor) {
|
|
||||||
// Suppress listener before the `VimPlugin.turnOn()` function execution. This logic should be rewritten after
|
|
||||||
// version update (or earlier).
|
|
||||||
if (!initialRegistration) return;
|
|
||||||
unregisterActions();
|
|
||||||
registerActions();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void extensionRemoved(@NotNull ActionBeanClass extension, PluginDescriptor pluginDescriptor) {
|
|
||||||
if (!initialRegistration) return;
|
|
||||||
unregisterActions();
|
|
||||||
registerActions();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register all the key/action mappings for the plugin.
|
* Register all the key/action mappings for the plugin.
|
||||||
@@ -68,7 +39,16 @@ public class RegisterActions {
|
|||||||
public static void registerActions() {
|
public static void registerActions() {
|
||||||
registerVimCommandActions();
|
registerVimCommandActions();
|
||||||
registerEmptyShortcuts();
|
registerEmptyShortcuts();
|
||||||
initialRegistration = true;
|
registerEpListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerEpListener() {
|
||||||
|
// IdeaVim doesn't support contribution to VIM_ACTIONS_EP extension point, so technically we can skip this update,
|
||||||
|
// but let's support dynamic plugins in a more classic way and reload actions on every EP change.
|
||||||
|
VIM_ACTIONS_EP.getPoint(null).addExtensionPointListener(() -> {
|
||||||
|
unregisterActions();
|
||||||
|
registerActions();
|
||||||
|
}, false, VimPlugin.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @Nullable EditorActionHandlerBase findAction(@NotNull String id) {
|
public static @Nullable EditorActionHandlerBase findAction(@NotNull String id) {
|
||||||
|
@@ -19,14 +19,11 @@ package com.maddyhome.idea.vim;
|
|||||||
|
|
||||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||||
import com.intellij.ide.plugins.PluginManager;
|
import com.intellij.ide.plugins.PluginManager;
|
||||||
import com.intellij.ide.util.PropertiesComponent;
|
|
||||||
import com.intellij.notification.Notification;
|
import com.intellij.notification.Notification;
|
||||||
import com.intellij.notification.NotificationListener;
|
import com.intellij.notification.NotificationListener;
|
||||||
import com.intellij.openapi.Disposable;
|
import com.intellij.openapi.Disposable;
|
||||||
import com.intellij.openapi.application.Application;
|
import com.intellij.openapi.application.Application;
|
||||||
import com.intellij.openapi.application.ApplicationInfo;
|
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.application.PermanentInstallationID;
|
|
||||||
import com.intellij.openapi.components.PersistentStateComponent;
|
import com.intellij.openapi.components.PersistentStateComponent;
|
||||||
import com.intellij.openapi.components.ServiceManager;
|
import com.intellij.openapi.components.ServiceManager;
|
||||||
import com.intellij.openapi.components.State;
|
import com.intellij.openapi.components.State;
|
||||||
@@ -40,12 +37,12 @@ import com.intellij.openapi.options.ShowSettingsUtil;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.project.ProjectManager;
|
import com.intellij.openapi.project.ProjectManager;
|
||||||
import com.intellij.openapi.ui.Messages;
|
import com.intellij.openapi.ui.Messages;
|
||||||
import com.intellij.openapi.util.JDOMUtil;
|
|
||||||
import com.intellij.openapi.util.SystemInfo;
|
import com.intellij.openapi.util.SystemInfo;
|
||||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
|
||||||
import com.intellij.openapi.wm.StatusBar;
|
import com.intellij.openapi.wm.StatusBar;
|
||||||
import com.intellij.openapi.wm.WindowManager;
|
import com.intellij.openapi.wm.WindowManager;
|
||||||
import com.intellij.util.io.HttpRequests;
|
import com.maddyhome.idea.vim.config.VimLocalConfig;
|
||||||
|
import com.maddyhome.idea.vim.config.VimState;
|
||||||
|
import com.maddyhome.idea.vim.config.migration.ApplicationConfigurationMigrator;
|
||||||
import com.maddyhome.idea.vim.ex.CommandParser;
|
import com.maddyhome.idea.vim.ex.CommandParser;
|
||||||
import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser;
|
import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser;
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar;
|
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar;
|
||||||
@@ -57,18 +54,18 @@ import com.maddyhome.idea.vim.helper.MacKeyRepeat;
|
|||||||
import com.maddyhome.idea.vim.listener.VimListenerManager;
|
import com.maddyhome.idea.vim.listener.VimListenerManager;
|
||||||
import com.maddyhome.idea.vim.option.OptionsManager;
|
import com.maddyhome.idea.vim.option.OptionsManager;
|
||||||
import com.maddyhome.idea.vim.ui.ExEntryPanel;
|
import com.maddyhome.idea.vim.ui.ExEntryPanel;
|
||||||
|
import com.maddyhome.idea.vim.ui.StatusBarIconFactory;
|
||||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
||||||
|
import com.maddyhome.idea.vim.ui.VimRcFileState;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
import org.jdom.JDOMException;
|
import org.jetbrains.annotations.Nls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.event.HyperlinkEvent;
|
import javax.swing.event.HyperlinkEvent;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.util.List;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static com.maddyhome.idea.vim.group.EditorGroup.EDITOR_STORE_ELEMENT;
|
import static com.maddyhome.idea.vim.group.EditorGroup.EDITOR_STORE_ELEMENT;
|
||||||
import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
|
import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
|
||||||
@@ -84,8 +81,7 @@ import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
|
|||||||
@State(name = "VimSettings", storages = {@Storage("$APP_CONFIG$/vim_settings.xml")})
|
@State(name = "VimSettings", storages = {@Storage("$APP_CONFIG$/vim_settings.xml")})
|
||||||
public class VimPlugin implements PersistentStateComponent<Element>, Disposable {
|
public class VimPlugin implements PersistentStateComponent<Element>, Disposable {
|
||||||
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
|
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
|
||||||
private static final String IDEAVIM_STATISTICS_TIMESTAMP_KEY = "ideavim.statistics.timestamp";
|
public static final int STATE_VERSION = 7;
|
||||||
private static final int STATE_VERSION = 6;
|
|
||||||
|
|
||||||
private static long lastBeepTimeMillis;
|
private static long lastBeepTimeMillis;
|
||||||
|
|
||||||
@@ -102,6 +98,10 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
|
|
||||||
private final @NotNull VimState state = new VimState();
|
private final @NotNull VimState state = new VimState();
|
||||||
|
|
||||||
|
VimPlugin() {
|
||||||
|
ApplicationConfigurationMigrator.getInstance().migrate();
|
||||||
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
LOG.debug("initComponent");
|
LOG.debug("initComponent");
|
||||||
|
|
||||||
@@ -151,53 +151,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
return ServiceManager.getService(MotionGroup.class);
|
return ServiceManager.getService(MotionGroup.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reports statistics about installed IdeaVim and enabled Vim emulation.
|
|
||||||
* <p>
|
|
||||||
* See https://github.com/go-lang-plugin-org/go-lang-idea-plugin/commit/5182ab4a1d01ad37f6786268a2fe5e908575a217
|
|
||||||
*/
|
|
||||||
public static void statisticReport() {
|
|
||||||
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
|
|
||||||
final long lastUpdate = propertiesComponent.getOrInitLong(IDEAVIM_STATISTICS_TIMESTAMP_KEY, 0);
|
|
||||||
final boolean outOfDate = lastUpdate == 0 || System.currentTimeMillis() - lastUpdate > TimeUnit.DAYS.toMillis(1);
|
|
||||||
if (outOfDate && isEnabled()) {
|
|
||||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
|
||||||
try {
|
|
||||||
final String buildNumber = ApplicationInfo.getInstance().getBuild().asString();
|
|
||||||
final String version = URLEncoder.encode(getVersion(), CharsetToolkit.UTF8);
|
|
||||||
final String os = URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, CharsetToolkit.UTF8);
|
|
||||||
final String uid = PermanentInstallationID.get();
|
|
||||||
final String url = "https://plugins.jetbrains.com/plugins/list" +
|
|
||||||
"?pluginId=" +
|
|
||||||
IDEAVIM_PLUGIN_ID +
|
|
||||||
"&build=" +
|
|
||||||
buildNumber +
|
|
||||||
"&pluginVersion=" +
|
|
||||||
version +
|
|
||||||
"&os=" +
|
|
||||||
os +
|
|
||||||
"&uuid=" +
|
|
||||||
uid;
|
|
||||||
PropertiesComponent.getInstance()
|
|
||||||
.setValue(IDEAVIM_STATISTICS_TIMESTAMP_KEY, String.valueOf(System.currentTimeMillis()));
|
|
||||||
HttpRequests.request(url).connect(request -> {
|
|
||||||
LOG.info("Sending statistics: " + url);
|
|
||||||
try {
|
|
||||||
JDOMUtil.load(request.getInputStream());
|
|
||||||
}
|
|
||||||
catch (JDOMException e) {
|
|
||||||
LOG.warn(e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
LOG.warn(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @NotNull ChangeGroup getChange() {
|
public static @NotNull ChangeGroup getChange() {
|
||||||
return ServiceManager.getService(ChangeGroup.class);
|
return ServiceManager.getService(ChangeGroup.class);
|
||||||
}
|
}
|
||||||
@@ -289,10 +242,19 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
ideavimrcRegistered = true;
|
ideavimrcRegistered = true;
|
||||||
|
|
||||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
|
executeIdeaVimRc();
|
||||||
if (ideaVimRc != null) {
|
}
|
||||||
VimScriptParser.executeFile(ideaVimRc);
|
}
|
||||||
}
|
|
||||||
|
public void executeIdeaVimRc() {
|
||||||
|
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
|
||||||
|
if (ideaVimRc != null) {
|
||||||
|
LOG.info("Execute ideavimrc file: " + ideaVimRc.getAbsolutePath());
|
||||||
|
List<String> parsedLines = VimScriptParser.executeFile(ideaVimRc);
|
||||||
|
VimRcFileState.INSTANCE.saveFileState(ideaVimRc.getAbsolutePath(), parsedLines);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG.info("ideavimrc file isn't found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +262,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// [VERSION UPDATE] 193+ remove suppress
|
|
||||||
@SuppressWarnings({"MissingRecentApi", "UnstableApiUsage"})
|
|
||||||
public static @NotNull String getVersion() {
|
public static @NotNull String getVersion() {
|
||||||
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
|
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
|
||||||
if (!ApplicationManager.getApplication().isInternal()) {
|
if (!ApplicationManager.getApplication().isInternal()) {
|
||||||
@@ -329,7 +289,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
getInstance().turnOnPlugin();
|
getInstance().turnOnPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
VimStatusBar.INSTANCE.update();
|
StatusBarIconFactory.Companion.updateIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isError() {
|
public static boolean isError() {
|
||||||
@@ -367,7 +327,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
showMessage(msg);
|
showMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showMessage(@Nullable String msg) {
|
public static void showMessage(@Nls @Nullable String msg) {
|
||||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
getInstance().message = msg;
|
getInstance().message = msg;
|
||||||
}
|
}
|
||||||
@@ -406,7 +366,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
registerIdeavimrc();
|
registerIdeavimrc();
|
||||||
|
|
||||||
// Turing on should be performed after all commands registration
|
// Turing on should be performed after all commands registration
|
||||||
getEditor().turnOn();
|
|
||||||
getSearch().turnOn();
|
getSearch().turnOn();
|
||||||
VimListenerManager.INSTANCE.turnOn();
|
VimListenerManager.INSTANCE.turnOn();
|
||||||
}
|
}
|
||||||
@@ -414,10 +373,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
private void turnOffPlugin() {
|
private void turnOffPlugin() {
|
||||||
KeyHandler.getInstance().fullReset(null);
|
KeyHandler.getInstance().fullReset(null);
|
||||||
|
|
||||||
EditorGroup editorGroup = getEditorIfCreated();
|
|
||||||
if (editorGroup != null) {
|
|
||||||
editorGroup.turnOff();
|
|
||||||
}
|
|
||||||
SearchGroup searchGroup = getSearchIfCreated();
|
SearchGroup searchGroup = getSearchIfCreated();
|
||||||
if (searchGroup != null) {
|
if (searchGroup != null) {
|
||||||
searchGroup.turnOff();
|
searchGroup.turnOff();
|
||||||
|
39
src/com/maddyhome/idea/vim/VimProjectService.kt
Normal file
39
src/com/maddyhome/idea/vim/VimProjectService.kt
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2020 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
|
||||||
|
|
||||||
|
import com.intellij.openapi.Disposable
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
|
import com.intellij.openapi.components.ServiceManager
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
|
|
||||||
|
@Service
|
||||||
|
class VimProjectService(val project: Project) : Disposable {
|
||||||
|
override fun dispose() {}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun getInstance(project: Project): VimProjectService {
|
||||||
|
return ServiceManager.getService(project, VimProjectService::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val Project.vimDisposable
|
||||||
|
get() = VimProjectService.getInstance(this)
|
@@ -24,6 +24,7 @@ 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.helper.isIdeaVimDisabledHere
|
||||||
import java.awt.event.KeyAdapter
|
import java.awt.event.KeyAdapter
|
||||||
import java.awt.event.KeyEvent
|
import java.awt.event.KeyEvent
|
||||||
import javax.swing.KeyStroke
|
import javax.swing.KeyStroke
|
||||||
@@ -41,12 +42,22 @@ class VimTypedActionHandler(origHandler: TypedActionHandler?) : TypedActionHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun beforeExecute(editor: Editor, charTyped: Char, context: DataContext, plan: ActionPlan) {
|
override fun beforeExecute(editor: Editor, charTyped: Char, context: DataContext, plan: ActionPlan) {
|
||||||
|
if (editor.isIdeaVimDisabledHere) {
|
||||||
|
(handler.originalHandler as? TypedActionHandlerEx)?.beforeExecute(editor, charTyped, context, plan)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
|
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
|
||||||
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
|
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
|
||||||
handler.beforeHandleKey(editor, keyStroke, context, plan)
|
handler.beforeHandleKey(editor, keyStroke, context, plan)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun execute(editor: Editor, charTyped: Char, context: DataContext) {
|
override fun execute(editor: Editor, charTyped: Char, context: DataContext) {
|
||||||
|
if (editor.isIdeaVimDisabledHere) {
|
||||||
|
handler.originalHandler.execute(editor, charTyped, context)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
|
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
|
||||||
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
|
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
|
||||||
@@ -71,4 +82,4 @@ object VimKeyListener : KeyAdapter() {
|
|||||||
override fun keyPressed(e: KeyEvent) {
|
override fun keyPressed(e: KeyEvent) {
|
||||||
isSpaceShift = e.modifiersEx and KeyEvent.SHIFT_DOWN_MASK != 0 && e.keyChar == ' '
|
isSpaceShift = e.modifiersEx and KeyEvent.SHIFT_DOWN_MASK != 0 && e.keyChar == ' '
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.handler.VimActionHandler
|
|||||||
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
||||||
|
|
||||||
class ResetModeAction : VimActionHandler.SingleExecution() {
|
class ResetModeAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.RESET
|
override val type: Command.Type = Command.Type.OTHER_WRITABLE
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.getInstance().fullReset(editor.getTopLevelEditor())
|
KeyHandler.getInstance().fullReset(editor.getTopLevelEditor())
|
||||||
|
@@ -20,8 +20,8 @@ package com.maddyhome.idea.vim.action
|
|||||||
|
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||||
import com.maddyhome.idea.vim.VimActions
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.ui.VimActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
|
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
|
||||||
|
@@ -26,8 +26,6 @@ import com.intellij.openapi.actionSystem.EmptyAction
|
|||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
import com.intellij.openapi.diagnostic.Logger
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
import com.intellij.openapi.editor.Editor
|
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.progress.ProcessCanceledException
|
||||||
import com.intellij.openapi.project.DumbAware
|
import com.intellij.openapi.project.DumbAware
|
||||||
import com.intellij.openapi.util.Key
|
import com.intellij.openapi.util.Key
|
||||||
@@ -39,6 +37,8 @@ import com.maddyhome.idea.vim.helper.EditorHelper
|
|||||||
import com.maddyhome.idea.vim.helper.StringHelper
|
import com.maddyhome.idea.vim.helper.StringHelper
|
||||||
import com.maddyhome.idea.vim.helper.inInsertMode
|
import com.maddyhome.idea.vim.helper.inInsertMode
|
||||||
import com.maddyhome.idea.vim.helper.inNormalMode
|
import com.maddyhome.idea.vim.helper.inNormalMode
|
||||||
|
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
|
||||||
|
import com.maddyhome.idea.vim.helper.isPrimaryEditor
|
||||||
import com.maddyhome.idea.vim.key.ShortcutOwner
|
import com.maddyhome.idea.vim.key.ShortcutOwner
|
||||||
import com.maddyhome.idea.vim.listener.IdeaSpecifics.aceJumpActive
|
import com.maddyhome.idea.vim.listener.IdeaSpecifics.aceJumpActive
|
||||||
import com.maddyhome.idea.vim.option.OptionsManager
|
import com.maddyhome.idea.vim.option.OptionsManager
|
||||||
@@ -82,6 +82,7 @@ class VimShortcutKeyAction : AnAction(), DumbAware {
|
|||||||
val editor = getEditor(e)
|
val editor = getEditor(e)
|
||||||
val keyStroke = getKeyStroke(e)
|
val keyStroke = getKeyStroke(e)
|
||||||
if (editor != null && keyStroke != null) {
|
if (editor != null && keyStroke != null) {
|
||||||
|
if (editor.isIdeaVimDisabledHere) return false
|
||||||
// Workaround for smart step into
|
// Workaround for smart step into
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
val SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA")
|
val SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA")
|
||||||
@@ -122,16 +123,9 @@ class VimShortcutKeyAction : AnAction(), DumbAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isEnabledForEscape(editor: Editor): Boolean {
|
private fun isEnabledForEscape(editor: Editor): Boolean {
|
||||||
return isPrimaryEditor(editor) || EditorHelper.isFileEditor(editor) && !editor.inNormalMode
|
return editor.isPrimaryEditor()
|
||||||
}
|
|| EditorHelper.isFileEditor(editor) && !editor.inNormalMode
|
||||||
|
|| OptionsManager.dialogescape.value == "on" && !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 isShortcutConflict(keyStroke: KeyStroke): Boolean {
|
private fun isShortcutConflict(keyStroke: KeyStroke): Boolean {
|
||||||
|
@@ -45,14 +45,17 @@ class OperatorAction : VimActionHandler.SingleExecution() {
|
|||||||
if (!editor.commandState.isDotRepeatInProgress) {
|
if (!editor.commandState.isDotRepeatInProgress) {
|
||||||
VimRepeater.Extension.argumentCaptured = argument
|
VimRepeater.Extension.argumentCaptured = argument
|
||||||
}
|
}
|
||||||
|
val saveRepeatHandler = VimRepeater.repeatHandler
|
||||||
val motion = argument.motion
|
val motion = argument.motion
|
||||||
val range = MotionGroup
|
val range = MotionGroup
|
||||||
.getMotionRange(editor, editor.caretModel.primaryCaret, context, cmd.count, cmd.rawCount, argument)
|
.getMotionRange(editor, editor.caretModel.primaryCaret, context, cmd.count, cmd.rawCount, argument)
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
VimPlugin.getMark().setChangeMarks(editor, range)
|
VimPlugin.getMark().setChangeMarks(editor, range)
|
||||||
val selectionType = SelectionType.fromCommandFlags(motion.flags)
|
val selectionType = if (motion.isLinewiseMotion()) SelectionType.LINE_WISE else SelectionType.CHARACTER_WISE
|
||||||
KeyHandler.getInstance().reset(editor)
|
KeyHandler.getInstance().reset(editor)
|
||||||
return operatorFunction.apply(editor, context, selectionType)
|
val result = operatorFunction.apply(editor, context, selectionType)
|
||||||
|
VimRepeater.repeatHandler = saveRepeatHandler
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@@ -64,7 +64,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
|||||||
}
|
}
|
||||||
state.setExecutingCommand(lastCommand)
|
state.setExecutingCommand(lastCommand)
|
||||||
|
|
||||||
KeyHandler.executeVimAction(editor, lastCommand.action!!, context)
|
KeyHandler.executeVimAction(editor, lastCommand.action, context)
|
||||||
|
|
||||||
VimRepeater.saveLastChange(lastCommand)
|
VimRepeater.saveLastChange(lastCommand)
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.action.motion.updown.MotionDownLess1FirstNonSpaceAction
|
||||||
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.CommandFlags
|
||||||
@@ -39,6 +40,9 @@ class ChangeLineAction : ChangeEditorActionHandler.ForEachCaret() {
|
|||||||
count: Int,
|
count: Int,
|
||||||
rawCount: Int,
|
rawCount: Int,
|
||||||
argument: Argument?): Boolean {
|
argument: Argument?): Boolean {
|
||||||
return VimPlugin.getChange().changeLine(editor, caret, count, context)
|
// `S` command is a synonym of `cc`
|
||||||
|
val motion = MotionDownLess1FirstNonSpaceAction()
|
||||||
|
val command = Command(1, motion, motion.type, motion.flags)
|
||||||
|
return VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, Argument(command))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,15 +25,13 @@ 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.handler.ChangeEditorActionHandler
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
|
||||||
class ChangeNumberIncAction : ChangeEditorActionHandler.ForEachCaret() {
|
sealed class IncAction(val inc: Int) : ChangeEditorActionHandler.ForEachCaret() {
|
||||||
override val type: Command.Type = Command.Type.CHANGE
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
override fun execute(editor: Editor,
|
override fun execute(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Boolean {
|
||||||
caret: Caret,
|
return VimPlugin.getChange().changeNumber(editor, caret, inc * count)
|
||||||
context: DataContext,
|
|
||||||
count: Int,
|
|
||||||
rawCount: Int,
|
|
||||||
argument: Argument?): Boolean {
|
|
||||||
return VimPlugin.getChange().changeNumber(editor, caret, count)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ChangeNumberIncAction : IncAction(1)
|
||||||
|
class ChangeNumberDecAction : IncAction(-1)
|
||||||
|
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
|
||||||
* Copyright (C) 2003-2020 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,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
|
||||||
* Copyright (C) 2003-2020 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,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
|
||||||
* Copyright (C) 2003-2020 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)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -28,17 +28,16 @@ import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
|||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class ChangeVisualNumberIncAction : VisualOperatorActionHandler.ForEachCaret() {
|
sealed class IncNumber(val inc: Int, val avalanche: Boolean) : VisualOperatorActionHandler.ForEachCaret() {
|
||||||
override val type: Command.Type = Command.Type.CHANGE
|
override val type: Command.Type = Command.Type.CHANGE
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
|
||||||
|
|
||||||
override fun executeAction(editor: Editor,
|
override fun executeAction(editor: Editor, caret: Caret, context: DataContext, cmd: Command, range: VimSelection): Boolean {
|
||||||
caret: Caret,
|
return VimPlugin.getChange().changeNumberVisualMode(editor, caret, range.toVimTextRange(false), inc * cmd.count, avalanche)
|
||||||
context: DataContext,
|
|
||||||
cmd: Command,
|
|
||||||
range: VimSelection): Boolean {
|
|
||||||
return VimPlugin.getChange()
|
|
||||||
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ChangeVisualNumberIncAction : IncNumber(1, false)
|
||||||
|
class ChangeVisualNumberDecAction : IncNumber(-1, false)
|
||||||
|
class ChangeVisualNumberAvalancheIncAction : IncNumber(1, true)
|
||||||
|
class ChangeVisualNumberAvalancheDecAction : IncNumber(-1, true)
|
||||||
|
@@ -25,6 +25,7 @@ import com.maddyhome.idea.vim.command.Command
|
|||||||
import com.maddyhome.idea.vim.group.copy.PutData
|
import com.maddyhome.idea.vim.group.copy.PutData
|
||||||
import com.maddyhome.idea.vim.group.copy.PutData.TextData
|
import com.maddyhome.idea.vim.group.copy.PutData.TextData
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.StringHelper
|
||||||
|
|
||||||
sealed class PutTextBaseAction(
|
sealed class PutTextBaseAction(
|
||||||
private val insertTextBeforeCaret: Boolean,
|
private val insertTextBeforeCaret: Boolean,
|
||||||
@@ -35,7 +36,7 @@ sealed class PutTextBaseAction(
|
|||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Boolean {
|
override fun execute(editor: Editor, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Boolean {
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val lastRegister = VimPlugin.getRegister().lastRegister
|
||||||
val textData = if (lastRegister != null) TextData(lastRegister.text, lastRegister.type, lastRegister.transferableData) else null
|
val textData = if (lastRegister != null) TextData(lastRegister.text ?: StringHelper.toKeyNotation(lastRegister.keys), lastRegister.type, lastRegister.transferableData) else null
|
||||||
val putData = PutData(textData, null, count, insertTextBeforeCaret, indent, caretAfterInsertedText, -1)
|
val putData = PutData(textData, null, count, insertTextBeforeCaret, indent, caretAfterInsertedText, -1)
|
||||||
return VimPlugin.getPut().putText(editor, context, putData)
|
return VimPlugin.getPut().putText(editor, context, putData)
|
||||||
}
|
}
|
||||||
|
@@ -19,73 +19,72 @@
|
|||||||
package com.maddyhome.idea.vim.action.fold
|
package com.maddyhome.idea.vim.action.fold
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_ALL_REGIONS
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_REGION
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_REGION_RECURSIVELY
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_ALL_REGIONS
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_REGION
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_REGION_RECURSIVELY
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
|
||||||
class VimCollapseAllRegions : VimActionHandler.SingleExecution() {
|
class VimCollapseAllRegions : VimActionHandler.SingleExecution() {
|
||||||
val actionName: String = "CollapseAllRegions"
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.executeAction(actionName, context)
|
KeyHandler.executeAction(ACTION_COLLAPSE_ALL_REGIONS, context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VimCollapseRegion : VimActionHandler.SingleExecution() {
|
class VimCollapseRegion : VimActionHandler.SingleExecution() {
|
||||||
private val actionName: String = "CollapseRegion"
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.executeAction(actionName, context)
|
KeyHandler.executeAction(ACTION_COLLAPSE_REGION, context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VimCollapseRegionRecursively : VimActionHandler.SingleExecution() {
|
class VimCollapseRegionRecursively : VimActionHandler.SingleExecution() {
|
||||||
private val actionName: String = "CollapseRegionRecursively"
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.executeAction(actionName, context)
|
KeyHandler.executeAction(ACTION_COLLAPSE_REGION_RECURSIVELY, context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VimExpandAllRegions : VimActionHandler.SingleExecution() {
|
class VimExpandAllRegions : VimActionHandler.SingleExecution() {
|
||||||
private val actionName: String = "ExpandAllRegions"
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.executeAction(actionName, context)
|
KeyHandler.executeAction(ACTION_EXPAND_ALL_REGIONS, context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VimExpandRegion : VimActionHandler.SingleExecution() {
|
class VimExpandRegion : VimActionHandler.SingleExecution() {
|
||||||
private val actionName: String = "ExpandRegion"
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.executeAction(actionName, context)
|
KeyHandler.executeAction(ACTION_EXPAND_REGION, context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VimExpandRegionRecursively : VimActionHandler.SingleExecution() {
|
class VimExpandRegionRecursively : VimActionHandler.SingleExecution() {
|
||||||
private val actionName: String = "ExpandRegionRecursively"
|
|
||||||
|
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
KeyHandler.executeAction(actionName, context)
|
KeyHandler.executeAction(ACTION_EXPAND_REGION_RECURSIVELY, context)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,8 +39,9 @@ import java.awt.RenderingHints
|
|||||||
import java.awt.font.FontRenderContext
|
import java.awt.font.FontRenderContext
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.swing.UIManager
|
import javax.swing.UIManager
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
class AddInlaysAction : AnAction() {
|
class AddBlockInlaysAction : AnAction() {
|
||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val dataContext = e.dataContext
|
val dataContext = e.dataContext
|
||||||
val editor = getEditor(dataContext) ?: return
|
val editor = getEditor(dataContext) ?: return
|
||||||
@@ -94,7 +95,7 @@ class AddInlaysAction : AnAction() {
|
|||||||
|
|
||||||
private fun getFontMetrics(editor: Editor): MyFontMetrics {
|
private fun getFontMetrics(editor: Editor): MyFontMetrics {
|
||||||
val familyName = UIManager.getFont("Label.font").family
|
val familyName = UIManager.getFont("Label.font").family
|
||||||
val size = (Math.max(1, editor.colorsScheme.editorFontSize - 1) * factor).toInt()
|
val size = (max(1, editor.colorsScheme.editorFontSize - 1) * factor).toInt()
|
||||||
var metrics = editor.getUserData(HINT_FONT_METRICS)
|
var metrics = editor.getUserData(HINT_FONT_METRICS)
|
||||||
if (metrics != null && !metrics.isActual(editor, familyName, size)) {
|
if (metrics != null && !metrics.isActual(editor, familyName, size)) {
|
||||||
metrics = null
|
metrics = null
|
||||||
@@ -110,7 +111,7 @@ class AddInlaysAction : AnAction() {
|
|||||||
return if (text == null) 0 else fontMetrics.stringWidth(text)
|
return if (text == null) 0 else fontMetrics.stringWidth(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class MyFontMetrics internal constructor(editor: Editor, familyName: String?, size: Int) {
|
private inner class MyFontMetrics(editor: Editor, familyName: String?, size: Int) {
|
||||||
val metrics: FontMetrics
|
val metrics: FontMetrics
|
||||||
fun isActual(editor: Editor, familyName: String, size: Int): Boolean {
|
fun isActual(editor: Editor, familyName: String, size: Int): Boolean {
|
||||||
val font = metrics.font
|
val font = metrics.font
|
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2020 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.internal
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.daemon.impl.HintRenderer
|
||||||
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.intellij.openapi.editor.VisualPosition
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
|
class AddInlineInlaysAction : AnAction() {
|
||||||
|
companion object {
|
||||||
|
private val random = Random()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
|
val dataContext = e.dataContext
|
||||||
|
val editor = getEditor(dataContext) ?: return
|
||||||
|
val inlayModel = editor.inlayModel
|
||||||
|
val currentVisualLine = editor.caretModel.primaryCaret.visualPosition.line
|
||||||
|
var i = random.nextInt(10)
|
||||||
|
val lineLength = EditorHelper.getLineLength(editor, EditorHelper.visualLineToLogicalLine(editor, currentVisualLine))
|
||||||
|
while (i < lineLength) {
|
||||||
|
val relatesToPrecedingText = random.nextInt(10) > 7
|
||||||
|
val text = "a".repeat(max(1, random.nextInt(7)))
|
||||||
|
val offset = EditorHelper.visualPositionToOffset(editor, VisualPosition(currentVisualLine, i))
|
||||||
|
// We don't need a custom renderer, just use the standard parameter hint renderer
|
||||||
|
inlayModel.addInlineElement(offset, relatesToPrecedingText, HintRenderer(if (relatesToPrecedingText) ":$text" else "$text:"))
|
||||||
|
// Every 20 chars +/- 5 chars
|
||||||
|
i += 20 + (random.nextInt(10) - 5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getEditor(dataContext: DataContext): Editor? {
|
||||||
|
return CommonDataKeys.EDITOR.getData(dataContext)
|
||||||
|
}
|
||||||
|
}
|
@@ -23,12 +23,9 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
|
||||||
import java.util.*
|
|
||||||
import javax.swing.KeyStroke
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alex Plate
|
* @author Alex Plate
|
||||||
@@ -36,7 +33,7 @@ import javax.swing.KeyStroke
|
|||||||
|
|
||||||
class GnNextTextObject : TextObjectActionHandler() {
|
class GnNextTextObject : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
if (caret != editor.caretModel.primaryCaret) return null
|
if (caret != editor.caretModel.primaryCaret) return null
|
||||||
|
@@ -23,11 +23,9 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alex Plate
|
* @author Alex Plate
|
||||||
@@ -35,7 +33,8 @@ import java.util.*
|
|||||||
|
|
||||||
class GnPreviousTextObject : TextObjectActionHandler() {
|
class GnPreviousTextObject : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
if (caret != editor.caretModel.primaryCaret) return null
|
if (caret != editor.caretModel.primaryCaret) return null
|
||||||
val range = VimPlugin.getSearch().getNextSearchRange(editor, count, false)
|
val range = VimPlugin.getSearch().getNextSearchRange(editor, count, false)
|
||||||
|
@@ -36,7 +36,7 @@ class MotionArrowLeftAction : NonShiftedSpecialKeyHandler(), ComplicatedKeysActi
|
|||||||
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(parseKeys("<Left>"), listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0)))
|
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(parseKeys("<Left>"), listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0)))
|
||||||
|
|
||||||
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
|
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
|
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,8 @@ import com.maddyhome.idea.vim.command.Argument
|
|||||||
import com.maddyhome.idea.vim.command.MotionType
|
import com.maddyhome.idea.vim.command.MotionType
|
||||||
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
|
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
|
||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
|
import com.maddyhome.idea.vim.helper.commandState
|
||||||
|
import com.maddyhome.idea.vim.helper.isEndAllowed
|
||||||
import java.awt.event.KeyEvent
|
import java.awt.event.KeyEvent
|
||||||
import javax.swing.KeyStroke
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
@@ -39,7 +41,8 @@ class MotionArrowRightAction : NonShiftedSpecialKeyHandler(), ComplicatedKeysAct
|
|||||||
)
|
)
|
||||||
|
|
||||||
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
|
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, false)
|
val allowPastEnd = editor.commandState.mode.isEndAllowed
|
||||||
|
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, allowPastEnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ class MotionLeftAction : MotionActionHandler.ForEachCaret() {
|
|||||||
count: Int,
|
count: Int,
|
||||||
rawCount: Int,
|
rawCount: Int,
|
||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
|
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +56,6 @@ class MotionLeftInsertModeAction : MotionActionHandler.ForEachCaret(), Complicat
|
|||||||
count: Int,
|
count: Int,
|
||||||
rawCount: Int,
|
rawCount: Int,
|
||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
|
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ class MotionRightAction : MotionActionHandler.ForEachCaret() {
|
|||||||
count: Int,
|
count: Int,
|
||||||
rawCount: Int,
|
rawCount: Int,
|
||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, true)
|
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +56,6 @@ class MotionRightInsertAction : MotionActionHandler.ForEachCaret(), ComplicatedK
|
|||||||
count: Int,
|
count: Int,
|
||||||
rawCount: Int,
|
rawCount: Int,
|
||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, true)
|
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class MotionShiftLeftAction : ShiftedArrowKeyHandler() {
|
|||||||
|
|
||||||
override fun motionWithKeyModel(editor: Editor, context: DataContext, cmd: Command) {
|
override fun motionWithKeyModel(editor: Editor, context: DataContext, cmd: Command) {
|
||||||
editor.vimForEachCaret { caret ->
|
editor.vimForEachCaret { caret ->
|
||||||
val vertical = VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -cmd.count, true)
|
val vertical = VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -cmd.count, true)
|
||||||
MotionGroup.moveCaret(editor, caret, vertical)
|
MotionGroup.moveCaret(editor, caret, vertical)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class MotionShiftRightAction : ShiftedArrowKeyHandler() {
|
|||||||
|
|
||||||
override fun motionWithKeyModel(editor: Editor, context: DataContext, cmd: Command) {
|
override fun motionWithKeyModel(editor: Editor, context: DataContext, cmd: Command) {
|
||||||
editor.vimForEachCaret { caret ->
|
editor.vimForEachCaret { caret ->
|
||||||
val vertical = VimPlugin.getMotion().moveCaretHorizontal(editor, caret, cmd.count, true)
|
val vertical = VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, cmd.count, true)
|
||||||
MotionGroup.moveCaret(editor, caret, vertical)
|
MotionGroup.moveCaret(editor, caret, vertical)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,11 +29,11 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MotionGotoFileMarkLineAction : MotionActionHandler.ForEachCaret() {
|
class MotionGotoFileMarkLineAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
|
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
@@ -49,12 +49,10 @@ class MotionGotoFileMarkLineAction : MotionActionHandler.ForEachCaret() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MotionGotoFileMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
class MotionGotoFileMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE)
|
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
context: DataContext,
|
context: DataContext,
|
||||||
|
@@ -29,11 +29,11 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MotionGotoMarkLineAction : MotionActionHandler.ForEachCaret() {
|
class MotionGotoMarkLineAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
|
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
@@ -49,12 +49,10 @@ class MotionGotoMarkLineAction : MotionActionHandler.ForEachCaret() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MotionGotoMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
class MotionGotoMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE)
|
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
context: DataContext,
|
context: DataContext,
|
||||||
|
@@ -23,15 +23,13 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class MotionInnerBigWordAction : TextObjectActionHandler() {
|
class MotionInnerBigWordAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor,
|
override fun getRange(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockAngleAction : TextObjectActionHandler() {
|
class MotionInnerBlockAngleAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor,
|
override fun getRange(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockBackQuoteAction : TextObjectActionHandler() {
|
class MotionInnerBlockBackQuoteAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor,
|
override fun getRange(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockBraceAction : TextObjectActionHandler() {
|
class MotionInnerBlockBraceAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor,
|
override fun getRange(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockBracketAction : TextObjectActionHandler() {
|
class MotionInnerBlockBracketAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor,
|
override fun getRange(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockDoubleQuoteAction : TextObjectActionHandler() {
|
class MotionInnerBlockDoubleQuoteAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor,
|
override fun getRange(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockParenAction : TextObjectActionHandler() {
|
class MotionInnerBlockParenAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockRange(editor, caret, count, false, '(')
|
return VimPlugin.getMotion().getBlockRange(editor, caret, count, false, '(')
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockSingleQuoteAction : TextObjectActionHandler() {
|
class MotionInnerBlockSingleQuoteAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '\'', false)
|
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '\'', false)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerBlockTagAction : TextObjectActionHandler() {
|
class MotionInnerBlockTagAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockTagRange(editor, caret, count, false)
|
return VimPlugin.getMotion().getBlockTagRange(editor, caret, count, false)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionInnerParagraphAction : TextObjectActionHandler() {
|
class MotionInnerParagraphAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.LINE_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getParagraphRange(editor, caret, count, false)
|
return VimPlugin.getMotion().getParagraphRange(editor, caret, count, false)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -34,6 +35,8 @@ class MotionInnerSentenceAction : TextObjectActionHandler() {
|
|||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getSentenceRange(editor, caret, count, false)
|
return VimPlugin.getMotion().getSentenceRange(editor, caret, count, false)
|
||||||
}
|
}
|
||||||
|
@@ -23,15 +23,13 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class MotionInnerWordAction : TextObjectActionHandler() {
|
class MotionInnerWordAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getWordRange(editor, caret, count, false, false)
|
return VimPlugin.getMotion().getWordRange(editor, caret, count, false, false)
|
||||||
|
@@ -23,16 +23,14 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
|
|
||||||
class MotionOuterBigWordAction : TextObjectActionHandler() {
|
class MotionOuterBigWordAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getWordRange(editor, caret, count, true, true)
|
return VimPlugin.getMotion().getWordRange(editor, caret, count, true, true)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockAngleAction : TextObjectActionHandler() {
|
class MotionOuterBlockAngleAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '<')
|
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '<')
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockBackQuoteAction : TextObjectActionHandler() {
|
class MotionOuterBlockBackQuoteAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '`', true)
|
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '`', true)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockBraceAction : TextObjectActionHandler() {
|
class MotionOuterBlockBraceAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '{')
|
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '{')
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockBracketAction : TextObjectActionHandler() {
|
class MotionOuterBlockBracketAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '[')
|
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '[')
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockDoubleQuoteAction : TextObjectActionHandler() {
|
class MotionOuterBlockDoubleQuoteAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '"', true)
|
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '"', true)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockParenAction : TextObjectActionHandler() {
|
class MotionOuterBlockParenAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '(')
|
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '(')
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockSingleQuoteAction : TextObjectActionHandler() {
|
class MotionOuterBlockSingleQuoteAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '\'', true)
|
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '\'', true)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -31,7 +32,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterBlockTagAction : TextObjectActionHandler() {
|
class MotionOuterBlockTagAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getBlockTagRange(editor, caret, count, true)
|
return VimPlugin.getMotion().getBlockTagRange(editor, caret, count, true)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -32,7 +33,9 @@ import java.util.*
|
|||||||
|
|
||||||
class MotionOuterParagraphAction : TextObjectActionHandler() {
|
class MotionOuterParagraphAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.LINE_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getParagraphRange(editor, caret, count, true)
|
return VimPlugin.getMotion().getParagraphRange(editor, caret, count, true)
|
||||||
|
@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
@@ -34,6 +35,8 @@ class MotionOuterSentenceAction : TextObjectActionHandler() {
|
|||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
|
||||||
|
|
||||||
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getSentenceRange(editor, caret, count, true)
|
return VimPlugin.getMotion().getSentenceRange(editor, caret, count, true)
|
||||||
}
|
}
|
||||||
|
@@ -23,16 +23,14 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
|
|
||||||
class MotionOuterWordAction : TextObjectActionHandler() {
|
class MotionOuterWordAction : TextObjectActionHandler() {
|
||||||
|
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
|
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
|
||||||
|
|
||||||
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
|
||||||
return VimPlugin.getMotion().getWordRange(editor, caret, count, true, false)
|
return VimPlugin.getMotion().getWordRange(editor, caret, count, true, false)
|
||||||
|
@@ -29,7 +29,9 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MotionFirstScreenLineAction : MotionActionHandler.ForEachCaret() {
|
class MotionFirstScreenLineAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||||
|
|
||||||
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
@@ -39,6 +41,4 @@ class MotionFirstScreenLineAction : MotionActionHandler.ForEachCaret() {
|
|||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretToFirstScreenLine(editor, count)
|
return VimPlugin.getMotion().moveCaretToFirstScreenLine(editor, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,9 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MotionLastScreenLineAction : MotionActionHandler.ForEachCaret() {
|
class MotionLastScreenLineAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||||
|
|
||||||
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
@@ -39,6 +41,4 @@ class MotionLastScreenLineAction : MotionActionHandler.ForEachCaret() {
|
|||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretToLastScreenLine(editor, count)
|
return VimPlugin.getMotion().moveCaretToLastScreenLine(editor, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,9 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MotionMiddleScreenLineAction : MotionActionHandler.ForEachCaret() {
|
class MotionMiddleScreenLineAction : MotionActionHandler.ForEachCaret() {
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||||
|
|
||||||
|
override val motionType: MotionType = MotionType.LINE_WISE
|
||||||
|
|
||||||
override fun getOffset(editor: Editor,
|
override fun getOffset(editor: Editor,
|
||||||
caret: Caret,
|
caret: Caret,
|
||||||
@@ -39,6 +41,4 @@ class MotionMiddleScreenLineAction : MotionActionHandler.ForEachCaret() {
|
|||||||
argument: Argument?): Int {
|
argument: Argument?): Int {
|
||||||
return VimPlugin.getMotion().moveCaretToMiddleScreenLine(editor)
|
return VimPlugin.getMotion().moveCaretToMiddleScreenLine(editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,6 @@ class MotionScrollColumnLeftAction : VimActionHandler.SingleExecution() {
|
|||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollColumn(editor, cmd.count)
|
return VimPlugin.getMotion().scrollColumns(editor, cmd.count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,6 +31,6 @@ class MotionScrollColumnRightAction : VimActionHandler.SingleExecution() {
|
|||||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
|
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollColumn(editor, -cmd.count)
|
return VimPlugin.getMotion().scrollColumns(editor, -cmd.count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,6 @@ class MotionScrollFirstScreenColumnAction : VimActionHandler.SingleExecution() {
|
|||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollColumnToFirstScreenColumn(editor)
|
return VimPlugin.getMotion().scrollCaretColumnToFirstScreenColumn(editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollFirstScreenLineAction : VimActionHandler.SingleExecution() {
|
class MotionScrollFirstScreenLineAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, cmd.rawCount, false)
|
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, cmd.rawCount, false)
|
||||||
}
|
}
|
||||||
|
@@ -21,18 +21,24 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollFirstScreenLinePageStartAction : VimActionHandler.SingleExecution() {
|
class MotionScrollFirstScreenLinePageStartAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
var line = cmd.rawCount
|
var rawCount = cmd.rawCount
|
||||||
if (line == 0) {
|
if (rawCount == 0) {
|
||||||
val nextVisualLine = EditorHelper.getVisualLineAtBottomOfScreen(editor) + 1
|
val nextVisualLine = EditorHelper.normalizeVisualLine(editor,
|
||||||
line = EditorHelper.visualLineToLogicalLine(editor, nextVisualLine) + 1 // rawCount is 1 based
|
EditorHelper.getVisualLineAtBottomOfScreen(editor) + 1)
|
||||||
|
rawCount = EditorHelper.visualLineToLogicalLine(editor, nextVisualLine) + 1 // rawCount is 1 based
|
||||||
}
|
}
|
||||||
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, line, true)
|
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, rawCount, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollFirstScreenLineStartAction : VimActionHandler.SingleExecution() {
|
class MotionScrollFirstScreenLineStartAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, cmd.rawCount, true)
|
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, cmd.rawCount, true)
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollHalfPageDownAction : VimActionHandler.SingleExecution() {
|
class MotionScrollHalfPageDownAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollScreen(editor, cmd.rawCount, true)
|
return VimPlugin.getMotion().scrollScreen(editor, cmd.rawCount, true)
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2020 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.motion.scroll
|
||||||
|
|
||||||
|
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.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
For the following four commands the cursor follows the screen. If the
|
||||||
|
character that the cursor is on is moved off the screen, the cursor is moved
|
||||||
|
to the closest character that is on the screen. The value of 'sidescroll' is
|
||||||
|
not used.
|
||||||
|
|
||||||
|
*zH*
|
||||||
|
zH Move the view on the text half a screenwidth to the
|
||||||
|
left, thus scroll the text half a screenwidth to the
|
||||||
|
right. This only works when 'wrap' is off.
|
||||||
|
|
||||||
|
[count] is used but undocumented.
|
||||||
|
*/
|
||||||
|
class MotionScrollHalfWidthLeftAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
// Vim's screen width is the full screen width, including columns used for gutters.
|
||||||
|
return VimPlugin.getMotion().scrollColumns(editor, cmd.count * (EditorHelper.getApproximateScreenWidth(editor) / 2));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2020 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.motion.scroll
|
||||||
|
|
||||||
|
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.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
For the following four commands the cursor follows the screen. If the
|
||||||
|
character that the cursor is on is moved off the screen, the cursor is moved
|
||||||
|
to the closest character that is on the screen. The value of 'sidescroll' is
|
||||||
|
not used.
|
||||||
|
|
||||||
|
*zH*
|
||||||
|
zH Move the view on the text half a screenwidth to the
|
||||||
|
left, thus scroll the text half a screenwidth to the
|
||||||
|
right. This only works when 'wrap' is off.
|
||||||
|
|
||||||
|
[count] is used but undocumented.
|
||||||
|
*/
|
||||||
|
class MotionScrollHalfWidthRightAction : VimActionHandler.SingleExecution() {
|
||||||
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
|
||||||
|
|
||||||
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
|
// Vim's screen width is the full screen width, including columns used for gutters.
|
||||||
|
return VimPlugin.getMotion().scrollColumns(editor, -cmd.count * (EditorHelper.getApproximateScreenWidth(editor) / 2));
|
||||||
|
}
|
||||||
|
}
|
@@ -27,6 +27,6 @@ class MotionScrollLastScreenColumnAction : VimActionHandler.SingleExecution() {
|
|||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollColumnToLastScreenColumn(editor)
|
return VimPlugin.getMotion().scrollCaretColumnToLastScreenColumn(editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollLastScreenLineAction : VimActionHandler.SingleExecution() {
|
class MotionScrollLastScreenLineAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollLineToLastScreenLine(editor, cmd.rawCount, false)
|
return VimPlugin.getMotion().scrollLineToLastScreenLine(editor, cmd.rawCount, false)
|
||||||
}
|
}
|
||||||
|
@@ -21,28 +21,37 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollLastScreenLinePageStartAction : VimActionHandler.SingleExecution() {
|
class MotionScrollLastScreenLinePageStartAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
val motion = VimPlugin.getMotion()
|
val motion = VimPlugin.getMotion()
|
||||||
var line = cmd.rawCount
|
|
||||||
if (line == 0) {
|
// Without [count]: Redraw with the line just above the window at the bottom of the window. Put the cursor in that
|
||||||
val prevVisualLine = EditorHelper.getVisualLineAtTopOfScreen(editor) - 1
|
// line, at the first non-blank in the line.
|
||||||
line = EditorHelper.visualLineToLogicalLine(editor, prevVisualLine) + 1 // rawCount is 1 based
|
if (cmd.rawCount == 0) {
|
||||||
return motion.scrollLineToLastScreenLine(editor, line, true)
|
val prevVisualLine = EditorHelper.normalizeVisualLine(editor,
|
||||||
|
EditorHelper.getVisualLineAtTopOfScreen(editor) - 1)
|
||||||
|
val logicalLine = EditorHelper.visualLineToLogicalLine(editor, prevVisualLine)
|
||||||
|
return motion.scrollLineToLastScreenLine(editor, logicalLine + 1, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// [count]z^ first scrolls [count] to the bottom of the window, then moves the caret to the line that is now at
|
// [count]z^ first scrolls [count] to the bottom of the window, then moves the caret to the line that is now at
|
||||||
// the top, and then move that line to the bottom of the window
|
// the top, and then move that line to the bottom of the window
|
||||||
line = EditorHelper.normalizeLine(editor, line)
|
var logicalLine = EditorHelper.normalizeLine(editor, cmd.rawCount - 1)
|
||||||
if (motion.scrollLineToLastScreenLine(editor, line, true)) {
|
if (motion.scrollLineToLastScreenLine(editor, logicalLine + 1, false)) {
|
||||||
line = EditorHelper.getVisualLineAtTopOfScreen(editor)
|
logicalLine = EditorHelper.visualLineToLogicalLine(editor, EditorHelper.getVisualLineAtTopOfScreen(editor))
|
||||||
line = EditorHelper.visualLineToLogicalLine(editor, line) + 1 // rawCount is 1 based
|
return motion.scrollLineToLastScreenLine(editor, logicalLine + 1, true)
|
||||||
return motion.scrollLineToLastScreenLine(editor, line, true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollLastScreenLineStartAction : VimActionHandler.SingleExecution() {
|
class MotionScrollLastScreenLineStartAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollLineToLastScreenLine(editor, cmd.rawCount, true)
|
return VimPlugin.getMotion().scrollLineToLastScreenLine(editor, cmd.rawCount, true)
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollLineDownAction : VimActionHandler.SingleExecution() {
|
class MotionScrollLineDownAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollLine(editor, cmd.count)
|
return VimPlugin.getMotion().scrollLine(editor, cmd.count)
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MotionScrollLineUpAction : VimActionHandler.SingleExecution() {
|
class MotionScrollLineUpAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||||
|
|
||||||
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
|
||||||
|
|
||||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||||
return VimPlugin.getMotion().scrollLine(editor, -cmd.count)
|
return VimPlugin.getMotion().scrollLine(editor, -cmd.count)
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user