mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
461 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
33499fe945 | ||
![]() |
2882b638e5 | ||
![]() |
81c92cda79 | ||
![]() |
6506935d03 | ||
![]() |
b6be26231f | ||
![]() |
a96ba9f717 | ||
![]() |
173f570230 | ||
![]() |
57dcaba367 | ||
![]() |
d9f7955356 | ||
![]() |
9cf264998f | ||
![]() |
0dc67ae467 | ||
![]() |
75c1c0b839 | ||
![]() |
1feac95069 | ||
![]() |
ed3f87e6a8 | ||
![]() |
43662318be | ||
![]() |
785d1a04da | ||
![]() |
cc76c7f0f3 | ||
![]() |
57741cd5ce | ||
![]() |
69bd71148c | ||
![]() |
528e363d64 | ||
![]() |
bd772daee0 | ||
![]() |
23fa55ea11 | ||
![]() |
0a052e7bb3 | ||
![]() |
60a96e9542 | ||
![]() |
f3f9abef0c | ||
![]() |
58fc34d9f7 | ||
![]() |
6fdd769d0f | ||
![]() |
b54384bb33 | ||
![]() |
c57f98591a | ||
![]() |
7dcacd3b01 | ||
![]() |
2225033b7c | ||
![]() |
7c5194fbaa | ||
![]() |
cded76d1a2 | ||
![]() |
361284fe06 | ||
![]() |
aa3e55cacc | ||
![]() |
73987eaf23 | ||
![]() |
06058a45c0 | ||
![]() |
d46cab6fc8 | ||
![]() |
77bd800d95 | ||
![]() |
831373c292 | ||
![]() |
9c5e5e117a | ||
![]() |
346ada2eff | ||
![]() |
485ff37b22 | ||
![]() |
47ef6f4844 | ||
![]() |
cd288ec125 | ||
![]() |
bde2eb786d | ||
![]() |
b6896e28c8 | ||
![]() |
15dc233a86 | ||
![]() |
b070549eca | ||
![]() |
71a3df028b | ||
![]() |
73ef8c821b | ||
![]() |
bbd314b6df | ||
![]() |
5764fe7555 | ||
![]() |
44cc17cb84 | ||
![]() |
dba8879576 | ||
![]() |
1deb48bf60 | ||
![]() |
11174b8581 | ||
![]() |
bd35f71c6a | ||
![]() |
d29ae6a64d | ||
![]() |
5b69b9beae | ||
![]() |
0c78741642 | ||
![]() |
a9440f41a7 | ||
![]() |
8fc4306d76 | ||
![]() |
371d7385ed | ||
![]() |
2cacdbaf00 | ||
![]() |
3041fe7c3b | ||
![]() |
436e96f734 | ||
![]() |
67a9e1f8c5 | ||
![]() |
fc0a950af1 | ||
![]() |
e1872387d4 | ||
![]() |
ac10b96280 | ||
![]() |
d5313ebbda | ||
![]() |
c3d1e5c58c | ||
![]() |
478c0cd443 | ||
![]() |
2be2d861c9 | ||
![]() |
9731980fe6 | ||
![]() |
392f8e5e60 | ||
![]() |
a7e1275b5f | ||
![]() |
29a6d47cca | ||
![]() |
65483dd34a | ||
![]() |
3b290fe356 | ||
![]() |
2648913b61 | ||
![]() |
d386e49bd5 | ||
![]() |
f3c66d131e | ||
![]() |
c1b4671435 | ||
![]() |
cbeb0d229b | ||
![]() |
7f8db50017 | ||
![]() |
0c5ca37412 | ||
![]() |
602071a440 | ||
![]() |
7061b58940 | ||
![]() |
76c2c54e5a | ||
![]() |
f256da8a16 | ||
![]() |
ffcf7d0630 | ||
![]() |
b80205200c | ||
![]() |
40d0f6c1e2 | ||
![]() |
bddd4db2b2 | ||
![]() |
7ee18e81c7 | ||
![]() |
700240d441 | ||
![]() |
539d38259c | ||
![]() |
2efb0dfb17 | ||
![]() |
f38bf65656 | ||
![]() |
947d32d905 | ||
![]() |
56569966a6 | ||
![]() |
6092535041 | ||
![]() |
d965eb0d7e | ||
![]() |
44a53ce28e | ||
![]() |
a228f32f34 | ||
![]() |
2082981bd6 | ||
![]() |
994ad0b06c | ||
![]() |
3c59ee79f6 | ||
![]() |
b3ebd7c29d | ||
![]() |
fcc2355037 | ||
![]() |
76a5c39fdc | ||
![]() |
f4ec448d75 | ||
![]() |
e38390f8a1 | ||
![]() |
2990389ea5 | ||
![]() |
249dfb166d | ||
![]() |
4c06d21396 | ||
![]() |
a046f2975f | ||
![]() |
0bf217ef36 | ||
![]() |
f2712d8cfb | ||
![]() |
bb32e7adb4 | ||
![]() |
cadaec585b | ||
![]() |
11c2f5014f | ||
![]() |
2326489658 | ||
![]() |
01ec08e20b | ||
![]() |
69ebcc17e9 | ||
![]() |
b86bdd7847 | ||
![]() |
fbd7409851 | ||
![]() |
0773c886ee | ||
![]() |
d05c7268d9 | ||
![]() |
80d0748edd | ||
![]() |
fcbf228d35 | ||
![]() |
34feb27bef | ||
![]() |
86f707bc51 | ||
![]() |
07f74f82b5 | ||
![]() |
60917433d2 | ||
![]() |
dd59e0704a | ||
![]() |
d4bf472291 | ||
![]() |
039b650953 | ||
![]() |
0148860b2d | ||
![]() |
49590c831f | ||
![]() |
9aed0ce621 | ||
![]() |
9b653a7c63 | ||
![]() |
8d919d6ec8 | ||
![]() |
bb0094038a | ||
![]() |
c29764b164 | ||
![]() |
ae55f5d605 | ||
![]() |
81ca21517a | ||
![]() |
24a4167296 | ||
![]() |
3ffd967b00 | ||
![]() |
a2a1f4806a | ||
![]() |
6b56d7d1cd | ||
![]() |
b5a802bf30 | ||
![]() |
b4586779b3 | ||
![]() |
d92d5a1b33 | ||
![]() |
52ec080343 | ||
![]() |
5bff61c2ee | ||
![]() |
c12b713543 | ||
![]() |
7bafa0f8c8 | ||
![]() |
a47cdb9f35 | ||
![]() |
bd9ac3b031 | ||
![]() |
22ad45cd58 | ||
![]() |
58e0b7704b | ||
![]() |
b78854b8de | ||
![]() |
ae61ed456f | ||
![]() |
bdc1103641 | ||
![]() |
689d19759d | ||
![]() |
7f34b826b2 | ||
![]() |
064d3765c0 | ||
![]() |
752814a5fb | ||
![]() |
861028ef5c | ||
![]() |
dad0d8e559 | ||
![]() |
75f88c539c | ||
![]() |
1109650fde | ||
![]() |
704f8d7e9d | ||
![]() |
4a2c3d9098 | ||
![]() |
d21b04acb5 | ||
![]() |
5403336c78 | ||
![]() |
def6d2bd5b | ||
![]() |
04db2764c1 | ||
![]() |
0e9b2250bd | ||
![]() |
654d345d78 | ||
![]() |
99e379392b | ||
![]() |
1debd99701 | ||
![]() |
a099070c79 | ||
![]() |
0a09b8bd5a | ||
![]() |
b3750dd24d | ||
![]() |
db1b0c2516 | ||
![]() |
fc6208b95d | ||
![]() |
e68d3eac7d | ||
![]() |
d093b446c2 | ||
![]() |
be839051d5 | ||
![]() |
8937068b5f | ||
![]() |
3f82020100 | ||
![]() |
63ee6bbc56 | ||
![]() |
7046680765 | ||
![]() |
c17334f17f | ||
![]() |
ecd40231a5 | ||
![]() |
c3935aafc9 | ||
![]() |
9b751da31c | ||
![]() |
b464d99bd5 | ||
![]() |
f3d168f19f | ||
![]() |
bb8fa94668 | ||
![]() |
4f4d9fda0b | ||
![]() |
24994fa387 | ||
![]() |
f4bb745519 | ||
![]() |
a03258999a | ||
![]() |
3f45200cb9 | ||
![]() |
4703e75003 | ||
![]() |
39b166b87f | ||
![]() |
ded21efe5f | ||
![]() |
4952ddc494 | ||
![]() |
8ffc9b6581 | ||
![]() |
f0be6581b2 | ||
![]() |
356217a6af | ||
![]() |
9b5c86211b | ||
![]() |
ef470bd890 | ||
![]() |
428d75968c | ||
![]() |
dca4b0a399 | ||
![]() |
2380e1b013 | ||
![]() |
9718445b44 | ||
![]() |
7f897440b7 | ||
![]() |
5b21074b9d | ||
![]() |
b0714075eb | ||
![]() |
956b56a772 | ||
![]() |
50b2093548 | ||
![]() |
bc5ca28b13 | ||
![]() |
653a62b5e4 | ||
![]() |
08780e1a5c | ||
![]() |
ce39355025 | ||
![]() |
3eed987488 | ||
![]() |
6f633700ae | ||
![]() |
a7670829d5 | ||
![]() |
6fb8817391 | ||
![]() |
e90b7276cb | ||
![]() |
a1ba5fec2b | ||
![]() |
6606211233 | ||
![]() |
b1daacc9fb | ||
![]() |
03fe7d9ea2 | ||
![]() |
2d3da163a8 | ||
![]() |
49c59764ac | ||
![]() |
06cc59b7a3 | ||
![]() |
7754080323 | ||
![]() |
ebf081e273 | ||
![]() |
258467467b | ||
![]() |
bbea7e787f | ||
![]() |
4f468cace7 | ||
![]() |
b2f736adf5 | ||
![]() |
9ddedbe752 | ||
![]() |
63b237114a | ||
![]() |
29c789dcf3 | ||
![]() |
59e2ae552e | ||
![]() |
9d396a5cfa | ||
![]() |
422557d4ce | ||
![]() |
04ebbcc3a9 | ||
![]() |
0919e9d560 | ||
![]() |
8af14edf21 | ||
![]() |
13c475d73c | ||
![]() |
1373af6f66 | ||
![]() |
291ad2906d | ||
![]() |
be5532b35d | ||
![]() |
b2402aad2e | ||
![]() |
3b46e44e4f | ||
![]() |
537ec30936 | ||
![]() |
a75db02d05 | ||
![]() |
4698f1be5c | ||
![]() |
1db103e352 | ||
![]() |
5037a1182f | ||
![]() |
6b476fa75f | ||
![]() |
4d46000ec6 | ||
![]() |
56ad6b4c0d | ||
![]() |
ab750b6e75 | ||
![]() |
44a4a858fe | ||
![]() |
74fb59640d | ||
![]() |
797bfaaf3d | ||
![]() |
0015a4357e | ||
![]() |
dbdc15f21f | ||
![]() |
c9236527e4 | ||
![]() |
1a8c72d721 | ||
![]() |
739ef487fa | ||
![]() |
b7273bc4f2 | ||
![]() |
c3e9452fdc | ||
![]() |
a4e34caa5d | ||
![]() |
fea2f0ba1e | ||
![]() |
b98427472f | ||
![]() |
bf42822626 | ||
![]() |
b71eb465cb | ||
![]() |
f072638c8c | ||
![]() |
79afcd4b65 | ||
![]() |
595482048c | ||
![]() |
2c99da538e | ||
![]() |
1393e60ca8 | ||
![]() |
2e67c704f7 | ||
![]() |
c0410131bf | ||
![]() |
473a305e5f | ||
![]() |
d53ca6cd90 | ||
![]() |
bd84babecd | ||
![]() |
1b83231b1c | ||
![]() |
f39ad34057 | ||
![]() |
942b64052d | ||
![]() |
559aabd6b8 | ||
![]() |
52d26f9fb6 | ||
![]() |
b7d124ce8d | ||
![]() |
6a5c70ee6a | ||
![]() |
a76b41b737 | ||
![]() |
2fc6553203 | ||
![]() |
98b003e601 | ||
![]() |
0dda443cc8 | ||
![]() |
9322283cb1 | ||
![]() |
95d412c78d | ||
![]() |
6245b15d8f | ||
![]() |
ab1d7ba6cb | ||
![]() |
ef05491991 | ||
![]() |
113642c8f5 | ||
![]() |
088dd98e0d | ||
![]() |
7e0046a715 | ||
![]() |
1a11d5df35 | ||
![]() |
57b5b319a7 | ||
![]() |
0a4672c050 | ||
![]() |
8808b651e2 | ||
![]() |
e9fca757b7 | ||
![]() |
98a3801f6a | ||
![]() |
e97c49a032 | ||
![]() |
0335b344a1 | ||
![]() |
63b7bed61a | ||
![]() |
49ecfd6879 | ||
![]() |
4d4b5967da | ||
![]() |
a882e37d04 | ||
![]() |
4734d23e29 | ||
![]() |
b7416da26d | ||
![]() |
36e768ab37 | ||
![]() |
ede0bd8623 | ||
![]() |
b4072eb62d | ||
![]() |
120b69c439 | ||
![]() |
b68daf3f3e | ||
![]() |
c32a1a5e5b | ||
![]() |
a5e303d1ca | ||
![]() |
c4d8cef44d | ||
![]() |
72fbe758b4 | ||
![]() |
3344bb3254 | ||
![]() |
6b9ab7163a | ||
![]() |
563092cffb | ||
![]() |
9a2a0c3b0e | ||
![]() |
f3b4726b34 | ||
![]() |
30d7c6edf1 | ||
![]() |
f33f73d2f5 | ||
![]() |
b595dfd443 | ||
![]() |
a3e15b5c76 | ||
![]() |
31d85c0221 | ||
![]() |
124bd55e18 | ||
![]() |
bb9b5b5bde | ||
![]() |
f586e6dd29 | ||
![]() |
c2b1b67b6b | ||
![]() |
2cb29233c8 | ||
![]() |
b0e0bebb7e | ||
![]() |
364b3567fc | ||
![]() |
9522a51dc7 | ||
![]() |
75335a8a01 | ||
![]() |
0bf561e326 | ||
![]() |
7e6c2c2a7c | ||
![]() |
b132d490f0 | ||
![]() |
3fde0fc209 | ||
![]() |
24bc09796f | ||
![]() |
758bff79d6 | ||
![]() |
3b0660799b | ||
![]() |
6880afa73c | ||
![]() |
01aae065ff | ||
![]() |
8ee49edef0 | ||
![]() |
e09f6c7886 | ||
![]() |
dd0a7207d5 | ||
![]() |
17700a6537 | ||
![]() |
949444f6dd | ||
![]() |
31832ac230 | ||
![]() |
33200f8208 | ||
![]() |
893cd17c1a | ||
![]() |
c471ddd12f | ||
![]() |
b0ac8f89c5 | ||
![]() |
a47338d8b7 | ||
![]() |
76d00ab47f | ||
![]() |
22b8552939 | ||
![]() |
1d25a04377 | ||
![]() |
52148f69c1 | ||
![]() |
f280f8138d | ||
![]() |
530846bc7a | ||
![]() |
27adde7af0 | ||
![]() |
e3869a201f | ||
![]() |
745a356c87 | ||
![]() |
b16a4a1343 | ||
![]() |
36e41555ea | ||
![]() |
3f824cf205 | ||
![]() |
c61b3c2f29 | ||
![]() |
fd97cfbd15 | ||
![]() |
4b4c293008 | ||
![]() |
69a573a279 | ||
![]() |
c33d4d989e | ||
![]() |
3cd1134973 | ||
![]() |
4f42d4dc4f | ||
![]() |
a3b4aecded | ||
![]() |
534ae6aa81 | ||
![]() |
7e1e50ffde | ||
![]() |
ab3cbb113e | ||
![]() |
1c7e6af1fc | ||
![]() |
84f7e25c5e | ||
![]() |
458fe97b75 | ||
![]() |
31364607f5 | ||
![]() |
56ec2c7ebc | ||
![]() |
f944d91d62 | ||
![]() |
2cf7d89581 | ||
![]() |
91546700d4 | ||
![]() |
a972aec9b0 | ||
![]() |
6328575639 | ||
![]() |
af534c9209 | ||
![]() |
82a1e920e0 | ||
![]() |
d46d292865 | ||
![]() |
1a96533a3c | ||
![]() |
2d86054fe8 | ||
![]() |
50e3af7b82 | ||
![]() |
27af4b926b | ||
![]() |
1d035acb6d | ||
![]() |
3704c321fa | ||
![]() |
9c6f35f3bd | ||
![]() |
47b49c3e03 | ||
![]() |
7a99261979 | ||
![]() |
8eda58825f | ||
![]() |
6ee43c0014 | ||
![]() |
bea3d58ddb | ||
![]() |
71b121c15c | ||
![]() |
7c8b6d2fe6 | ||
![]() |
5d33c46e6b | ||
![]() |
8aac0ebdb6 | ||
![]() |
6072aae338 | ||
![]() |
872b916d46 | ||
![]() |
86303b58df | ||
![]() |
78b1ad6df6 | ||
![]() |
e5ac7ee607 | ||
![]() |
480b32b5af | ||
![]() |
8c9cf09bd8 | ||
![]() |
7ceea17050 | ||
![]() |
76333c5a24 | ||
![]() |
85857a3319 | ||
![]() |
5ad2bb4bea | ||
![]() |
cb9d205336 | ||
![]() |
e1a292ba33 | ||
![]() |
fa4e54b32e | ||
![]() |
3ba41ac458 | ||
![]() |
2fbe85e60f | ||
![]() |
676a518fa8 | ||
![]() |
992c1923f6 | ||
![]() |
a22afdd0f6 | ||
![]() |
0da8625f30 | ||
![]() |
52a0af1636 | ||
![]() |
5fc66b5896 | ||
![]() |
80dec29832 | ||
![]() |
2c7d3c9971 | ||
![]() |
30a16e9496 | ||
![]() |
0d6526ea31 | ||
![]() |
4428340fd9 | ||
![]() |
900ce21445 | ||
![]() |
efad5545de | ||
![]() |
afb411dd35 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
*.swp
|
*.swp
|
||||||
|
/.gradle/
|
||||||
/.idea/
|
/.idea/
|
||||||
/idea/
|
/build/
|
||||||
/out/
|
/out/
|
||||||
/tmp/
|
/tmp/
|
1
.idea/codeStyleSettings.xml
generated
1
.idea/codeStyleSettings.xml
generated
@@ -256,7 +256,6 @@
|
|||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="Python">
|
<codeStyleSettings language="Python">
|
||||||
<option name="KEEP_LINE_BREAKS" value="false" />
|
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
|
||||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="SQL">
|
<codeStyleSettings language="SQL">
|
||||||
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
10
.idea/misc.xml
generated
10
.idea/misc.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="EntryPointsManager">
|
|
||||||
<entry_points version="2.0" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IntelliJ Plugin SDK" project-jdk-type="IDEA JDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
|
|
9
.idea/modules.xml
generated
9
.idea/modules.xml
generated
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/ideavim.iml" filepath="$PROJECT_DIR$/ideavim.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
|
|
36
.idea/runConfigurations/All_tests.xml
generated
36
.idea/runConfigurations/All_tests.xml
generated
@@ -1,36 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="All tests" type="JUnit" factoryName="JUnit">
|
|
||||||
<extension name="coverage" enabled="false" merge="false" runner="idea">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="com.maddyhome.idea.vim.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="org.jetbrains.plugins.ideavim.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<module name="ideavim" />
|
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
|
||||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
|
||||||
<option name="PACKAGE_NAME" value="org.jetbrains.plugins.ideavim" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
|
||||||
<option name="METHOD_NAME" value="" />
|
|
||||||
<option name="TEST_OBJECT" value="package" />
|
|
||||||
<option name="VM_PARAMETERS" value="-ea" />
|
|
||||||
<option name="PARAMETERS" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
|
||||||
<option name="ENV_VARIABLES" />
|
|
||||||
<option name="PASS_PARENT_ENVS" value="true" />
|
|
||||||
<option name="TEST_SEARCH_SCOPE">
|
|
||||||
<value defaultName="moduleWithDependencies" />
|
|
||||||
</option>
|
|
||||||
<envs />
|
|
||||||
<patterns />
|
|
||||||
<RunnerSettings RunnerId="Cover" />
|
|
||||||
<RunnerSettings RunnerId="Run" />
|
|
||||||
<ConfigurationWrapper RunnerId="Cover" />
|
|
||||||
<ConfigurationWrapper RunnerId="Run" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
10
.idea/runConfigurations/IdeaVim.xml
generated
10
.idea/runConfigurations/IdeaVim.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="IdeaVim" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
|
|
||||||
<module name="ideavim" />
|
|
||||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -Didea.is.internal=true" />
|
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
|
||||||
<RunnerSettings RunnerId="Run" />
|
|
||||||
<ConfigurationWrapper RunnerId="Run" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
7
.idea/vcs.xml
generated
7
.idea/vcs.xml
generated
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
|
|
18
AUTHORS.md
18
AUTHORS.md
@@ -34,6 +34,24 @@ Contributors:
|
|||||||
* [smartbomb](mailto:smartbomb@server.fake)
|
* [smartbomb](mailto:smartbomb@server.fake)
|
||||||
* [Tuomas Tynkkynen](mailto:tuomas.tynkkynen@iki.fi)
|
* [Tuomas Tynkkynen](mailto:tuomas.tynkkynen@iki.fi)
|
||||||
* [Jackson Popkin](mailto:jackson@donorschoose.org)
|
* [Jackson Popkin](mailto:jackson@donorschoose.org)
|
||||||
|
* [Teruo Kunihiro](mailto:yuyuyu1999@gmail.com)
|
||||||
|
* [Liubov Paina](mailto:lubashka.994@mail.ru)
|
||||||
|
* [Daniel Leong](mailto:falcone88@gmail.com)
|
||||||
|
* [Aleksey Lagoshin](mailto:aleksey@pri-num.com)
|
||||||
|
* [Paulo Bu](mailto:pbu_98@yahoo.com)
|
||||||
|
* [Giorgos Gaganis](mailto:gaganis@yahoo.com)
|
||||||
|
* [Pavel Fatin](mailto:pavel.fatin@jetbrains.com)
|
||||||
|
* [tieTYT](mailto:tietyt@gmail.com)
|
||||||
|
* [Nick Gieschen](mailto:nickgieschen@gmail.com)
|
||||||
|
* [Naoto Ikeno](mailto:ikenox@gmail.com)
|
||||||
|
* [Maximilian Luz](mailto:qzed@users.noreply.github.com)
|
||||||
|
* [Vladimir Parfinenko](mailto:vparfinenko@excelsior-usa.com)
|
||||||
|
* [Florian Hassmann](mailto:hassmann@hwdev.de)
|
||||||
|
* [Jan Palus](mailto:jpalus@fastmail.com)
|
||||||
|
* [Konstantin Petrov](mailto:kpetrov@ripe.net)
|
||||||
|
* [Vasily Alferov](mailto:ya-ikmik2012@yandex.ru)
|
||||||
|
* [Vitalii Karavaev](mailto:fkve97@gmail.com)
|
||||||
|
* [John Lin](mailto:johnlinp@gmail.com)
|
||||||
|
|
||||||
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 maintainer.
|
contact the maintainer.
|
||||||
|
124
CHANGES.md
124
CHANGES.md
@@ -3,13 +3,135 @@ The Changelog
|
|||||||
|
|
||||||
History of changes in IdeaVim for the IntelliJ platform.
|
History of changes in IdeaVim for the IntelliJ platform.
|
||||||
|
|
||||||
|
|
||||||
|
Get an Early Access
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Would you like to try new features and fixes? Join the Early Access Program and
|
||||||
|
receive EAP builds as updates! Add this URL to "Settings | Plugins |
|
||||||
|
Browse Repositories | Manage Repositories":
|
||||||
|
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim)
|
||||||
|
|
||||||
|
It is important to distinguish EAP from traditional pre-release software.
|
||||||
|
Please note that the quality of EAP versions may at times be way below even
|
||||||
|
usual beta standards.
|
||||||
|
|
||||||
|
|
||||||
|
To Be Released
|
||||||
|
--------------
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
0.50, 2018-10-18
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Moved "Vim Emulation" settings into "File | Settings | Vim Emulation". Support
|
||||||
|
for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>` (put `set
|
||||||
|
multiple-cursors` into your ~/.ideavimrc to enable it). Support for running
|
||||||
|
Vim commands for multiple cursors. Various bug fixes.
|
||||||
|
|
||||||
|
* [VIM-634](https://youtrack.jetbrains.com/issue/VIM-634) Support for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
||||||
|
* [VIM-780](https://youtrack.jetbrains.com/issue/VIM-780) Support for running Vim commands for multiple cursors
|
||||||
|
* [VIM-176](https://youtrack.jetbrains.com/issue/VIM-176) Fixed arrow key navigation in Run/Debug tool windows
|
||||||
|
* [VIM-339](https://youtrack.jetbrains.com/issue/VIM-339) Fixed `<Esc>` in diff windows
|
||||||
|
* [VIM-862](https://youtrack.jetbrains.com/issue/VIM-862) Allow `:action` to work in visual mode
|
||||||
|
* [VIM-1110](https://youtrack.jetbrains.com/issue/VIM-1110) Put the caret in correct place after `I` in visual block mode
|
||||||
|
* [VIM-1329](https://youtrack.jetbrains.com/issue/VIM-1329) Request focus reliably for Ex entry and output panels
|
||||||
|
* [VIM-1368](https://youtrack.jetbrains.com/issue/VIM-1368) Wait for focus reliably before running an `:action`
|
||||||
|
* [VIM-1379](https://youtrack.jetbrains.com/issue/VIM-1379) Fixed `I` for short lines in visual block mode
|
||||||
|
* [VIM-1380](https://youtrack.jetbrains.com/issue/VIM-1380) Fixed `cw` with count at the end of a word
|
||||||
|
* [VIM-1404](https://youtrack.jetbrains.com/issue/VIM-1404) Fixed the ability to use `:e#` when editor tabs are hidden
|
||||||
|
* [VIM-1431](https://youtrack.jetbrains.com/issue/VIM-1431) Fixed pasting text into the empty document
|
||||||
|
* [VIM-1427](https://youtrack.jetbrains.com/issue/VIM-1427) Added the support for count to the `it` and `at` motions
|
||||||
|
* [VIM-1287](https://youtrack.jetbrains.com/issue/VIM-1287) Fixed `i(` actions inside string literals
|
||||||
|
* [VIM-1317](https://youtrack.jetbrains.com/issue/VIM-1317) Don't run Undo/Redo inside write actions
|
||||||
|
* [VIM-1366](https://youtrack.jetbrains.com/issue/VIM-1366) Don't wrap a secondary event loop for `input()` into a write action
|
||||||
|
* [VIM-1274](https://youtrack.jetbrains.com/issue/VIM-1274) Correctly process escaping when `smartcase` is on
|
||||||
|
|
||||||
|
|
||||||
|
0.49, 2017-12-12
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Enabled zero-latency typing for Vim emulation. Added support for `iskeyword` option. Various bug fixes.
|
||||||
|
|
||||||
|
* [VIM-1254](https://youtrack.jetbrains.com/issue/VIM-1254) Enable zero-latency typing for Vim emulation
|
||||||
|
* [VIM-1367](https://youtrack.jetbrains.com/issue/VIM-1367) Support `iskeyword` option
|
||||||
|
* [VIM-523](https://youtrack.jetbrains.com/issue/VIM-523) Fixed global mark remembering only the line number
|
||||||
|
|
||||||
|
0.48, 2017-01-15
|
||||||
|
----------------
|
||||||
|
|
||||||
|
A bugfix release.
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
|
||||||
|
* [VIM-1205](https://youtrack.jetbrains.com/issue/VIM-1205) Don't move key handling into separate event for raw handlers
|
||||||
|
* [VIM-1216](https://youtrack.jetbrains.com/issue/VIM-1216) Fixed `.` resetting the last find movement while repeating change that also uses movement
|
||||||
|
|
||||||
|
Features:
|
||||||
|
|
||||||
|
* Support for zero-latency rendering
|
||||||
|
|
||||||
|
|
||||||
|
0.47, 2016-10-19
|
||||||
|
----------------
|
||||||
|
|
||||||
|
A bugfix release.
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
|
||||||
|
* VIM-1098 Don't start visual selection when mouse click was actually drag over single character
|
||||||
|
* VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
|
||||||
|
|
||||||
|
|
||||||
|
0.46, 2016-07-07
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Added `incsearch` option for incremental search. Added support for `it` and
|
||||||
|
`at` tag block selection. Added `vim-surround` commands `ys`, `cs`, `ds`,
|
||||||
|
`S`. Various bug fixes.
|
||||||
|
|
||||||
|
Features:
|
||||||
|
|
||||||
|
* VIM-769 Added `vim-surround` commands `ys`, `cs`, `ds`, `S`
|
||||||
|
* VIM-264 Added tag block selection
|
||||||
|
* VIM-271 Added `incsearch` option for showing search results while typing
|
||||||
|
* VIM-217 Added support for `={motion}` formatting command
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
|
||||||
|
* VIM-796 Fixed focus issues with `:action` command
|
||||||
|
* VIM-581 Fixed use of special registers `0`-`9` and `-` in delete commands
|
||||||
|
* VIM-965 Fixed exception in `[m` in some file types
|
||||||
|
* VIM-564 Fixed `g_` move to go to the current line
|
||||||
|
* VIM-964 Fixed marks behavior when the whole line got deleted
|
||||||
|
* VIM-259 Move caret to the line beginning after `==`
|
||||||
|
* VIM-246 Fixed `{count}==` formatting
|
||||||
|
* VIM-287 Fixed insert new line before and after folds
|
||||||
|
* VIM-139 Focus on current search and use modal confirmation for `:s///gc`
|
||||||
|
* VIM-843 Don't highlight search results after restart
|
||||||
|
* VIM-1126 Fixed warning about modifying shortcuts of global actions for 2016.2
|
||||||
|
|
||||||
|
|
||||||
|
0.44, 2015-11-02
|
||||||
|
----------------
|
||||||
|
|
||||||
|
A bugfix release.
|
||||||
|
|
||||||
|
|
||||||
|
* VIM-1040 Fixed typing keys in completion menus and typing with the
|
||||||
|
plugin disabled
|
||||||
|
|
||||||
|
|
||||||
0.43, 2015-11-02
|
0.43, 2015-11-02
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
A bugfix release.
|
A bugfix release.
|
||||||
|
|
||||||
* VIM-1039 Fixed running the plugin with Java 6
|
* VIM-1039 Fixed running the plugin with Java 6
|
||||||
M
|
|
||||||
|
|
||||||
0.42, 2015-11-01
|
0.42, 2015-11-01
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
128
README.md
128
README.md
@@ -1,28 +1,34 @@
|
|||||||
IdeaVim
|
IdeaVim
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
|
||||||
|
<img src="http://jb.gg/badges/official.svg" alt="official JetBrains project"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Build&guest=1">
|
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Build&guest=1">
|
||||||
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Build)/statusIcon"/>
|
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Build)/statusIcon.svg?guest=1"/>
|
||||||
</a>
|
</a>
|
||||||
<span>Build<span>
|
<span>Build<span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ15&guest=1">
|
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20182&guest=1">
|
||||||
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ15)/statusIcon"/>
|
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20182)/statusIcon.svg?guest=1"/>
|
||||||
</a>
|
</a>
|
||||||
<span>Tests</span>
|
<span>Tests</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
IdeaVim is a Vim emulation plug-in 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, RubyMine, PyCharm, PhpStorm, WebStorm,
|
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
|
||||||
AppCode, CLion and Android Studio.
|
RubyMine, AppCode, DataGrip, GoLand, Cursive, and Android Studio.
|
||||||
|
|
||||||
Resources:
|
Resources:
|
||||||
|
|
||||||
* [Plugin homepage](http://plugins.jetbrains.com/plugin/164)
|
* [Plugin homepage](http://plugins.jetbrains.com/plugin/164)
|
||||||
* [Changelog](https://github.com/JetBrains/ideavim/blob/master/CHANGES.md)
|
* [Changelog](CHANGES.md)
|
||||||
* [Bug tracker](http://youtrack.jetbrains.com/issues/VIM)
|
* [Bug tracker](http://youtrack.jetbrains.com/issues/VIM)
|
||||||
* [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
|
* [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
|
||||||
* [@IdeaVim](http://twitter.com/ideavim) in Twitter
|
* [@IdeaVim](http://twitter.com/ideavim) in Twitter
|
||||||
@@ -36,12 +42,29 @@ Start the IDE normally and enable the Vim emulation using "Tools | Vim
|
|||||||
Emulator" menu item. At this point you must use Vim keystrokes in all editors.
|
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
|
If you wish to disable the plugin, select the "Tools | Vim Emulator" menu so
|
||||||
it is unchecked. At this point IDE will work with its regular keyboard
|
it is unchecked. At this point your IDE will work with its regular keyboard
|
||||||
shortcuts.
|
shortcuts.
|
||||||
|
|
||||||
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
|
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
|
||||||
resolved via "File | Settings | Vim Emulation", "File | Settings | Keymap"
|
resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
|
||||||
and key mapping commands in your ~/.ideavimrc file.
|
Keymap" on Linux & Windows, and by "Preferences | Editor | Vim Emulation",
|
||||||
|
"Preferences | Keymap" on macOS. They can also be resolved by key mapping
|
||||||
|
commands in your ~/.ideavimrc file.
|
||||||
|
|
||||||
|
|
||||||
|
Get an Early Access
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Would you like to try new features and fixes? Join the Early Access Program and
|
||||||
|
receive EAP builds as updates! Add this URL to "Settings | Plugins |
|
||||||
|
Browse Repositories | Manage Repositories":
|
||||||
|
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim)
|
||||||
|
|
||||||
|
See [the changelog](CHANGES.md) for the list of hot unreleased features.
|
||||||
|
|
||||||
|
It is important to distinguish EAP from traditional pre-release software.
|
||||||
|
Please note that the quality of EAP versions may at times be way below even
|
||||||
|
usual beta standards.
|
||||||
|
|
||||||
|
|
||||||
Summary of Supported Vim Features
|
Summary of Supported Vim Features
|
||||||
@@ -57,7 +80,7 @@ Supported:
|
|||||||
* Undo/redo
|
* Undo/redo
|
||||||
* Visual mode commands
|
* Visual mode commands
|
||||||
* Some Ex commands
|
* Some Ex commands
|
||||||
* Some [:set options](https://github.com/JetBrains/ideavim/blob/master/doc/set-commands.md)
|
* Some [:set options](doc/set-commands.md)
|
||||||
* Full Vim regexps for search and search/replace
|
* Full Vim regexps for search and search/replace
|
||||||
* Key mappings
|
* Key mappings
|
||||||
* Macros
|
* Macros
|
||||||
@@ -66,6 +89,11 @@ Supported:
|
|||||||
* Window commands
|
* Window commands
|
||||||
* Vim web help
|
* Vim web help
|
||||||
|
|
||||||
|
Emulated Vim plugins:
|
||||||
|
|
||||||
|
* vim-surround
|
||||||
|
* vim-multiple-cursors
|
||||||
|
|
||||||
Not supported (yet):
|
Not supported (yet):
|
||||||
|
|
||||||
* Jump lists
|
* Jump lists
|
||||||
@@ -73,7 +101,7 @@ Not supported (yet):
|
|||||||
|
|
||||||
See also:
|
See also:
|
||||||
|
|
||||||
* [List of recently added commands](https://github.com/JetBrains/ideavim/blob/master/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](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
|
* [Top features and bugs](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
|
||||||
|
|
||||||
|
|
||||||
@@ -91,12 +119,30 @@ Note, that IdeaVim currently parses ~/.ideavimrc file via simple pattern matchin
|
|||||||
see [VIM-669](http://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
|
see [VIM-669](http://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 will
|
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`.
|
||||||
|
|
||||||
|
|
||||||
|
Emulated Vim Plugins
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
IdeaVim extensions emulate some plugins of the original Vim. In order to use
|
||||||
|
IdeaVim extensions, you have to enable them via this command in your ~/.ideavimrc:
|
||||||
|
|
||||||
|
set <extension-name>
|
||||||
|
|
||||||
|
Available extensions:
|
||||||
|
|
||||||
|
* surround
|
||||||
|
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
|
||||||
|
* Commands: `ys`, `cs`, `ds`, `S`
|
||||||
|
* multiple-cursors
|
||||||
|
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
|
||||||
|
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
||||||
|
|
||||||
|
|
||||||
Changes to the IDE
|
Changes to the IDE
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
@@ -104,16 +150,17 @@ Changes to the IDE
|
|||||||
|
|
||||||
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ platform,
|
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ platform,
|
||||||
so the behaviour of the `u` and `<C-R>` commands may differ from the original
|
so the behaviour of the `u` and `<C-R>` commands may differ from the original
|
||||||
Vim. Vim compatibility of undo/redo may be improved in the future releases.
|
Vim. Vim compatibility of undo/redo may be improved in future releases.
|
||||||
|
|
||||||
See also [unresolved undo issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+u).
|
See also [unresolved undo issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+u).
|
||||||
|
|
||||||
### Escape
|
### Escape
|
||||||
|
|
||||||
Using `<Esc>` in dialog windows remains problematic. For most dialog windows
|
Using `<Esc>` in dialog windows remains problematic. For most dialog windows
|
||||||
the Vim emulator is put into the insert mode without the possibility to switch to
|
the Vim emulator is put into the insert mode with `<Esc>` not working. You
|
||||||
the normal mode. In some dialog windows the normal mode is on by default. The
|
should use `<C-c>` or `<C-[>` instead. In some dialog windows the normal mode is
|
||||||
usage of the Vim emulator in dialog windows is an area for improvements.
|
on by default. The usage of the Vim emulator in dialog windows is an area for
|
||||||
|
improvements.
|
||||||
|
|
||||||
See also [unresolved escape issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
|
See also [unresolved escape issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
|
||||||
|
|
||||||
@@ -153,39 +200,39 @@ in the issue tracker.
|
|||||||
|
|
||||||
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
|
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
|
||||||
|
|
||||||
2. Open the project in IntelliJ IDEA 13.1+ (Community or Ultimate) using "File |
|
2. Import the project from existing sources in IntelliJ IDEA 2018.1 or newer (Community or
|
||||||
Open... | /path/to/ideavim".
|
Ultimate) using "File | New | Project from Existing Sources..." or "Import
|
||||||
|
Project" from the start window.
|
||||||
|
|
||||||
3. Set up a JDK if you haven't got it yet. Use "File | Project Structure | SDKs
|
* In the project wizard select "Import project from external model | Gradle"
|
||||||
| Add new JDK".
|
|
||||||
|
|
||||||
4. Set up an IntelliJ plugin SDK using "File | Project Structure | SDKs | Add
|
* Select your Java 8+ JDK as the Gradle JVM, leave other parameters unchanged
|
||||||
new IntelliJ IDEA Plugin SDK". The correct path to your current installation
|
|
||||||
of IntelliJ will be suggested automatically. You will be prompted to select a
|
|
||||||
JDK for your plugin SDK. Select the JDK from the previous step. You
|
|
||||||
**should** name your plugin SDK `IntelliJ Plugin SDK` in order to match the
|
|
||||||
name in the project settings stored in the Git repository.
|
|
||||||
|
|
||||||
5. Select a project SDK for your project using "File | Project Structure |
|
3. Run your IdeaVim plugin within IntelliJ via a Gradle task
|
||||||
Project | Project SDK". Choose the plugin SDK you have created at the
|
|
||||||
previous step.
|
|
||||||
|
|
||||||
6. Build IdeaVim and run IntelliJ with IdeaVim enabled using the "IdeaVim" run
|
* Select "View | Tool Windows | Gradle" tool window
|
||||||
configuration (use "Run | Run... | IdeaVim"). This will launch a spare
|
|
||||||
instance of IntelliJ running the compiled plugin in a sandboxed enviroment.
|
* Launch "ideavim | intellij | runIde" from the tool window
|
||||||
To actually deploy the plugin the recommended way is executing `ant dist`
|
|
||||||
from command line, which will update versions in plugin.xml among other
|
|
||||||
tasks. Install the generated "ideavim.jar" file from
|
|
||||||
"Settings | Plugins | Install plugin from disk".
|
|
||||||
|
|
||||||
7. In order to be able to run tests in your IntelliJ edition uncomment the
|
4. Run IdeaVim tests via a Gradle task
|
||||||
appropriate lines in the constructor of the `VimTestCase` class.
|
|
||||||
|
* Select "View | Tool Windows | Gradle" tool window
|
||||||
|
|
||||||
|
* Launch "ideavim | verification | test" from the tool window
|
||||||
|
|
||||||
|
5. Build the plugin distribution by running `./gradlew clean buildPlugin` in the
|
||||||
|
terminal in your project root.
|
||||||
|
|
||||||
|
* The resulting distribution file is build/distributions/IdeaVim-VERSION.zip
|
||||||
|
|
||||||
|
* You can install this file using "Settings | Plugins | Install plugin
|
||||||
|
from disk"
|
||||||
|
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
See [AUTHORS.md](https://github.com/JetBrains/ideavim/blob/master/AUTHORS.md)
|
See [AUTHORS.md](AUTHORS.md)
|
||||||
for a list of authors and contributors.
|
for a list of authors and contributors.
|
||||||
|
|
||||||
|
|
||||||
@@ -193,4 +240,3 @@ 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.
|
||||||
|
|
||||||
|
54
build.gradle
Normal file
54
build.gradle
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'org.jetbrains.intellij' version '0.3.12'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
|
sourceCompatibility = javaVersion
|
||||||
|
targetCompatibility = javaVersion
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.srcDir 'src'
|
||||||
|
resources.srcDir 'resources'
|
||||||
|
}
|
||||||
|
test {
|
||||||
|
java.srcDir 'test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
intellij {
|
||||||
|
version ideaVersion
|
||||||
|
pluginName 'IdeaVim'
|
||||||
|
updateSinceUntilBuild false
|
||||||
|
downloadSources Boolean.valueOf(downloadIdeaSources)
|
||||||
|
instrumentCode Boolean.valueOf(instrumentPluginCode)
|
||||||
|
|
||||||
|
publishPlugin {
|
||||||
|
channels publishChannels.split(',')
|
||||||
|
username publishUsername
|
||||||
|
password publishPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
||||||
|
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlinVersion"
|
||||||
|
}
|
@@ -1,4 +0,0 @@
|
|||||||
version-id:0.43
|
|
||||||
platform-version:143.0
|
|
||||||
idea.download.url=http://download.jetbrains.com/idea/ideaIC-143.380.20.tar.gz
|
|
||||||
build.number=dev
|
|
181
build.xml
181
build.xml
@@ -1,181 +0,0 @@
|
|||||||
<project name="IdeaVim">
|
|
||||||
<!--
|
|
||||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
|
||||||
* Copyright (C) 2003-2009 Rick Maddy, Oleg Shpynov
|
|
||||||
*
|
|
||||||
* 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, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
-->
|
|
||||||
<property file="build.properties"/>
|
|
||||||
|
|
||||||
<property name="idea" value="${basedir}/idea"/>
|
|
||||||
<property name="src" value="${basedir}/src"/>
|
|
||||||
<property name="resources" value="${basedir}/resources"/>
|
|
||||||
<property name="test" value="${basedir}/test"/>
|
|
||||||
<property name="idea.home" value="${idea}/unzip"/>
|
|
||||||
<property environment="env"/>
|
|
||||||
<property name="tools.jar" value="${env.JAVA_HOME}/lib/tools.jar"/>
|
|
||||||
<property name="version" value="${version-id}"/>
|
|
||||||
<property name="filename" value="ideavim-${version}"/>
|
|
||||||
|
|
||||||
<!--Output-->
|
|
||||||
<property name="out" value="${basedir}/out"/>
|
|
||||||
<property name="classes" value="${out}/classes"/>
|
|
||||||
<property name="build" value="${out}/build"/>
|
|
||||||
<property name="dist" value="${out}/dist"/>
|
|
||||||
<property name="test-reports" value="${out}/test-reports"/>
|
|
||||||
|
|
||||||
<path id="build.classpath">
|
|
||||||
<fileset dir="${idea.home}/lib">
|
|
||||||
<include name="*.jar"/>
|
|
||||||
</fileset>
|
|
||||||
<fileset dir="${java.home}/lib">
|
|
||||||
<include name="*.jar"/>
|
|
||||||
</fileset>
|
|
||||||
<pathelement path="${classes}"/>
|
|
||||||
</path>
|
|
||||||
|
|
||||||
<path id="test.classpath">
|
|
||||||
<path refid="build.classpath"/>
|
|
||||||
<pathelement path="${tools.jar}"/>
|
|
||||||
</path>
|
|
||||||
|
|
||||||
<!-- Clean all the generated stuff -->
|
|
||||||
<target name="clean" description="Removes all generated files">
|
|
||||||
<delete dir="${out}"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Compile all the sources to the ${classes} folder -->
|
|
||||||
<target name="compile">
|
|
||||||
<mkdir dir="${classes}"/>
|
|
||||||
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
|
|
||||||
<classpath refid="build.classpath"/>
|
|
||||||
</taskdef>
|
|
||||||
<!-- The task requires the following libraries from IntelliJ IDEA distribution: -->
|
|
||||||
<!-- javac2.jar; jdom.jar; asm.jar; asm-commons.jar -->
|
|
||||||
<javac2 destdir="${classes}" debug="on" fork="true" encoding="UTF-8" includeantruntime="false">
|
|
||||||
<classpath refid="build.classpath"/>
|
|
||||||
<src path="${src}"/>
|
|
||||||
<include name="com/maddyhome/idea/**"/>
|
|
||||||
</javac2>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Create ideavim.jar for packing inside zip plugin package -->
|
|
||||||
<target name="jar">
|
|
||||||
<mkdir dir="${classes}"/>
|
|
||||||
<mkdir dir="${classes}/META-INF"/>
|
|
||||||
<copy file="resources/META-INF/plugin.xml" todir="${classes}/META-INF">
|
|
||||||
<filterset>
|
|
||||||
<filter token="VERSION" value="${version}"/>
|
|
||||||
<filter token="SINCE-VERSION" value="${platform-version}"/>
|
|
||||||
<filter token="BUILD-NUMBER" value="${build.number}"/>
|
|
||||||
</filterset>
|
|
||||||
</copy>
|
|
||||||
<copy todir="${classes}">
|
|
||||||
<fileset dir="${src}" excludes="**/*.java"/>
|
|
||||||
</copy>
|
|
||||||
<copy todir="${classes}">
|
|
||||||
<fileset dir="${resources}"/>
|
|
||||||
</copy>
|
|
||||||
<mkdir dir="${build}"/>
|
|
||||||
<jar basedir="${classes}" jarfile="${build}/IdeaVim.jar" compress="yes"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="unzip, clean, compile, jar" description="Compiles all source code and created plugin jar file"/>
|
|
||||||
|
|
||||||
<!-- Download IntelliJ IDEA distribution -->
|
|
||||||
<target name="download" description="Downloads IntelliJ IDEA artifacts">
|
|
||||||
<mkdir dir="${idea}"/>
|
|
||||||
<get src="${idea.download.url}" dest="${idea}" skipexisting="true"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Unpack idea-*.zip file for ideavim compilation -->
|
|
||||||
<target name="unzip" depends="download" description="Unzip downloaded artifacts and set up idea.home">
|
|
||||||
<delete dir="${idea}/unzip"/>
|
|
||||||
<mkdir dir="${idea}/unzip"/>
|
|
||||||
<basename property="idea.filename" file="${idea.download.url}"/>
|
|
||||||
<untar src="${idea}/${idea.filename}" dest="${idea}/unzip" compression="gzip">
|
|
||||||
<cutdirsmapper dirs="1"/>
|
|
||||||
</untar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="dist" depends="dist-src, dist-bin" description="Creates the src and bin distribution files"/>
|
|
||||||
|
|
||||||
<!-- Prepare layout for plugin distribution and creates zip file which can be published -->
|
|
||||||
<target name="dist-bin" depends="clean, build" description="Creates a zip file containing the plugin sources">
|
|
||||||
<delete dir="${build}/IdeaVim"/>
|
|
||||||
<mkdir dir="${build}/IdeaVim"/>
|
|
||||||
<copy file="${basedir}/LICENSE.txt" tofile="${build}/IdeaVim/LICENSE"/>
|
|
||||||
<copy todir="${build}/IdeaVim/lib">
|
|
||||||
<fileset dir="${build}" includes="*.jar"/>
|
|
||||||
</copy>
|
|
||||||
<copy file="${basedir}/README.md" tofile="${build}/IdeaVim/README"/>
|
|
||||||
<copy file="${basedir}/CHANGES.md" tofile="${build}/IdeaVim/CHANGES"/>
|
|
||||||
<zip basedir="${build}" zipfile="${dist}/${filename}-${build.number}.zip" compress="true" includes="IdeaVim/**"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Packs all the sources -->
|
|
||||||
<target name="dist-src" depends="clean" description="Creates the source tar file">
|
|
||||||
<mkdir dir="${dist}"/>
|
|
||||||
<tar basedir="." destfile="${dist}/${filename}-src.tar.gz" excludes=".git/**,.idea/**,idea/**,out/**,*.iws,*.iml" compression="gzip"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="compile-tests" depends="compile">
|
|
||||||
<mkdir dir="${classes}"/>
|
|
||||||
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
|
|
||||||
<classpath refid="build.classpath"/>
|
|
||||||
</taskdef>
|
|
||||||
<javac2 destdir="${classes}" debug="on" fork="true" encoding="UTF-8" includeantruntime="false">
|
|
||||||
<classpath refid="build.classpath"/>
|
|
||||||
<src path="${test}"/>
|
|
||||||
<include name="org/jetbrains/plugins/ideavim/**"/>
|
|
||||||
</javac2>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="prepare-tests" depends="compile-tests">
|
|
||||||
<mkdir dir="${classes}/META-INF"/>
|
|
||||||
<copy file="resources/META-INF/plugin.xml" todir="${classes}/META-INF">
|
|
||||||
<filterset>
|
|
||||||
<filter token="VERSION" value="${version}"/>
|
|
||||||
<filter token="SINCE-VERSION" value="${platform-version}"/>
|
|
||||||
</filterset>
|
|
||||||
</copy>
|
|
||||||
<copy todir="${classes}">
|
|
||||||
<fileset dir="${resources}"/>
|
|
||||||
</copy>
|
|
||||||
<mkdir dir="${out}/IdeaVim"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="test" depends="unzip, clean, prepare-tests">
|
|
||||||
<mkdir dir="${test-reports}"/>
|
|
||||||
<junit fork="true" forkmode="once" logfailedtests="false" printsummary="true">
|
|
||||||
<classpath refid="test.classpath"/>
|
|
||||||
|
|
||||||
<jvmarg value="-Xmx256M"/>
|
|
||||||
<jvmarg value="-ea"/>
|
|
||||||
<jvmarg value="-Djava.awt.headless=true"/>
|
|
||||||
<jvmarg value="-Didea.plugins.path=${out}"/>
|
|
||||||
<jvmarg value="-Didea.load.plugins.id=IdeaVIM"/>
|
|
||||||
|
|
||||||
<formatter type="plain"/>
|
|
||||||
<formatter type="xml" usefile="true" />
|
|
||||||
|
|
||||||
<batchtest todir="${test-reports}">
|
|
||||||
<fileset dir="${test}">
|
|
||||||
<include name="**/*Test.java"/>
|
|
||||||
</fileset>
|
|
||||||
</batchtest>
|
|
||||||
</junit>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
@@ -9,6 +9,8 @@ The following `:set` commands can appear in `~/.ideavimrc` or set manually in th
|
|||||||
'history' 'hi' number of command-lines that are remembered
|
'history' 'hi' number of command-lines that are remembered
|
||||||
'hlsearch' 'hls' highlight matches with last search pattern
|
'hlsearch' 'hls' highlight matches with last search pattern
|
||||||
'ignorecase' 'ic' ignore case in search patterns
|
'ignorecase' 'ic' ignore case in search patterns
|
||||||
|
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
|
||||||
|
'incsearch' 'is' show where search pattern typed so far matches
|
||||||
'matchpairs' 'mps' pairs of characters that "%" can match
|
'matchpairs' 'mps' pairs of characters that "%" can match
|
||||||
'nrformats' 'nf' number formats recognized for CTRL-A command
|
'nrformats' 'nf' number formats recognized for CTRL-A command
|
||||||
'number' 'nu' print the line number in front of each line
|
'number' 'nu' print the line number in front of each line
|
||||||
@@ -22,7 +24,9 @@ The following `:set` commands can appear in `~/.ideavimrc` or set manually in th
|
|||||||
'sidescroll' 'ss' minimum number of columns to scroll horizontal
|
'sidescroll' 'ss' minimum number of columns to scroll horizontal
|
||||||
'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor
|
'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor
|
||||||
'smartcase' 'scs' no ignore case when pattern has uppercase
|
'smartcase' 'scs' no ignore case when pattern has uppercase
|
||||||
|
'timeout' 'to' use timeout for mapped key sequences
|
||||||
'timeoutlen' 'tm' time that is waited for a mapped key sequence
|
'timeoutlen' 'tm' time that is waited for a mapped key sequence
|
||||||
'undolevels' 'ul' maximum number of changes that can be undone
|
'undolevels' 'ul' maximum number of changes that can be undone
|
||||||
|
'viminfo' 'vi' information to remember after restart
|
||||||
'visualbell' 'vb' use visual bell instead of beeping
|
'visualbell' 'vb' use visual bell instead of beeping
|
||||||
'wrapscan' 'ws' searches wrap around the end of the file
|
'wrapscan' 'ws' searches wrap around the end of the file
|
||||||
|
9
gradle.properties
Normal file
9
gradle.properties
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
ideaVersion IC-2018.2.5
|
||||||
|
downloadIdeaSources true
|
||||||
|
instrumentPluginCode true
|
||||||
|
version SNAPSHOT
|
||||||
|
javaVersion 1.8
|
||||||
|
kotlinVersion 1.2.71
|
||||||
|
publishUsername username
|
||||||
|
publishPassword password
|
||||||
|
publishChannels eap
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Fri Dec 29 11:00:46 MSK 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
|
172
gradlew
vendored
Executable file
172
gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# 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" "$@"
|
84
gradlew.bat
vendored
Normal file
84
gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@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=
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@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%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
15
ideavim.iml
15
ideavim.iml
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PLUGIN_MODULE" version="4">
|
|
||||||
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/idea" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
@@ -2,50 +2,39 @@
|
|||||||
<name>IdeaVim</name>
|
<name>IdeaVim</name>
|
||||||
<id>IdeaVIM</id>
|
<id>IdeaVIM</id>
|
||||||
<change-notes><![CDATA[
|
<change-notes><![CDATA[
|
||||||
<p>0.43:</p>
|
<p>0.50:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed running the plugin with Java 6</li>
|
<li>Moved "Vim Emulation" settings into "File | Settings | Editor"</li>
|
||||||
|
<li>Support for vim-multiple-cursors commands <code><A-n></code>, <code><A-x></code>, <code><A-p></code>, <code>g<A-n></code> (put <code>set multiple-cursors</code> into your ~/.ideavimrc to enable it)</li>
|
||||||
|
<li>Support for running Vim commands for multiple cursors</li>
|
||||||
|
<li>The <a href="https://github.com/JetBrains/ideavim/blob/master/src/com/maddyhome/idea/vim/package-info.java">index of supported commands</a> on the GitHub page</li>
|
||||||
|
<li>Various bug fixes</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>0.42:</p>
|
<p>0.49:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed move commands in read-only files</li>
|
<li>Enabled zero-latency typing for Vim emulation</li>
|
||||||
|
<li>Support for <code>iskeyword</code> option</li>
|
||||||
|
<li>Various bug fixes</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>0.41:</p>
|
<p>0.48:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Various bug fixes</li>
|
<li>Various bug fixes</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>0.40:</p>
|
<p>0.47:</p>
|
||||||
<ul>
|
|
||||||
<li>Support for <code>mapleader</code></li>
|
|
||||||
<li>Support comments in <code>%</code> brace matching</li>
|
|
||||||
<li>Various bug fixes</li>
|
|
||||||
</ul>
|
|
||||||
<p>0.39:</p>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Various bug fixes</li>
|
<li>Various bug fixes</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>0.38:</p>
|
<p>0.46:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Support for <code>:action</code> and <code>:actionlist</code> for executing arbitrary IDE actions</li>
|
<li>Support for <code>incsearch</code> option for showing search results while typing</li>
|
||||||
<li>Support for <code>number</code> and <code>relativenumber</code> options</li>
|
<li>Support for <code>it</code> and <code>at</code> tag block selection</li>
|
||||||
<li>Support for <code>clipboard=unnamed</code> option</li>
|
<li>Support for vim-surround commands <code>ys</code>, <code>cs</code>, <code>ds</code>, <code>S</code>, enable it with <code>set surround</code> in your ~/.ideavimrc</li>
|
||||||
<li>Various bug fixes</li>
|
<li>Support for <code>={motion}</code> formatting command</li>
|
||||||
</ul>
|
|
||||||
<p>0.37:</p>
|
|
||||||
<ul>
|
|
||||||
<li>Various bug fixes</li>
|
|
||||||
</ul>
|
|
||||||
<p>0.36:</p>
|
|
||||||
<ul>
|
|
||||||
<li>Window commands from the <code><C-W></code> family</li>
|
|
||||||
<li>Support for <code>:split</code>/<code>:vsplit</code> commands</li>
|
|
||||||
<li>Fixed visual block selection mode</li>
|
|
||||||
<li>Various bug fixes</li>
|
<li>Various bug fixes</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
|
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
|
||||||
]]></change-notes>
|
]]></change-notes>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p>Build @VERSION@-@BUILD-NUMBER@</p>
|
|
||||||
<p>Vim emulation plug-in for IDEs based on the IntelliJ platform.</p>
|
<p>Vim emulation plug-in for IDEs based on the IntelliJ platform.</p>
|
||||||
<p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing, marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, window commands, etc.</p>
|
<p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing, marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, window commands, etc.</p>
|
||||||
<p>See also:</p>
|
<p>See also:</p>
|
||||||
@@ -54,10 +43,10 @@
|
|||||||
<li><a href="http://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
<li><a href="http://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
||||||
</ul>
|
</ul>
|
||||||
]]></description>
|
]]></description>
|
||||||
<version>@VERSION@</version>
|
<version>SNAPSHOT</version>
|
||||||
<vendor>JetBrains</vendor>
|
<vendor>JetBrains</vendor>
|
||||||
|
|
||||||
<idea-version since-build="@SINCE-VERSION@"/>
|
<idea-version since-build="181.0"/>
|
||||||
|
|
||||||
<!-- 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>
|
||||||
@@ -69,9 +58,17 @@
|
|||||||
</component>
|
</component>
|
||||||
</application-components>
|
</application-components>
|
||||||
|
|
||||||
|
<extensionPoints>
|
||||||
|
<extensionPoint qualifiedName="IdeaVIM.vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
|
||||||
|
</extensionPoints>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
|
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
||||||
<applicationConfigurable instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
</extensions>
|
||||||
|
|
||||||
|
<extensions defaultExtensionNs="IdeaVIM">
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
|
||||||
|
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|
||||||
<actions>
|
<actions>
|
||||||
@@ -157,6 +154,7 @@
|
|||||||
<action id="VimMotionInnerBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockDoubleQuoteAction" text="Select inner double quote block"/>
|
<action id="VimMotionInnerBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockDoubleQuoteAction" text="Select inner double quote block"/>
|
||||||
<action id="VimMotionInnerBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockSingleQuoteAction" text="Select inner single quote block"/>
|
<action id="VimMotionInnerBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockSingleQuoteAction" text="Select inner single quote block"/>
|
||||||
<action id="VimMotionInnerBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBackQuoteAction" text="Select inner back quote block"/>
|
<action id="VimMotionInnerBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBackQuoteAction" text="Select inner back quote block"/>
|
||||||
|
<action id="VimMotionInnerBlockTag" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockTagAction" text="Select inner >< block >/<"/>
|
||||||
<action id="VimMotionOuterBlockAngle" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockAngleAction" text="Select outer < block"/>
|
<action id="VimMotionOuterBlockAngle" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockAngleAction" text="Select outer < block"/>
|
||||||
<action id="VimMotionOuterBlockBrace" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBraceAction" text="Select outer { block"/>
|
<action id="VimMotionOuterBlockBrace" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBraceAction" text="Select outer { block"/>
|
||||||
<action id="VimMotionOuterBlockBracket" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBracketAction" text="Select outer [ block"/>
|
<action id="VimMotionOuterBlockBracket" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBracketAction" text="Select outer [ block"/>
|
||||||
@@ -164,6 +162,7 @@
|
|||||||
<action id="VimMotionOuterBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockDoubleQuoteAction" text="Select outer double quote block"/>
|
<action id="VimMotionOuterBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockDoubleQuoteAction" text="Select outer double quote block"/>
|
||||||
<action id="VimMotionOuterBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockSingleQuoteAction" text="Select outer single quote block"/>
|
<action id="VimMotionOuterBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockSingleQuoteAction" text="Select outer single quote block"/>
|
||||||
<action id="VimMotionOuterBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBackQuoteAction" text="Select outer back quote block"/>
|
<action id="VimMotionOuterBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBackQuoteAction" text="Select outer back quote block"/>
|
||||||
|
<action id="VimMotionOuterBlockTag" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockTagAction" text="Select outer >< block >/<"/>
|
||||||
<action id="VimMotionInnerParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerParagraphAction" text="Select Inner Paragraph"/>
|
<action id="VimMotionInnerParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerParagraphAction" text="Select Inner Paragraph"/>
|
||||||
<action id="VimMotionOuterParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterParagraphAction" text="Select Outer Paragraph"/>
|
<action id="VimMotionOuterParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterParagraphAction" text="Select Outer Paragraph"/>
|
||||||
<action id="VimMotionInnerSentence" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerSentenceAction" text="Select Inner Sentence"/>
|
<action id="VimMotionInnerSentence" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerSentenceAction" text="Select Inner Sentence"/>
|
||||||
@@ -277,6 +276,7 @@
|
|||||||
|
|
||||||
<!-- Shift -->
|
<!-- Shift -->
|
||||||
<action id="VimAutoIndentLines" class="com.maddyhome.idea.vim.action.change.shift.AutoIndentLinesAction" text="Auto Indent Lines"/>
|
<action id="VimAutoIndentLines" class="com.maddyhome.idea.vim.action.change.shift.AutoIndentLinesAction" text="Auto Indent Lines"/>
|
||||||
|
<action id="VimAutoIndentMotion" class="com.maddyhome.idea.vim.action.change.shift.AutoIndentMotionAction" text="Auto Indent Lines"/>
|
||||||
<action id="VimShiftLeftLines" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction" text="Shift Lines Left"/>
|
<action id="VimShiftLeftLines" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction" text="Shift Lines Left"/>
|
||||||
<action id="VimShiftLeftMotion" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction" text="Shift Motion Left"/>
|
<action id="VimShiftLeftMotion" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction" text="Shift Motion Left"/>
|
||||||
<action id="VimShiftLeftVisual" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction" text="Shift Visual Left"/>
|
<action id="VimShiftLeftVisual" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction" text="Shift Visual Left"/>
|
||||||
@@ -353,6 +353,7 @@
|
|||||||
<action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/>
|
<action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/>
|
||||||
|
|
||||||
<!-- Keys -->
|
<!-- Keys -->
|
||||||
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Vim Shortcuts"/>
|
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
|
||||||
|
<action id="VimOperatorAction" class="com.maddyhome.idea.vim.action.change.OperatorAction" text="Operator"/>
|
||||||
</actions>
|
</actions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
@@ -48,3 +48,4 @@ E385=E385: search hit BOTTOM without match for: {0}
|
|||||||
e_patnotf2=Pattern not found: {0}
|
e_patnotf2=Pattern not found: {0}
|
||||||
unkopt=Unknown option: {0}
|
unkopt=Unknown option: {0}
|
||||||
e_invarg=Invalid argument: {0}
|
e_invarg=Invalid argument: {0}
|
||||||
|
E774=E774: 'operatorfunc' is empty
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2016 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.maddyhome.idea.vim;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
import com.intellij.openapi.Disposable;
|
import com.intellij.openapi.Disposable;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,8 +24,10 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
|||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.application.Application;
|
import com.intellij.openapi.application.Application;
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
|
import com.intellij.openapi.application.ModalityState;
|
||||||
import com.intellij.openapi.command.CommandProcessor;
|
import com.intellij.openapi.command.CommandProcessor;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.editor.actionSystem.ActionPlan;
|
||||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||||
@@ -33,16 +35,18 @@ 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.CommandState;
|
import com.maddyhome.idea.vim.command.CommandState;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
|
import com.maddyhome.idea.vim.extension.VimExtensionHandler;
|
||||||
import com.maddyhome.idea.vim.group.RegisterGroup;
|
import com.maddyhome.idea.vim.group.RegisterGroup;
|
||||||
import com.maddyhome.idea.vim.helper.*;
|
import com.maddyhome.idea.vim.helper.DigraphSequence;
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||||
|
import com.maddyhome.idea.vim.helper.RunnableHelper;
|
||||||
|
import com.maddyhome.idea.vim.helper.StringHelper;
|
||||||
import com.maddyhome.idea.vim.key.*;
|
import com.maddyhome.idea.vim.key.*;
|
||||||
import com.maddyhome.idea.vim.option.Options;
|
import com.maddyhome.idea.vim.option.Options;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -91,6 +95,26 @@ public class KeyHandler {
|
|||||||
return origHandler;
|
return origHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked before acquiring a write lock and actually handling the keystroke.
|
||||||
|
*
|
||||||
|
* Drafts an optional {@link ActionPlan} that will be used as a base for zero-latency rendering in editor.
|
||||||
|
*
|
||||||
|
* @param editor The editor the key was typed into
|
||||||
|
* @param key The keystroke typed by the user
|
||||||
|
* @param context The data context
|
||||||
|
* @param plan The current action plan
|
||||||
|
*/
|
||||||
|
public void beforeHandleKey(@NotNull Editor editor, @NotNull KeyStroke key,
|
||||||
|
@NotNull DataContext context, @NotNull ActionPlan plan) {
|
||||||
|
|
||||||
|
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
|
||||||
|
|
||||||
|
if (mode == CommandState.Mode.INSERT || mode == CommandState.Mode.REPLACE) {
|
||||||
|
VimPlugin.getChange().beforeProcessKey(editor, context, key, plan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
|
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
|
||||||
* processing.
|
* processing.
|
||||||
@@ -216,7 +240,7 @@ public class KeyHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleKeyMapping(@NotNull final Editor editor, @NotNull KeyStroke key,
|
private boolean handleKeyMapping(@NotNull final Editor editor, @NotNull final KeyStroke key,
|
||||||
@NotNull final DataContext context) {
|
@NotNull final DataContext context) {
|
||||||
final CommandState commandState = CommandState.getInstance(editor);
|
final CommandState commandState = CommandState.getInstance(editor);
|
||||||
commandState.stopMappingTimer();
|
commandState.stopMappingTimer();
|
||||||
@@ -231,33 +255,56 @@ public class KeyHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final KeyMapping mapping = VimPlugin.getKey().getKeyMapping(mappingMode);
|
final KeyMapping mapping = VimPlugin.getKey().getKeyMapping(mappingMode);
|
||||||
final MappingInfo mappingInfo = mapping.get(fromKeys);
|
final MappingInfo currentMappingInfo = mapping.get(fromKeys);
|
||||||
|
final MappingInfo prevMappingInfo = mapping.get(mappingKeys);
|
||||||
|
final MappingInfo mappingInfo = currentMappingInfo != null ? currentMappingInfo : prevMappingInfo;
|
||||||
|
|
||||||
|
final Application application = ApplicationManager.getApplication();
|
||||||
|
|
||||||
if (mapping.isPrefix(fromKeys)) {
|
if (mapping.isPrefix(fromKeys)) {
|
||||||
mappingKeys.add(key);
|
mappingKeys.add(key);
|
||||||
commandState.startMappingTimer(new ActionListener() {
|
if (!application.isUnitTestMode() && Options.getInstance().isSet(Options.TIMEOUT)) {
|
||||||
@Override
|
commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
mappingKeys.clear();
|
mappingKeys.clear();
|
||||||
|
if (editor.isDisposed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (KeyStroke keyStroke : fromKeys) {
|
for (KeyStroke keyStroke : fromKeys) {
|
||||||
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
|
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
|
||||||
}
|
}
|
||||||
}
|
}, ModalityState.stateForComponent(editor.getComponent())));
|
||||||
});
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (mappingInfo != null) {
|
else if (mappingInfo != null) {
|
||||||
mappingKeys.clear();
|
mappingKeys.clear();
|
||||||
final Application application = ApplicationManager.getApplication();
|
|
||||||
final Runnable handleMappedKeys = new Runnable() {
|
final Runnable handleMappedKeys = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), mappingInfo.getToKeys());
|
if (editor.isDisposed()) {
|
||||||
boolean first = true;
|
return;
|
||||||
for (KeyStroke keyStroke : mappingInfo.getToKeys()) {
|
}
|
||||||
final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix);
|
final List<KeyStroke> toKeys = mappingInfo.getToKeys();
|
||||||
handleKey(editor, keyStroke, new EditorDataContext(editor), recursive);
|
final VimExtensionHandler extensionHandler = mappingInfo.getExtensionHandler();
|
||||||
first = false;
|
final EditorDataContext currentContext = new EditorDataContext(editor);
|
||||||
|
if (toKeys != null) {
|
||||||
|
final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), toKeys);
|
||||||
|
boolean first = true;
|
||||||
|
for (KeyStroke keyStroke : toKeys) {
|
||||||
|
final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix);
|
||||||
|
handleKey(editor, keyStroke, currentContext, recursive);
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (extensionHandler != null) {
|
||||||
|
final CommandProcessor processor = CommandProcessor.getInstance();
|
||||||
|
processor.executeCommand(editor.getProject(),
|
||||||
|
() -> extensionHandler.execute(editor, context),
|
||||||
|
"Vim " + extensionHandler.getClass().getSimpleName(),
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
if (prevMappingInfo != null) {
|
||||||
|
handleKey(editor, key, currentContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -324,9 +371,7 @@ public class KeyHandler {
|
|||||||
|
|
||||||
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
|
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
|
||||||
return (editorState.getMode() == CommandState.Mode.COMMAND || state == State.COMMAND) &&
|
return (editorState.getMode() == CommandState.Mode.COMMAND || state == State.COMMAND) &&
|
||||||
(key.getKeyCode() == KeyEvent.VK_ESCAPE ||
|
StringHelper.isCloseKeyStroke(key);
|
||||||
(key.getKeyCode() == KeyEvent.VK_C && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0) ||
|
|
||||||
(key.getKeyCode() == '[' && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCharArgument(@NotNull KeyStroke key, char chKey) {
|
private void handleCharArgument(@NotNull KeyStroke key, char chKey) {
|
||||||
@@ -424,23 +469,25 @@ public class KeyHandler {
|
|||||||
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
|
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
|
||||||
|
|
||||||
Project project = editor.getProject();
|
Project project = editor.getProject();
|
||||||
if (cmd.getType().isRead() || project == null || EditorHelper.canEdit(project, editor)) {
|
final Command.Type type = cmd.getType();
|
||||||
if (ApplicationManager.getApplication().isDispatchThread()) {
|
if (type.isWrite() && !editor.getDocument().isWritable()) {
|
||||||
Runnable action = new ActionRunner(editor, context, cmd, key);
|
|
||||||
String name = cmd.getAction().getTemplatePresentation().getText();
|
|
||||||
name = name != null ? "Vim " + name : "";
|
|
||||||
if (cmd.getType().isWrite()) {
|
|
||||||
RunnableHelper.runWriteCommand(project, action, name, action);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RunnableHelper.runReadCommand(project, action, name, action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
VimPlugin.indicateError();
|
VimPlugin.indicateError();
|
||||||
reset(editor);
|
reset(editor);
|
||||||
}
|
}
|
||||||
|
if (ApplicationManager.getApplication().isDispatchThread()) {
|
||||||
|
Runnable action = new ActionRunner(editor, context, cmd, key);
|
||||||
|
String name = cmd.getAction().getTemplatePresentation().getText();
|
||||||
|
name = name != null ? "Vim " + name : "";
|
||||||
|
if (type.isWrite()) {
|
||||||
|
RunnableHelper.runWriteCommand(project, action, name, action);
|
||||||
|
}
|
||||||
|
else if (type.isRead()) {
|
||||||
|
RunnableHelper.runReadCommand(project, action, name, action);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CommandProcessor.getInstance().executeCommand(project, action, name, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
|
private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -73,12 +73,12 @@ public class RegisterActions {
|
|||||||
new KeyStroke[]{KeyStroke.getKeyStroke('g'),
|
new KeyStroke[]{KeyStroke.getKeyStroke('g'),
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK)})
|
KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK)})
|
||||||
);
|
);
|
||||||
// TODO - add zC
|
|
||||||
// TODO - add zO
|
|
||||||
parser.registerAction(MappingMode.NV, "CollapseAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zM"));
|
parser.registerAction(MappingMode.NV, "CollapseAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zM"));
|
||||||
parser.registerAction(MappingMode.NV, "CollapseRegion", Command.Type.OTHER_READONLY, new Shortcut("zc"));
|
parser.registerAction(MappingMode.NV, "CollapseRegion", Command.Type.OTHER_READONLY, new Shortcut("zc"));
|
||||||
|
parser.registerAction(MappingMode.NV, "CollapseRegionRecursively", Command.Type.OTHER_READONLY, new Shortcut("zC"));
|
||||||
parser.registerAction(MappingMode.NV, "ExpandAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zR"));
|
parser.registerAction(MappingMode.NV, "ExpandAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zR"));
|
||||||
parser.registerAction(MappingMode.NV, "ExpandRegion", Command.Type.OTHER_READONLY, new Shortcut("zo"));
|
parser.registerAction(MappingMode.NV, "ExpandRegion", Command.Type.OTHER_READONLY, new Shortcut("zo"));
|
||||||
|
parser.registerAction(MappingMode.NV, "ExpandRegionRecursively", Command.Type.OTHER_READONLY, new Shortcut("zO"));
|
||||||
parser.registerAction(MappingMode.NV, "VimToggleRecording",
|
parser.registerAction(MappingMode.NV, "VimToggleRecording",
|
||||||
Command.Type.OTHER_READONLY,
|
Command.Type.OTHER_READONLY,
|
||||||
Command.FLAG_NO_ARG_RECORDING,
|
Command.FLAG_NO_ARG_RECORDING,
|
||||||
@@ -147,6 +147,10 @@ public class RegisterActions {
|
|||||||
new Shortcut("a<"),
|
new Shortcut("a<"),
|
||||||
new Shortcut("a>")
|
new Shortcut("a>")
|
||||||
});
|
});
|
||||||
|
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockTag", Command.Type.MOTION,
|
||||||
|
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
|
||||||
|
new Shortcut[]{new Shortcut("it")}
|
||||||
|
);
|
||||||
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBrace", Command.Type.MOTION,
|
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBrace", Command.Type.MOTION,
|
||||||
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
|
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
|
||||||
new Shortcut[]{new Shortcut("aB"), new Shortcut("a{"), new Shortcut("a}")}
|
new Shortcut[]{new Shortcut("aB"), new Shortcut("a{"), new Shortcut("a}")}
|
||||||
@@ -171,6 +175,10 @@ public class RegisterActions {
|
|||||||
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut[]{
|
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut[]{
|
||||||
new Shortcut("a`"),
|
new Shortcut("a`"),
|
||||||
});
|
});
|
||||||
|
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockTag", Command.Type.MOTION,
|
||||||
|
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
|
||||||
|
new Shortcut[]{new Shortcut("at")}
|
||||||
|
);
|
||||||
parser.registerAction(MappingMode.NO, "VimResetMode", Command.Type.RESET, new Shortcut(new KeyStroke[]{
|
parser.registerAction(MappingMode.NO, "VimResetMode", Command.Type.RESET, new Shortcut(new KeyStroke[]{
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, KeyEvent.CTRL_MASK),
|
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, KeyEvent.CTRL_MASK),
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)
|
KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)
|
||||||
@@ -507,10 +515,10 @@ public class RegisterActions {
|
|||||||
new Shortcut("gp"));
|
new Shortcut("gp"));
|
||||||
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
|
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
|
||||||
new Shortcut("[P"),
|
new Shortcut("[P"),
|
||||||
new Shortcut("]P")
|
new Shortcut("]P"),
|
||||||
|
new Shortcut("[p")
|
||||||
});
|
});
|
||||||
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
|
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
|
||||||
new Shortcut("[p"),
|
|
||||||
new Shortcut("]p")
|
new Shortcut("]p")
|
||||||
});
|
});
|
||||||
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY,
|
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY,
|
||||||
@@ -606,9 +614,9 @@ public class RegisterActions {
|
|||||||
new Shortcut("@:"));
|
new Shortcut("@:"));
|
||||||
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY,
|
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY,
|
||||||
new Shortcut('K'));
|
new Shortcut('K'));
|
||||||
parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_WRITABLE,
|
parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_SELF_SYNCHRONIZED,
|
||||||
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)));
|
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)));
|
||||||
parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_WRITABLE, new Shortcut[]{
|
parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_SELF_SYNCHRONIZED, new Shortcut[]{
|
||||||
new Shortcut('u'),
|
new Shortcut('u'),
|
||||||
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
|
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
|
||||||
});
|
});
|
||||||
@@ -624,10 +632,10 @@ public class RegisterActions {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Shift Actions
|
// Shift Actions
|
||||||
// TODO - add =
|
|
||||||
// TODO - == will ignore count and only auto-indent 1 lines
|
|
||||||
parser.registerAction(MappingMode.N, "VimAutoIndentLines", Command.Type.CHANGE,
|
parser.registerAction(MappingMode.N, "VimAutoIndentLines", Command.Type.CHANGE,
|
||||||
new Shortcut("=="));
|
new Shortcut("=="));
|
||||||
|
parser.registerAction(MappingMode.N, "VimAutoIndentMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
|
||||||
|
new Shortcut('='), Argument.Type.MOTION);
|
||||||
parser.registerAction(MappingMode.N, "VimShiftLeftLines", Command.Type.CHANGE,
|
parser.registerAction(MappingMode.N, "VimShiftLeftLines", Command.Type.CHANGE,
|
||||||
new Shortcut("<<"));
|
new Shortcut("<<"));
|
||||||
parser.registerAction(MappingMode.N, "VimShiftLeftMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
|
parser.registerAction(MappingMode.N, "VimShiftLeftMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,10 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.maddyhome.idea.vim;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
|
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||||
|
import com.intellij.ide.plugins.PluginManager;
|
||||||
|
import com.intellij.ide.util.PropertiesComponent;
|
||||||
import com.intellij.notification.*;
|
import com.intellij.notification.*;
|
||||||
|
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.ex.ApplicationEx;
|
|
||||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
|
||||||
import com.intellij.openapi.components.ApplicationComponent;
|
import com.intellij.openapi.components.ApplicationComponent;
|
||||||
import com.intellij.openapi.components.PersistentStateComponent;
|
import com.intellij.openapi.components.PersistentStateComponent;
|
||||||
import com.intellij.openapi.components.State;
|
import com.intellij.openapi.components.State;
|
||||||
@@ -28,6 +31,8 @@ import com.intellij.openapi.components.Storage;
|
|||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
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.event.EditorFactoryAdapter;
|
||||||
|
import com.intellij.openapi.editor.event.EditorFactoryEvent;
|
||||||
import com.intellij.openapi.extensions.PluginId;
|
import com.intellij.openapi.extensions.PluginId;
|
||||||
import com.intellij.openapi.keymap.Keymap;
|
import com.intellij.openapi.keymap.Keymap;
|
||||||
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
|
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
|
||||||
@@ -37,9 +42,13 @@ import com.intellij.openapi.project.Project;
|
|||||||
import com.intellij.openapi.project.ProjectManager;
|
import com.intellij.openapi.project.ProjectManager;
|
||||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||||
import com.intellij.openapi.ui.Messages;
|
import com.intellij.openapi.ui.Messages;
|
||||||
|
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
|
||||||
|
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.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.group.*;
|
import com.maddyhome.idea.vim.group.*;
|
||||||
@@ -48,12 +57,16 @@ import com.maddyhome.idea.vim.helper.MacKeyRepeat;
|
|||||||
import com.maddyhome.idea.vim.option.Options;
|
import com.maddyhome.idea.vim.option.Options;
|
||||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
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.net.URLEncoder;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied
|
* This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied
|
||||||
@@ -67,12 +80,11 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
@State(
|
@State(
|
||||||
name = "VimSettings",
|
name = "VimSettings",
|
||||||
storages = {@Storage(
|
storages = {@Storage(file = "$APP_CONFIG$/vim_settings.xml")})
|
||||||
id = "main",
|
|
||||||
file = "$APP_CONFIG$/vim_settings.xml")})
|
|
||||||
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
|
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
|
||||||
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
|
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
|
||||||
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 String IDEAVIM_NOTIFICATION_ID = "ideavim";
|
public static final String IDEAVIM_NOTIFICATION_ID = "ideavim";
|
||||||
public static final String IDEAVIM_STICKY_NOTIFICATION_ID = "ideavim-sticky";
|
public static final String IDEAVIM_STICKY_NOTIFICATION_ID = "ideavim-sticky";
|
||||||
public static final String IDEAVIM_NOTIFICATION_TITLE = "IdeaVim";
|
public static final String IDEAVIM_NOTIFICATION_TITLE = "IdeaVim";
|
||||||
@@ -141,7 +153,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
|||||||
});
|
});
|
||||||
|
|
||||||
final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
|
final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
|
||||||
EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getHandler()));
|
EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getRawHandler()));
|
||||||
|
|
||||||
// Register vim actions in command mode
|
// Register vim actions in command mode
|
||||||
RegisterActions.registerActions();
|
RegisterActions.registerActions();
|
||||||
@@ -290,6 +302,17 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
|||||||
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static String getVersion() {
|
||||||
|
if (!ApplicationManager.getApplication().isInternal()) {
|
||||||
|
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
|
||||||
|
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "INTERNAL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static boolean isEnabled() {
|
||||||
return getInstance().enabled;
|
return getInstance().enabled;
|
||||||
}
|
}
|
||||||
@@ -369,20 +392,17 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
|||||||
|
|
||||||
private void updateState() {
|
private void updateState() {
|
||||||
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
boolean requiresRestart = false;
|
|
||||||
if (SystemInfo.isMac) {
|
if (SystemInfo.isMac) {
|
||||||
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
|
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
|
||||||
final Boolean enabled = keyRepeat.isEnabled();
|
final Boolean enabled = keyRepeat.isEnabled();
|
||||||
final Boolean isKeyRepeat = editor.isKeyRepeat();
|
final Boolean isKeyRepeat = editor.isKeyRepeat();
|
||||||
if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) {
|
if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) {
|
||||||
if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold " +
|
if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold?\n\n" +
|
||||||
"(requires restart)?\n\n" +
|
|
||||||
"(You can do it manually by running 'defaults write -g " +
|
"(You can do it manually by running 'defaults write -g " +
|
||||||
"ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE,
|
"ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE,
|
||||||
Messages.getQuestionIcon()) == Messages.YES) {
|
Messages.getQuestionIcon()) == Messages.YES) {
|
||||||
editor.setKeyRepeat(true);
|
editor.setKeyRepeat(true);
|
||||||
keyRepeat.setEnabled(true);
|
keyRepeat.setEnabled(true);
|
||||||
requiresRestart = true;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
editor.setKeyRepeat(false);
|
editor.setKeyRepeat(false);
|
||||||
@@ -428,10 +448,6 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
|||||||
"<code>source ~/.vimrc</code>",
|
"<code>source ~/.vimrc</code>",
|
||||||
NotificationType.INFORMATION).notify(null);
|
NotificationType.INFORMATION).notify(null);
|
||||||
}
|
}
|
||||||
if (requiresRestart) {
|
|
||||||
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
|
||||||
app.restart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,6 +457,8 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
|||||||
private void setupListeners() {
|
private void setupListeners() {
|
||||||
final EventFacade eventFacade = EventFacade.getInstance();
|
final EventFacade eventFacade = EventFacade.getInstance();
|
||||||
|
|
||||||
|
setupStatisticsReporter(eventFacade);
|
||||||
|
|
||||||
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
|
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
|
||||||
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
|
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
|
||||||
|
|
||||||
@@ -453,4 +471,63 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports statistics about installed IdeaVim and enabled Vim emulation.
|
||||||
|
*
|
||||||
|
* See https://github.com/go-lang-plugin-org/go-lang-idea-plugin/commit/5182ab4a1d01ad37f6786268a2fe5e908575a217
|
||||||
|
*/
|
||||||
|
private void setupStatisticsReporter(@NotNull EventFacade eventFacade) {
|
||||||
|
final Application application = ApplicationManager.getApplication();
|
||||||
|
eventFacade.addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||||
|
@Override
|
||||||
|
public void editorCreated(@NotNull EditorFactoryEvent event) {
|
||||||
|
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()) {
|
||||||
|
application.executeOnPooledThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
final String buildNumber = ApplicationInfo.getInstance().getBuild().asString();
|
||||||
|
final String pluginId = IDEAVIM_PLUGIN_ID;
|
||||||
|
final String version = URLEncoder.encode(getVersion(), CharsetToolkit.UTF8);
|
||||||
|
final String os = URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION,
|
||||||
|
CharsetToolkit.UTF8);
|
||||||
|
final String uid = UpdateChecker.getInstallationUID(PropertiesComponent.getInstance());
|
||||||
|
final String url =
|
||||||
|
"https://plugins.jetbrains.com/plugins/list" +
|
||||||
|
"?pluginId=" + pluginId +
|
||||||
|
"&build=" + buildNumber +
|
||||||
|
"&pluginVersion=" + version +
|
||||||
|
"&os=" + os +
|
||||||
|
"&uuid=" + uid;
|
||||||
|
PropertiesComponent.getInstance().setValue(IDEAVIM_STATISTICS_TIMESTAMP_KEY,
|
||||||
|
String.valueOf(System.currentTimeMillis()));
|
||||||
|
HttpRequests.request(url).connect(new HttpRequests.RequestProcessor<Object>() {
|
||||||
|
@Override
|
||||||
|
public Object process(@NotNull HttpRequests.Request request) throws IOException {
|
||||||
|
LOG.info("Sending statistics: " + url);
|
||||||
|
try {
|
||||||
|
JDOMUtil.load(request.getInputStream());
|
||||||
|
}
|
||||||
|
catch (JDOMException e) {
|
||||||
|
LOG.warn(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
LOG.warn(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, application);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,8 +22,10 @@ import com.intellij.codeInsight.lookup.Lookup;
|
|||||||
import com.intellij.codeInsight.lookup.LookupManager;
|
import com.intellij.codeInsight.lookup.LookupManager;
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
|
import com.intellij.openapi.editor.actionSystem.ActionPlan;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||||
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
|
||||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ import javax.swing.*;
|
|||||||
*
|
*
|
||||||
* IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}.
|
* IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}.
|
||||||
*/
|
*/
|
||||||
public class VimTypedActionHandler implements TypedActionHandler {
|
public class VimTypedActionHandler implements TypedActionHandlerEx {
|
||||||
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
|
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
|
||||||
|
|
||||||
private final TypedActionHandler origHandler;
|
private final TypedActionHandler origHandler;
|
||||||
@@ -46,21 +48,28 @@ public class VimTypedActionHandler implements TypedActionHandler {
|
|||||||
handler.setOriginalHandler(origHandler);
|
handler.setOriginalHandler(origHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
|
||||||
|
if (isEnabled(editor)) {
|
||||||
|
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TypedActionHandler originalHandler = KeyHandler.getInstance().getOriginalHandler();
|
||||||
|
if (originalHandler instanceof TypedActionHandlerEx) {
|
||||||
|
((TypedActionHandlerEx)originalHandler).beforeExecute(editor, charTyped, context, plan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
|
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
|
||||||
if (isEnabled(editor)) {
|
if (isEnabled(editor)) {
|
||||||
// Run key handler outside of the key typed command for creating our own undoable commands
|
try {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
||||||
@Override
|
}
|
||||||
public void run() {
|
catch (Throwable e) {
|
||||||
try {
|
logger.error(e);
|
||||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
}
|
||||||
}
|
|
||||||
catch (Throwable e) {
|
|
||||||
logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
origHandler.execute(editor, charTyped, context);
|
origHandler.execute(editor, charTyped, context);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
// TODO: Cannot find the corresponding Vim command. Remove it?
|
||||||
public class ResetModeAction extends EditorAction {
|
public class ResetModeAction extends EditorAction {
|
||||||
public ResetModeAction() {
|
public ResetModeAction() {
|
||||||
super(new EditorActionHandler() {
|
super(new EditorActionHandler() {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -63,7 +63,7 @@ public abstract class VimCommandAction extends EditorAction {
|
|||||||
*
|
*
|
||||||
* These legacy flags will be refactored in future releases.
|
* These legacy flags will be refactored in future releases.
|
||||||
*
|
*
|
||||||
* @see {@link Command}.
|
* @see com.maddyhome.idea.vim.command.Command
|
||||||
*/
|
*/
|
||||||
public int getFlags() {
|
public int getFlags() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,6 +26,8 @@ import com.intellij.notification.NotificationType;
|
|||||||
import com.intellij.openapi.actionSystem.*;
|
import com.intellij.openapi.actionSystem.*;
|
||||||
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.keymap.KeymapUtil;
|
import com.intellij.openapi.keymap.KeymapUtil;
|
||||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||||
import com.intellij.openapi.project.DumbAware;
|
import com.intellij.openapi.project.DumbAware;
|
||||||
@@ -38,6 +40,7 @@ import com.maddyhome.idea.vim.helper.EditorData;
|
|||||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||||
import com.maddyhome.idea.vim.key.ShortcutOwner;
|
import com.maddyhome.idea.vim.key.ShortcutOwner;
|
||||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
||||||
|
import one.util.streamex.StreamEx;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -86,6 +89,7 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
private static final Logger ourLogger = Logger.getInstance(VimShortcutKeyAction.class.getName());
|
private static final Logger ourLogger = Logger.getInstance(VimShortcutKeyAction.class.getName());
|
||||||
|
private static AnAction ourInstance = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||||
@@ -97,18 +101,12 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
|||||||
notifyAboutShortcutConflict(keyStroke);
|
notifyAboutShortcutConflict(keyStroke);
|
||||||
}
|
}
|
||||||
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
|
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
|
||||||
// Run key handler later to restore input events sequence due to VimTypedActionHandler
|
try {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
|
||||||
@Override
|
}
|
||||||
public void run() {
|
catch (Throwable throwable) {
|
||||||
try {
|
ourLogger.error(throwable);
|
||||||
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
|
}
|
||||||
}
|
|
||||||
catch (Throwable throwable) {
|
|
||||||
ourLogger.error(throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +117,11 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static AnAction getInstance() {
|
public static AnAction getInstance() {
|
||||||
return ActionManager.getInstance().getAction(ACTION_ID);
|
if (ourInstance == null) {
|
||||||
|
final AnAction originalAction = ActionManager.getInstance().getAction(ACTION_ID);
|
||||||
|
ourInstance = EmptyAction.wrap(originalAction);
|
||||||
|
}
|
||||||
|
return ourInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) {
|
private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) {
|
||||||
@@ -159,6 +161,9 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
|||||||
if (LookupManager.getActiveLookup(editor) != null) {
|
if (LookupManager.getActiveLookup(editor) != null) {
|
||||||
return isExitInsertMode(keyStroke);
|
return isExitInsertMode(keyStroke);
|
||||||
}
|
}
|
||||||
|
if (keyCode == VK_ESCAPE) {
|
||||||
|
return isEnabledForEscape(editor);
|
||||||
|
}
|
||||||
if (CommandState.inInsertMode(editor)) {
|
if (CommandState.inInsertMode(editor)) {
|
||||||
// XXX: <Tab> won't be recorded in macros
|
// XXX: <Tab> won't be recorded in macros
|
||||||
if (keyCode == VK_TAB) {
|
if (keyCode == VK_TAB) {
|
||||||
@@ -191,6 +196,22 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isEnabledForEscape(@NotNull Editor editor) {
|
||||||
|
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
|
||||||
|
return isPrimaryEditor(editor) || (EditorData.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the editor is a primary editor in the main editing area.
|
||||||
|
*/
|
||||||
|
private boolean isPrimaryEditor(@NotNull Editor editor) {
|
||||||
|
final Project project = editor.getProject();
|
||||||
|
if (project == null) return false;
|
||||||
|
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
|
||||||
|
return StreamEx.of(fileEditorManager.getAllEditors())
|
||||||
|
.anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor)));
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) {
|
private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) {
|
||||||
for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) {
|
for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) {
|
||||||
// XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux
|
// XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux
|
||||||
|
99
src/com/maddyhome/idea/vim/action/change/OperatorAction.java
Normal file
99
src/com/maddyhome/idea/vim/action/change/OperatorAction.java
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2016 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.maddyhome.idea.vim.action.change;
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.maddyhome.idea.vim.KeyHandler;
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
|
import com.maddyhome.idea.vim.command.*;
|
||||||
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.group.MotionGroup;
|
||||||
|
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||||
|
import com.maddyhome.idea.vim.helper.MessageHelper;
|
||||||
|
import com.maddyhome.idea.vim.key.OperatorFunction;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author vlan
|
||||||
|
*/
|
||||||
|
public class OperatorAction extends VimCommandAction {
|
||||||
|
protected OperatorAction() {
|
||||||
|
super(new EditorActionHandlerBase() {
|
||||||
|
@Override
|
||||||
|
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||||
|
final OperatorFunction operatorFunction = VimPlugin.getKey().getOperatorFunction();
|
||||||
|
if (operatorFunction != null) {
|
||||||
|
final Argument argument = cmd.getArgument();
|
||||||
|
if (argument != null) {
|
||||||
|
final Command motion = argument.getMotion();
|
||||||
|
if (motion != null) {
|
||||||
|
final TextRange range = MotionGroup
|
||||||
|
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(),
|
||||||
|
cmd.getRawCount(), argument, true);
|
||||||
|
if (range != null) {
|
||||||
|
VimPlugin.getMark().setChangeMarks(editor, range);
|
||||||
|
final SelectionType selectionType = SelectionType.fromCommandFlags(motion.getFlags());
|
||||||
|
KeyHandler.getInstance().reset(editor);
|
||||||
|
return operatorFunction.apply(editor, context, selectionType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
VimPlugin.showMessage(MessageHelper.message("E774"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Set<MappingMode> getMappingModes() {
|
||||||
|
return MappingMode.N;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Set<List<KeyStroke>> getKeyStrokesSet() {
|
||||||
|
return parseKeysSet("g@");
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Command.Type getType() {
|
||||||
|
return Command.Type.OTHER_SELF_SYNCHRONIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Argument.Type getArgumentType() {
|
||||||
|
return Argument.Type.MOTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFlags() {
|
||||||
|
return Command.FLAG_OP_PEND;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -41,6 +41,7 @@ public class RepeatChangeAction extends EditorAction {
|
|||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
|
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
|
||||||
CommandState state = CommandState.getInstance(editor);
|
CommandState state = CommandState.getInstance(editor);
|
||||||
Command cmd = state.getLastChangeCommand();
|
Command cmd = state.getLastChangeCommand();
|
||||||
|
|
||||||
if (cmd != null) {
|
if (cmd != null) {
|
||||||
if (command.getRawCount() > 0) {
|
if (command.getRawCount() > 0) {
|
||||||
cmd.setCount(command.getCount());
|
cmd.setCount(command.getCount());
|
||||||
@@ -53,6 +54,9 @@ public class RepeatChangeAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Command save = state.getCommand();
|
Command save = state.getCommand();
|
||||||
|
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
|
||||||
|
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
|
||||||
|
|
||||||
state.setCommand(cmd);
|
state.setCommand(cmd);
|
||||||
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
|
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
|
||||||
char reg = VimPlugin.getRegister().getCurrentRegister();
|
char reg = VimPlugin.getRegister().getCurrentRegister();
|
||||||
@@ -67,6 +71,7 @@ public class RepeatChangeAction extends EditorAction {
|
|||||||
if (save != null) {
|
if (save != null) {
|
||||||
state.setCommand(save);
|
state.setCommand(save);
|
||||||
}
|
}
|
||||||
|
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
|
||||||
state.saveLastChangeCommand(cmd);
|
state.saveLastChangeCommand(cmd);
|
||||||
VimPlugin.getRegister().selectRegister(reg);
|
VimPlugin.getRegister().selectRegister(reg);
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,14 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -37,13 +39,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class AutoIndentLinesVisualAction extends VimCommandAction {
|
public class AutoIndentLinesVisualAction extends VimCommandAction {
|
||||||
public AutoIndentLinesVisualAction() {
|
public AutoIndentLinesVisualAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean execute(@NotNull Editor editor,
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
@NotNull DataContext context,
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
@NotNull Command cmd,
|
VimPlugin.getChange().autoIndentRange(editor, caret, context, range);
|
||||||
@NotNull TextRange range) {
|
|
||||||
VimPlugin.getChange().autoIndentLines(context);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -36,10 +38,16 @@ public class ChangeCaseLowerMotionAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
return argument != null &&
|
return argument != null &&
|
||||||
VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount, CharacterHelper.CASE_LOWER,
|
VimPlugin.getChange()
|
||||||
argument);
|
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
@@ -26,6 +27,7 @@ import com.maddyhome.idea.vim.action.VimCommandAction;
|
|||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -39,11 +41,12 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class ChangeCaseLowerVisualAction extends VimCommandAction {
|
public class ChangeCaseLowerVisualAction extends VimCommandAction {
|
||||||
public ChangeCaseLowerVisualAction() {
|
public ChangeCaseLowerVisualAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
|
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
|
||||||
return VimPlugin.getChange().changeCaseRange(topLevelEditor, range, CharacterHelper.CASE_LOWER);
|
return VimPlugin.getChange().changeCaseRange(topLevelEditor, caret, range, CharacterHelper.CASE_LOWER);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeCaseToggleCharacterAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().changeCaseToggleCharacter(editor, count);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -36,9 +38,16 @@ public class ChangeCaseToggleMotionAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount,
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
CharacterHelper.CASE_TOGGLE, argument);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange()
|
||||||
|
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,14 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -38,10 +40,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class ChangeCaseToggleVisualAction extends VimCommandAction {
|
public class ChangeCaseToggleVisualAction extends VimCommandAction {
|
||||||
public ChangeCaseToggleVisualAction() {
|
public ChangeCaseToggleVisualAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_TOGGLE);
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
|
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_TOGGLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -36,9 +38,15 @@ public class ChangeCaseUpperMotionAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount,
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
CharacterHelper.CASE_UPPER, argument);
|
}
|
||||||
|
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange()
|
||||||
|
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_UPPER, argument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,14 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -38,10 +40,10 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class ChangeCaseUpperVisualAction extends VimCommandAction {
|
public class ChangeCaseUpperVisualAction extends VimCommandAction {
|
||||||
public ChangeCaseUpperVisualAction() {
|
public ChangeCaseUpperVisualAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
@NotNull TextRange range) {
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_UPPER);
|
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_UPPER);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeCharacterAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return argument != null && VimPlugin.getChange().changeCharacter(editor, count, argument.getCharacter());
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return argument != null && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.getCharacter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeCharactersAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().changeCharacters(editor, context, count);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().changeCharacters(editor, caret, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeEndOfLineAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().changeEndOfLine(editor, context, count);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().changeEndOfLine(editor, caret, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -38,8 +38,8 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
|
|||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||||
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
|
final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
|
||||||
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/&");
|
return VimPlugin.getSearch().searchAndReplace(editor, editor.getCaretModel().getPrimaryCaret(), range, "s", "//~/&");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
@@ -36,10 +37,17 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
|
||||||
int line = editor.getCaretModel().getLogicalPosition().line;
|
@Nullable Argument argument) {
|
||||||
LineRange range = new LineRange(line, line);
|
boolean result = true;
|
||||||
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/");
|
for (Caret caret : editor.getCaretModel().getAllCarets()) {
|
||||||
|
final int line = caret.getLogicalPosition().line;
|
||||||
|
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, new LineRange(line, line), "s", "//~/")) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class ChangeLineAction extends EditorAction {
|
public class ChangeLineAction extends EditorAction {
|
||||||
public ChangeLineAction() {
|
public ChangeLineAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull Caret caret,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
@NotNull DataContext context,
|
||||||
return VimPlugin.getChange().changeLine(editor, context, count);
|
int count,
|
||||||
}
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().changeLine(editor, caret, count);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeMotionAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return argument != null && VimPlugin.getChange().changeMotion(editor, context, count, rawCount, argument);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return argument != null && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeNumberDecAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().changeNumber(editor, -count);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().changeNumber(editor, caret, -count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class ChangeNumberIncAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().changeNumber(editor, count);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().changeNumber(editor, caret, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,12 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class ChangeReplaceAction extends EditorAction {
|
public class ChangeReplaceAction extends EditorAction {
|
||||||
public ChangeReplaceAction() {
|
public ChangeReplaceAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
int count,
|
||||||
return VimPlugin.getChange().changeReplace(editor, context);
|
int rawCount,
|
||||||
}
|
@Nullable Argument argument) {
|
||||||
|
VimPlugin.getChange().changeReplace(editor, context);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
@@ -26,7 +27,9 @@ import com.maddyhome.idea.vim.command.Command;
|
|||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
import com.maddyhome.idea.vim.command.SelectionType;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorData;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -38,11 +41,14 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class ChangeVisualAction extends VimCommandAction {
|
public class ChangeVisualAction extends VimCommandAction {
|
||||||
public ChangeVisualAction() {
|
public ChangeVisualAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
final SelectionType type = range.isMultiple() ? SelectionType.BLOCK_WISE : SelectionType.CHARACTER_WISE;
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
return VimPlugin.getChange().changeRange(editor, context, range, type);
|
final SelectionType type = EditorData.wasVisualBlockMode(editor) && range.isMultiple()
|
||||||
|
? SelectionType.BLOCK_WISE
|
||||||
|
: SelectionType.CHARACTER_WISE;
|
||||||
|
return VimPlugin.getChange().changeRange(editor, caret, range, type);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
@@ -26,6 +27,7 @@ import com.maddyhome.idea.vim.command.Command;
|
|||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
import com.maddyhome.idea.vim.command.SelectionType;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -39,12 +41,13 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class ChangeVisualLinesAction extends VimCommandAction {
|
public class ChangeVisualLinesAction extends VimCommandAction {
|
||||||
public ChangeVisualLinesAction() {
|
public ChangeVisualLinesAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||||
return VimPlugin.getChange().changeRange(editor, context, lineRange, SelectionType.LINE_WISE);
|
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.change;
|
package com.maddyhome.idea.vim.action.change.change;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
@@ -26,7 +27,9 @@ import com.maddyhome.idea.vim.command.Command;
|
|||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
import com.maddyhome.idea.vim.command.SelectionType;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorData;
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -39,10 +42,10 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class ChangeVisualLinesEndAction extends VimCommandAction {
|
public class ChangeVisualLinesEndAction extends VimCommandAction {
|
||||||
public ChangeVisualLinesEndAction() {
|
public ChangeVisualLinesEndAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
@NotNull TextRange range) {
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
if (range.isMultiple()) {
|
if (EditorData.wasVisualBlockMode(editor) && range.isMultiple()) {
|
||||||
final int[] starts = range.getStartOffsets();
|
final int[] starts = range.getStartOffsets();
|
||||||
final int[] ends = range.getEndOffsets();
|
final int[] ends = range.getEndOffsets();
|
||||||
for (int i = 0; i < starts.length; i++) {
|
for (int i = 0; i < starts.length; i++) {
|
||||||
@@ -51,12 +54,12 @@ public class ChangeVisualLinesEndAction extends VimCommandAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final TextRange blockRange = new TextRange(starts, ends);
|
final TextRange blockRange = new TextRange(starts, ends);
|
||||||
return VimPlugin.getChange().changeRange(editor, context, blockRange, SelectionType.BLOCK_WISE);
|
return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||||
return VimPlugin.getChange().changeRange(editor, context, lineRange, SelectionType.LINE_WISE);
|
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -43,7 +43,9 @@ public class FilterMotionAction extends EditorAction {
|
|||||||
if (argument == null) {
|
if (argument == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(), argument, false);
|
TextRange range = MotionGroup
|
||||||
|
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(), cmd.getRawCount(),
|
||||||
|
argument, false);
|
||||||
if (range == null) {
|
if (range == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -52,7 +54,7 @@ public class FilterMotionAction extends EditorAction {
|
|||||||
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
|
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
|
||||||
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
|
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
|
||||||
if (current.line != start.line) {
|
if (current.line != start.line) {
|
||||||
MotionGroup.moveCaret(editor, range.getStartOffset());
|
MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), range.getStartOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class DeleteCharacterAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().deleteCharacter(editor, 1, false);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().deleteCharacter(editor, caret, 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class DeleteCharacterLeftAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().deleteCharacter(editor, -count, false);
|
super(true, CaretOrder.INCREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class DeleteCharacterRightAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().deleteCharacter(editor, count, false);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().deleteCharacter(editor, caret, count, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,14 @@ public class DeleteEndOfLineAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().deleteEndOfLine(editor, count);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().deleteEndOfLine(editor, caret, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,12 +37,18 @@ public class DeleteJoinLinesAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
if (editor.isOneLineMode()) {
|
if (editor.isOneLineMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VimPlugin.getChange().deleteJoinLines(editor, count, false);
|
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,12 +37,18 @@ public class DeleteJoinLinesSpacesAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
if (editor.isOneLineMode()) {
|
if (editor.isOneLineMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VimPlugin.getChange().deleteJoinLines(editor, count, true);
|
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,13 +19,16 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorData;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -37,10 +40,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class DeleteJoinVisualLinesAction extends VimCommandAction {
|
public class DeleteJoinVisualLinesAction extends VimCommandAction {
|
||||||
public DeleteJoinVisualLinesAction() {
|
public DeleteJoinVisualLinesAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, false);
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
|
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,13 +19,16 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
|
import com.maddyhome.idea.vim.helper.EditorData;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -37,10 +40,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
|
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
|
||||||
public DeleteJoinVisualLinesSpacesAction() {
|
public DeleteJoinVisualLinesSpacesAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, true);
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
|
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class DeleteLineAction extends EditorAction {
|
public class DeleteLineAction extends EditorAction {
|
||||||
public DeleteLineAction() {
|
public DeleteLineAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull Caret caret,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
@NotNull DataContext context,
|
||||||
return VimPlugin.getChange().deleteLine(editor, count);
|
int count,
|
||||||
}
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().deleteLine(editor, caret, count);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -35,8 +37,15 @@ public class DeleteMotionAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public Handler() {
|
||||||
return argument != null && VimPlugin.getChange().deleteMotion(editor, context, count, rawCount, argument, false);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return argument != null &&
|
||||||
|
VimPlugin.getChange().deleteMotion(editor, caret, context, count, rawCount, argument, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
@@ -27,6 +28,7 @@ import com.maddyhome.idea.vim.command.CommandState;
|
|||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
import com.maddyhome.idea.vim.command.SelectionType;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -40,17 +42,18 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class DeleteVisualAction extends VimCommandAction {
|
public class DeleteVisualAction extends VimCommandAction {
|
||||||
public DeleteVisualAction() {
|
public DeleteVisualAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
|
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
|
||||||
if (mode == CommandState.SubMode.VISUAL_LINE) {
|
if (mode == CommandState.SubMode.VISUAL_LINE) {
|
||||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||||
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.fromSubMode(mode), false);
|
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.fromSubMode(mode), false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false);
|
return VimPlugin.getChange().deleteRange(editor, caret, range, SelectionType.fromSubMode(mode), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
@@ -27,6 +28,7 @@ import com.maddyhome.idea.vim.command.CommandState;
|
|||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
import com.maddyhome.idea.vim.command.SelectionType;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -40,17 +42,20 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class DeleteVisualLinesAction extends VimCommandAction {
|
public class DeleteVisualLinesAction extends VimCommandAction {
|
||||||
public DeleteVisualLinesAction() {
|
public DeleteVisualLinesAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
|
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
|
||||||
if (mode == CommandState.SubMode.VISUAL_BLOCK) {
|
if (mode == CommandState.SubMode.VISUAL_BLOCK) {
|
||||||
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false);
|
return VimPlugin.getChange()
|
||||||
|
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), range, SelectionType.fromSubMode(mode),
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||||
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.LINE_WISE, false);
|
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,13 +19,16 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.delete;
|
package com.maddyhome.idea.vim.action.change.delete;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
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.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
|
import com.maddyhome.idea.vim.command.CommandState;
|
||||||
import com.maddyhome.idea.vim.command.MappingMode;
|
import com.maddyhome.idea.vim.command.MappingMode;
|
||||||
import com.maddyhome.idea.vim.command.SelectionType;
|
import com.maddyhome.idea.vim.command.SelectionType;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -39,10 +42,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class DeleteVisualLinesEndAction extends VimCommandAction {
|
public class DeleteVisualLinesEndAction extends VimCommandAction {
|
||||||
public DeleteVisualLinesEndAction() {
|
public DeleteVisualLinesEndAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
@NotNull TextRange range) {
|
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||||
if (range.isMultiple()) {
|
@NotNull Command cmd, @NotNull TextRange range) {
|
||||||
|
if (CommandState.inVisualBlockMode(editor)) {
|
||||||
final int[] starts = range.getStartOffsets();
|
final int[] starts = range.getStartOffsets();
|
||||||
final int[] ends = range.getEndOffsets();
|
final int[] ends = range.getEndOffsets();
|
||||||
for (int i = 0; i < starts.length; i++) {
|
for (int i = 0; i < starts.length; i++) {
|
||||||
@@ -51,12 +55,13 @@ public class DeleteVisualLinesEndAction extends VimCommandAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final TextRange blockRange = new TextRange(starts, ends);
|
final TextRange blockRange = new TextRange(starts, ends);
|
||||||
return VimPlugin.getChange().deleteRange(editor, blockRange, SelectionType.BLOCK_WISE, false);
|
return VimPlugin.getChange()
|
||||||
|
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), blockRange, SelectionType.BLOCK_WISE, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||||
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.LINE_WISE, false);
|
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class InsertAfterCursorAction extends EditorAction {
|
public class InsertAfterCursorAction extends EditorAction {
|
||||||
public InsertAfterCursorAction() {
|
public InsertAfterCursorAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
int count,
|
||||||
VimPlugin.getChange().insertAfterCursor(editor, context);
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
return true;
|
VimPlugin.getChange().insertAfterCursor(editor, context);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class InsertAfterLineEndAction extends EditorAction {
|
public class InsertAfterLineEndAction extends EditorAction {
|
||||||
public InsertAfterLineEndAction() {
|
public InsertAfterLineEndAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
int count,
|
||||||
VimPlugin.getChange().insertAfterLineEnd(editor, context);
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
return true;
|
VimPlugin.getChange().insertAfterLineEnd(editor, context);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class InsertAtPreviousInsertAction extends EditorAction {
|
public class InsertAtPreviousInsertAction extends EditorAction {
|
||||||
public InsertAtPreviousInsertAction() {
|
public InsertAtPreviousInsertAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
int count,
|
||||||
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
return true;
|
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class InsertBeforeFirstNonBlankAction extends EditorAction {
|
public class InsertBeforeFirstNonBlankAction extends EditorAction {
|
||||||
public InsertBeforeFirstNonBlankAction() {
|
public InsertBeforeFirstNonBlankAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
int count,
|
||||||
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
return true;
|
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,15 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.insert;
|
package com.maddyhome.idea.vim.action.change.insert;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.Argument;
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@@ -33,13 +36,19 @@ public class InsertCharacterAboveCursorAction extends EditorAction {
|
|||||||
super(new Handler());
|
super(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends EditorActionHandlerBase {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
public Handler() {
|
||||||
|
super(true, CaretOrder.INCREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
if (editor.isOneLineMode()) {
|
if (editor.isOneLineMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, -1);
|
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,15 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.insert;
|
package com.maddyhome.idea.vim.action.change.insert;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.Argument;
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@@ -33,13 +36,19 @@ public class InsertCharacterBelowCursorAction extends EditorAction {
|
|||||||
super(new Handler());
|
super(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends EditorActionHandlerBase {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
public Handler() {
|
||||||
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
if (editor.isOneLineMode()) {
|
if (editor.isOneLineMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, 1);
|
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,17 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.insert;
|
package com.maddyhome.idea.vim.action.change.insert;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@@ -33,9 +38,15 @@ public class InsertDeleteInsertedTextAction extends EditorAction {
|
|||||||
super(new Handler());
|
super(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends EditorActionHandlerBase {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().insertDeleteInsertedText(editor);
|
super(true, CaretOrder.INCREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().insertDeleteInsertedText(editor, caret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,12 +19,17 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.insert;
|
package com.maddyhome.idea.vim.action.change.insert;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@@ -33,9 +38,15 @@ public class InsertDeletePreviousWordAction extends EditorAction {
|
|||||||
super(new Handler());
|
super(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends EditorActionHandlerBase {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
public Handler() {
|
||||||
return VimPlugin.getChange().insertDeletePreviousWord(editor);
|
super(true, CaretOrder.DECREASING_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
return VimPlugin.getChange().insertDeletePreviousWord(editor, caret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,6 @@ package com.maddyhome.idea.vim.action.change.insert;
|
|||||||
import com.intellij.openapi.actionSystem.ActionManager;
|
import com.intellij.openapi.actionSystem.ActionManager;
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||||
import com.maddyhome.idea.vim.command.Command;
|
import com.maddyhome.idea.vim.command.Command;
|
||||||
@@ -36,15 +35,16 @@ import java.util.Set;
|
|||||||
public class InsertExitModeAction extends VimCommandAction {
|
public class InsertExitModeAction extends VimCommandAction {
|
||||||
private static final String ACTION_ID = "VimInsertExitMode";
|
private static final String ACTION_ID = "VimInsertExitMode";
|
||||||
|
|
||||||
public InsertExitModeAction() {
|
protected InsertExitModeAction() {
|
||||||
super(new EditorActionHandlerBase() {
|
super(new EditorActionHandlerBase() {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
@Override
|
||||||
VimPlugin.getChange().processEscape(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||||
|
VimPlugin.getChange().processEscape(editor, context);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<MappingMode> getMappingModes() {
|
public Set<MappingMode> getMappingModes() {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class InsertLineStartAction extends EditorAction {
|
public class InsertLineStartAction extends EditorAction {
|
||||||
public InsertLineStartAction() {
|
public InsertLineStartAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
int count,
|
||||||
VimPlugin.getChange().insertLineStart(editor, context);
|
int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
return true;
|
VimPlugin.getChange().insertLineStart(editor, context);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,7 +35,8 @@ public class InsertNewLineBelowAction extends EditorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
private static class Handler extends ChangeEditorActionHandler {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
|
||||||
|
@Nullable Argument argument) {
|
||||||
if (editor.isOneLineMode()) {
|
if (editor.isOneLineMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
|
|||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
|
||||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
|
import com.maddyhome.idea.vim.command.Argument;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class InsertPreviousInsertAction extends EditorAction {
|
public class InsertPreviousInsertAction extends EditorAction {
|
||||||
public InsertPreviousInsertAction() {
|
public InsertPreviousInsertAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends EditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
int count,
|
||||||
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, false);
|
int rawCount,
|
||||||
}
|
@Nullable Argument argument) {
|
||||||
|
VimPlugin.getChange().insertPreviousInsert(editor, context, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
|
|||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
|
||||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
|
import com.maddyhome.idea.vim.command.Argument;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class InsertPreviousInsertExitAction extends EditorAction {
|
public class InsertPreviousInsertExitAction extends EditorAction {
|
||||||
public InsertPreviousInsertExitAction() {
|
public InsertPreviousInsertExitAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler() {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor,
|
||||||
private static class Handler extends EditorActionHandler {
|
@NotNull DataContext context,
|
||||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
int count,
|
||||||
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, true);
|
int rawCount,
|
||||||
}
|
@Nullable Argument argument) {
|
||||||
|
VimPlugin.getChange().insertPreviousInsert(editor, context, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -38,9 +38,12 @@ import java.util.Set;
|
|||||||
public class VisualBlockAppendAction extends VimCommandAction {
|
public class VisualBlockAppendAction extends VimCommandAction {
|
||||||
public VisualBlockAppendAction() {
|
public VisualBlockAppendAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler() {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
protected boolean execute(@NotNull Editor editor,
|
||||||
|
@NotNull DataContext context,
|
||||||
|
@NotNull Command cmd,
|
||||||
@NotNull TextRange range) {
|
@NotNull TextRange range) {
|
||||||
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, true);
|
if (editor.isOneLineMode()) return false;
|
||||||
|
return VimPlugin.getChange().blockInsert(editor, context, range, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -38,9 +38,13 @@ import java.util.Set;
|
|||||||
public class VisualBlockInsertAction extends VimCommandAction {
|
public class VisualBlockInsertAction extends VimCommandAction {
|
||||||
public VisualBlockInsertAction() {
|
public VisualBlockInsertAction() {
|
||||||
super(new VisualOperatorActionHandler() {
|
super(new VisualOperatorActionHandler() {
|
||||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
@Override
|
||||||
|
protected boolean execute(@NotNull Editor editor,
|
||||||
|
@NotNull DataContext context,
|
||||||
|
@NotNull Command cmd,
|
||||||
@NotNull TextRange range) {
|
@NotNull TextRange range) {
|
||||||
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, false);
|
if (editor.isOneLineMode()) return false;
|
||||||
|
return VimPlugin.getChange().blockInsert(editor, context, range, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
* Copyright (C) 2003-2014 The IdeaVim authors
|
* Copyright (C) 2003-2016 The IdeaVim authors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +19,12 @@
|
|||||||
package com.maddyhome.idea.vim.action.change.shift;
|
package com.maddyhome.idea.vim.action.change.shift;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
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.handler.CaretOrder;
|
||||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -30,14 +32,14 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class AutoIndentLinesAction extends EditorAction {
|
public class AutoIndentLinesAction extends EditorAction {
|
||||||
public AutoIndentLinesAction() {
|
protected AutoIndentLinesAction() {
|
||||||
super(new Handler());
|
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
}
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
private static class Handler extends ChangeEditorActionHandler {
|
int rawCount, @Nullable Argument argument) {
|
||||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
VimPlugin.getChange().autoIndentLines(editor, caret, context, count);
|
||||||
VimPlugin.getChange().autoIndentLines(context);
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.maddyhome.idea.vim.action.change.shift;
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.editor.Caret;
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
|
import com.maddyhome.idea.vim.command.Argument;
|
||||||
|
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||||
|
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aleksey Lagoshin
|
||||||
|
*/
|
||||||
|
public class AutoIndentMotionAction extends EditorAction {
|
||||||
|
protected AutoIndentMotionAction() {
|
||||||
|
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||||
|
@Override
|
||||||
|
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||||
|
int rawCount, @Nullable Argument argument) {
|
||||||
|
if (argument == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
VimPlugin.getChange().autoIndentMotion(editor, caret, context, count, rawCount, argument);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user