mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
377 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
132f52785c | ||
![]() |
c556ec2001 | ||
![]() |
d49683ab2f | ||
![]() |
810c3cd561 | ||
![]() |
b909157f4b | ||
![]() |
21c1232ba6 | ||
![]() |
ff61a42670 | ||
![]() |
f160d855c0 | ||
![]() |
51685a2094 | ||
![]() |
487c71ec15 | ||
![]() |
39aa60850d | ||
![]() |
872921e6b7 | ||
![]() |
89788df95c | ||
![]() |
6ccd8ed0b8 | ||
![]() |
aa7e3bfa69 | ||
![]() |
00154f2b9f | ||
![]() |
531a9c28ae | ||
![]() |
56c4e3e31f | ||
![]() |
ef2497cadc | ||
![]() |
95f56a8869 | ||
![]() |
f5b1112304 | ||
![]() |
333a5be30b | ||
![]() |
6c9e697892 | ||
![]() |
7663eb531e | ||
![]() |
33499fe945 | ||
![]() |
2882b638e5 | ||
![]() |
5529bf284a | ||
![]() |
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 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,4 +3,4 @@
|
||||
/.idea/
|
||||
/build/
|
||||
/out/
|
||||
/tmp/
|
||||
/tmp/
|
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>
|
15
AUTHORS.md
15
AUTHORS.md
@@ -39,6 +39,21 @@ Contributors:
|
||||
* [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)
|
||||
* [Alex Plate](mailto:alexpl292@gmail.com)
|
||||
* [Matt Ellis](mailto:m.t.ellis@gmail.com)
|
||||
|
||||
If you are a contributor and your name is not listed here, feel free to
|
||||
contact the maintainer.
|
||||
|
76
CHANGES.md
76
CHANGES.md
@@ -16,6 +16,82 @@ 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.51, 2019-02-12
|
||||
----------------
|
||||
|
||||
* [VIM-1558](https://youtrack.jetbrains.com/issue/VIM-1558) Fixed scrolling for code with block inlays in Rider 2018.3
|
||||
* [VIM-1187](https://youtrack.jetbrains.com/issue/VIM-1187) Improved performance of `set relativelinenumber` on large files
|
||||
* [VIM-620](https://youtrack.jetbrains.com/issue/VIM-620) Fixed handling `<C-O>` and `<Esc>` in Insert and Replace modes
|
||||
* [VIM-798](https://youtrack.jetbrains.com/issue/VIM-798) Allow arrow keys for window navigation commands
|
||||
|
||||
|
||||
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
|
||||
----------------
|
||||
|
49
README.md
49
README.md
@@ -1,6 +1,12 @@
|
||||
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>
|
||||
<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.svg?guest=1"/>
|
||||
@@ -9,15 +15,15 @@ IdeaVim
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ15&guest=1">
|
||||
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ15)/statusIcon.svg?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_TestsForIntelliJ20182)/statusIcon.svg?guest=1"/>
|
||||
</a>
|
||||
<span>Tests</span>
|
||||
</div>
|
||||
|
||||
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ platform.
|
||||
IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm,
|
||||
AppCode, CLion, DataGrip and Android Studio.
|
||||
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
|
||||
RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
|
||||
|
||||
Resources:
|
||||
|
||||
@@ -40,8 +46,10 @@ it is unchecked. At this point your IDE will work with its regular keyboard
|
||||
shortcuts.
|
||||
|
||||
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
|
||||
resolved via "File | Settings | Vim Emulation", "File | Settings | Keymap"
|
||||
and key mapping commands in your ~/.ideavimrc file.
|
||||
resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
|
||||
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
|
||||
@@ -84,6 +92,7 @@ Supported:
|
||||
Emulated Vim plugins:
|
||||
|
||||
* vim-surround
|
||||
* vim-multiple-cursors
|
||||
|
||||
Not supported (yet):
|
||||
|
||||
@@ -92,7 +101,7 @@ Not supported (yet):
|
||||
|
||||
See also:
|
||||
|
||||
* [List of recently added commands](src/com/maddyhome/idea/vim/package-info.java)
|
||||
* [The list of all supported commands](src/com/maddyhome/idea/vim/package-info.java)
|
||||
* [Top features and bugs](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
|
||||
|
||||
|
||||
@@ -119,8 +128,8 @@ have `-Duser.home=/my/alternate/home` then IdeaVim will source
|
||||
Emulated Vim Plugins
|
||||
--------------------
|
||||
|
||||
IdeaVim extensions emulate some plugins of the original Vim. In order to use IdeaVim extensions, you have to enable
|
||||
them via this command in your ~/.ideavimrc:
|
||||
IdeaVim extensions 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>
|
||||
|
||||
@@ -129,6 +138,9 @@ 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
|
||||
@@ -188,24 +200,25 @@ in the issue tracker.
|
||||
|
||||
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
|
||||
|
||||
2. Import the project from existing sources in IntelliJ IDEA 15+ (Community or
|
||||
2. Import the project from existing sources in IntelliJ IDEA 2018.1 or newer (Community or
|
||||
Ultimate) using "File | New | Project from Existing Sources..." or "Import
|
||||
Project" from the start window.
|
||||
|
||||
* In the project wizard select "Import project from external model | Gradle"
|
||||
|
||||
* Select your Java 6+ JDK as the Gradle JVM, leave other parameters unchanged
|
||||
* Select your Java 8+ JDK as the Gradle JVM, leave other parameters unchanged
|
||||
|
||||
3. Create a new plugin run configuration using "Run | Edit Configurations | New
|
||||
Gradle Configuration" and run it in order to launch IntelliJ with the
|
||||
compiled version of the IdeaVim plugin.
|
||||
3. Run your IdeaVim plugin within IntelliJ via a Gradle task
|
||||
|
||||
* Select your project as the Gradle project
|
||||
* Select "View | Tool Windows | Gradle" tool window
|
||||
|
||||
* Launch "ideavim | intellij | runIde" from the tool window
|
||||
|
||||
* Enter "runIdea" as the task to run
|
||||
4. Run IdeaVim tests via a Gradle task
|
||||
|
||||
4. Create and run a new configuration for running tests by right-clicking on the
|
||||
"test" folder in the project structure and selecting "Run All Tests".
|
||||
* 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.
|
||||
|
32
build.gradle
32
build.gradle
@@ -1,8 +1,19 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.intellij" version "0.0.39"
|
||||
id 'org.jetbrains.intellij' version '0.3.12'
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
sourceCompatibility = javaVersion
|
||||
targetCompatibility = javaVersion
|
||||
@@ -24,11 +35,20 @@ intellij {
|
||||
pluginName 'IdeaVim'
|
||||
updateSinceUntilBuild false
|
||||
downloadSources Boolean.valueOf(downloadIdeaSources)
|
||||
instrumentCode Boolean.valueOf(instrumentPluginCode)
|
||||
intellijRepo = "https://www.jetbrains.com/intellij-repository"
|
||||
|
||||
publish {
|
||||
pluginId '164'
|
||||
channel publishChannel
|
||||
username publishUsername
|
||||
password publishPassword
|
||||
publishPlugin {
|
||||
channels publishChannels.split(',')
|
||||
username publishUsername
|
||||
password publishPassword
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or set manually in th
|
||||
'history' 'hi' number of command-lines that are remembered
|
||||
'hlsearch' 'hls' highlight matches with last search pattern
|
||||
'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
|
||||
'nrformats' 'nf' number formats recognized for CTRL-A command
|
||||
|
@@ -1,7 +1,9 @@
|
||||
ideaVersion IC-15.0.2
|
||||
ideaVersion IC-2018.3
|
||||
downloadIdeaSources true
|
||||
instrumentPluginCode true
|
||||
version SNAPSHOT
|
||||
javaVersion 1.6
|
||||
javaVersion 1.8
|
||||
kotlinVersion 1.3.11
|
||||
publishUsername username
|
||||
publishPassword password
|
||||
publishChannel eap
|
||||
publishChannels eap
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sat Jan 23 00:00:00 MSK 2016
|
||||
#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-2.8-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
|
||||
|
100
gradlew
vendored
100
gradlew
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@@ -6,42 +6,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# 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
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@@ -60,6 +24,46 @@ 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.
|
||||
@@ -85,7 +89,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
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
|
||||
@@ -150,11 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# 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" "$@"
|
||||
|
14
gradlew.bat
vendored
14
gradlew.bat
vendored
@@ -8,14 +8,14 @@
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@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=
|
||||
|
||||
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
|
||||
|
||||
@@ -46,10 +46,9 @@ echo location of your Java installation.
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@@ -60,11 +59,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
@@ -2,6 +2,32 @@
|
||||
<name>IdeaVim</name>
|
||||
<id>IdeaVIM</id>
|
||||
<change-notes><![CDATA[
|
||||
<p>0.51:</p>
|
||||
<ul>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.50:</p>
|
||||
<ul>
|
||||
<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>
|
||||
<p>0.49:</p>
|
||||
<ul>
|
||||
<li>Enabled zero-latency typing for Vim emulation</li>
|
||||
<li>Support for <code>iskeyword</code> option</li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.48:</p>
|
||||
<ul>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.47:</p>
|
||||
<ul>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.46:</p>
|
||||
<ul>
|
||||
<li>Support for <code>incsearch</code> option for showing search results while typing</li>
|
||||
@@ -10,50 +36,6 @@
|
||||
<li>Support for <code>={motion}</code> formatting command</li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.44:</p>
|
||||
<ul>
|
||||
<li>Fixed typing keys in completion menus and typing with the plugin disabled</li>
|
||||
</ul>
|
||||
<p>0.43:</p>
|
||||
<ul>
|
||||
<li>Fixed running the plugin with Java 6</li>
|
||||
</ul>
|
||||
<p>0.42:</p>
|
||||
<ul>
|
||||
<li>Fixed move commands in read-only files</li>
|
||||
</ul>
|
||||
<p>0.41:</p>
|
||||
<ul>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.40:</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>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.38:</p>
|
||||
<ul>
|
||||
<li>Support for <code>:action</code> and <code>:actionlist</code> for executing arbitrary IDE actions</li>
|
||||
<li>Support for <code>number</code> and <code>relativenumber</code> options</li>
|
||||
<li>Support for <code>clipboard=unnamed</code> option</li>
|
||||
<li>Various bug fixes</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>
|
||||
</ul>
|
||||
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
|
||||
]]></change-notes>
|
||||
<description><![CDATA[
|
||||
@@ -68,7 +50,7 @@
|
||||
<version>SNAPSHOT</version>
|
||||
<vendor>JetBrains</vendor>
|
||||
|
||||
<idea-version since-build="143.0"/>
|
||||
<idea-version since-build="183.2940.10"/>
|
||||
|
||||
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
|
||||
<depends>com.intellij.modules.lang</depends>
|
||||
@@ -85,11 +67,12 @@
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<applicationConfigurable instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
||||
<applicationConfigurable groupId="editor" 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>
|
||||
|
||||
<actions>
|
||||
@@ -373,6 +356,9 @@
|
||||
<action id="VimRedo" class="com.maddyhome.idea.vim.action.change.RedoAction" text="Redo"/>
|
||||
<action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/>
|
||||
|
||||
<!-- Internal -->
|
||||
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Vim (internal) add test inlays" internal="true"/>
|
||||
|
||||
<!-- Keys -->
|
||||
<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"/>
|
||||
|
@@ -24,8 +24,10 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.ActionPlan;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
@@ -35,15 +37,16 @@ import com.maddyhome.idea.vim.command.CommandState;
|
||||
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.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.option.Options;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -92,6 +95,26 @@ public class KeyHandler {
|
||||
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
|
||||
* processing.
|
||||
@@ -241,15 +264,15 @@ public class KeyHandler {
|
||||
if (mapping.isPrefix(fromKeys)) {
|
||||
mappingKeys.add(key);
|
||||
if (!application.isUnitTestMode() && Options.getInstance().isSet(Options.TIMEOUT)) {
|
||||
commandState.startMappingTimer(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
mappingKeys.clear();
|
||||
for (KeyStroke keyStroke : fromKeys) {
|
||||
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
|
||||
}
|
||||
commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
|
||||
mappingKeys.clear();
|
||||
if (editor.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
for (KeyStroke keyStroke : fromKeys) {
|
||||
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
|
||||
}
|
||||
}, ModalityState.stateForComponent(editor.getComponent())));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -274,12 +297,11 @@ public class KeyHandler {
|
||||
}
|
||||
}
|
||||
else if (extensionHandler != null) {
|
||||
RunnableHelper.runWriteCommand(editor.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
extensionHandler.execute(editor, context);
|
||||
}
|
||||
}, "Vim " + extensionHandler.getClass().getSimpleName(), 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);
|
||||
@@ -447,23 +469,25 @@ public class KeyHandler {
|
||||
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
|
||||
|
||||
Project project = editor.getProject();
|
||||
if (cmd.getType().isRead() || project == null || EditorHelper.canEdit(project, 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 (cmd.getType().isWrite()) {
|
||||
RunnableHelper.runWriteCommand(project, action, name, action);
|
||||
}
|
||||
else {
|
||||
RunnableHelper.runReadCommand(project, action, name, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
final Command.Type type = cmd.getType();
|
||||
if (type.isWrite() && !editor.getDocument().isWritable()) {
|
||||
VimPlugin.indicateError();
|
||||
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,
|
||||
|
@@ -515,10 +515,10 @@ public class RegisterActions {
|
||||
new Shortcut("gp"));
|
||||
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
|
||||
new Shortcut("[P"),
|
||||
new Shortcut("]P")
|
||||
new Shortcut("]P"),
|
||||
new Shortcut("[p")
|
||||
});
|
||||
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
|
||||
new Shortcut("[p"),
|
||||
new Shortcut("]p")
|
||||
});
|
||||
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY,
|
||||
@@ -614,9 +614,9 @@ public class RegisterActions {
|
||||
new Shortcut("@:"));
|
||||
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY,
|
||||
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)));
|
||||
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(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
|
||||
});
|
||||
|
@@ -80,9 +80,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
@State(
|
||||
name = "VimSettings",
|
||||
storages = {@Storage(
|
||||
id = "main",
|
||||
file = "$APP_CONFIG$/vim_settings.xml")})
|
||||
storages = {@Storage(file = "$APP_CONFIG$/vim_settings.xml")})
|
||||
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
|
||||
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
|
||||
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
|
||||
|
@@ -22,8 +22,10 @@ import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.actionSystem.ActionPlan;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
|
||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||
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}.
|
||||
*/
|
||||
public class VimTypedActionHandler implements TypedActionHandler {
|
||||
public class VimTypedActionHandler implements TypedActionHandlerEx {
|
||||
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
|
||||
|
||||
private final TypedActionHandler origHandler;
|
||||
@@ -46,21 +48,28 @@ public class VimTypedActionHandler implements TypedActionHandler {
|
||||
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
|
||||
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
|
||||
if (isEnabled(editor)) {
|
||||
// Run key handler outside of the key typed command for creating our own undoable commands
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
try {
|
||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
origHandler.execute(editor, charTyped, context);
|
||||
|
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
// TODO: Cannot find the corresponding Vim command. Remove it?
|
||||
public class ResetModeAction extends EditorAction {
|
||||
public ResetModeAction() {
|
||||
super(new EditorActionHandler() {
|
||||
|
@@ -63,7 +63,7 @@ public abstract class VimCommandAction extends EditorAction {
|
||||
*
|
||||
* These legacy flags will be refactored in future releases.
|
||||
*
|
||||
* @see {@link Command}.
|
||||
* @see com.maddyhome.idea.vim.command.Command
|
||||
*/
|
||||
public int getFlags() {
|
||||
return 0;
|
||||
|
@@ -26,6 +26,8 @@ import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
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.key.ShortcutOwner;
|
||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -98,18 +101,12 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
||||
notifyAboutShortcutConflict(keyStroke);
|
||||
}
|
||||
// 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
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
ourLogger.error(throwable);
|
||||
}
|
||||
}
|
||||
});
|
||||
try {
|
||||
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
ourLogger.error(throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +161,9 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
||||
if (LookupManager.getActiveLookup(editor) != null) {
|
||||
return isExitInsertMode(keyStroke);
|
||||
}
|
||||
if (keyCode == VK_ESCAPE) {
|
||||
return isEnabledForEscape(editor);
|
||||
}
|
||||
if (CommandState.inInsertMode(editor)) {
|
||||
// XXX: <Tab> won't be recorded in macros
|
||||
if (keyCode == VK_TAB) {
|
||||
@@ -196,6 +196,22 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
|
||||
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) {
|
||||
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
|
||||
|
@@ -49,8 +49,9 @@ public class OperatorAction extends VimCommandAction {
|
||||
if (argument != null) {
|
||||
final Command motion = argument.getMotion();
|
||||
if (motion != null) {
|
||||
final TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
|
||||
argument, true);
|
||||
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());
|
||||
@@ -82,7 +83,7 @@ public class OperatorAction extends VimCommandAction {
|
||||
@NotNull
|
||||
@Override
|
||||
public Command.Type getType() {
|
||||
return Command.Type.OTHER_READ_WRITE;
|
||||
return Command.Type.OTHER_SELF_SYNCHRONIZED;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@@ -41,6 +41,7 @@ public class RepeatChangeAction extends EditorAction {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
|
||||
CommandState state = CommandState.getInstance(editor);
|
||||
Command cmd = state.getLastChangeCommand();
|
||||
|
||||
if (cmd != null) {
|
||||
if (command.getRawCount() > 0) {
|
||||
cmd.setCount(command.getCount());
|
||||
@@ -53,6 +54,9 @@ public class RepeatChangeAction extends EditorAction {
|
||||
}
|
||||
}
|
||||
Command save = state.getCommand();
|
||||
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
|
||||
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
|
||||
|
||||
state.setCommand(cmd);
|
||||
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
|
||||
char reg = VimPlugin.getRegister().getCurrentRegister();
|
||||
@@ -67,6 +71,7 @@ public class RepeatChangeAction extends EditorAction {
|
||||
if (save != null) {
|
||||
state.setCommand(save);
|
||||
}
|
||||
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
|
||||
state.saveLastChangeCommand(cmd);
|
||||
VimPlugin.getRegister().selectRegister(reg);
|
||||
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -37,13 +39,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class AutoIndentLinesVisualAction extends VimCommandAction {
|
||||
public AutoIndentLinesVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
@NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
VimPlugin.getChange().autoIndentRange(editor, context, range);
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
VimPlugin.getChange().autoIndentRange(editor, caret, context, range);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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 com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -36,10 +38,16 @@ public class ChangeCaseLowerMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
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 &&
|
||||
VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount, CharacterHelper.CASE_LOWER,
|
||||
argument);
|
||||
VimPlugin.getChange()
|
||||
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
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.MappingMode;
|
||||
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.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,11 +41,12 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeCaseLowerVisualAction extends VimCommandAction {
|
||||
public ChangeCaseLowerVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeCaseToggleCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeCaseToggleCharacter(editor, count);
|
||||
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 VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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 com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -36,9 +38,16 @@ public class ChangeCaseToggleMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_TOGGLE, 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 &&
|
||||
VimPlugin.getChange()
|
||||
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
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.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -38,10 +40,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeCaseToggleVisualAction extends VimCommandAction {
|
||||
public ChangeCaseToggleVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_TOGGLE);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_TOGGLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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 com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -36,9 +38,15 @@ public class ChangeCaseUpperMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_UPPER, argument);
|
||||
public Handler() {
|
||||
super(true, CaretOrder.DECREASING_OFFSET);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
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.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -38,10 +40,10 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeCaseUpperVisualAction extends VimCommandAction {
|
||||
public ChangeCaseUpperVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_UPPER);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_UPPER);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return argument != null && VimPlugin.getChange().changeCharacter(editor, count, argument.getCharacter());
|
||||
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 && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.getCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeCharactersAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeCharacters(editor, context, count);
|
||||
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 VimPlugin.getChange().changeCharacters(editor, caret, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeEndOfLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeEndOfLine(editor, context, count);
|
||||
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 VimPlugin.getChange().changeEndOfLine(editor, caret, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,8 +38,8 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
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);
|
||||
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/&");
|
||||
final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
|
||||
return VimPlugin.getSearch().searchAndReplace(editor, editor.getCaretModel().getPrimaryCaret(), range, "s", "//~/&");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
@@ -36,10 +37,17 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
int line = editor.getCaretModel().getLogicalPosition().line;
|
||||
LineRange range = new LineRange(line, line);
|
||||
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/");
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
boolean result = true;
|
||||
for (Caret caret : editor.getCaretModel().getAllCarets()) {
|
||||
final int line = caret.getLogicalPosition().line;
|
||||
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, new LineRange(line, line), "s", "//~/")) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class ChangeLineAction extends EditorAction {
|
||||
public ChangeLineAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeLine(editor, context, count);
|
||||
}
|
||||
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) {
|
||||
return VimPlugin.getChange().changeLine(editor, caret, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return argument != null && VimPlugin.getChange().changeMotion(editor, context, count, rawCount, 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 && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeNumberDecAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeNumber(editor, -count);
|
||||
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 VimPlugin.getChange().changeNumber(editor, caret, -count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class ChangeNumberIncAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeNumber(editor, count);
|
||||
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 VimPlugin.getChange().changeNumber(editor, caret, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class ChangeReplaceAction extends EditorAction {
|
||||
public ChangeReplaceAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().changeReplace(editor, context);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().changeReplace(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.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.SelectionType;
|
||||
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.helper.EditorData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -38,11 +41,14 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeVisualAction extends VimCommandAction {
|
||||
public ChangeVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
final SelectionType type = range.isMultiple() ? SelectionType.BLOCK_WISE : SelectionType.CHARACTER_WISE;
|
||||
return VimPlugin.getChange().changeRange(editor, context, range, type);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
final SelectionType type = EditorData.wasVisualBlockMode(editor) && range.isMultiple()
|
||||
? SelectionType.BLOCK_WISE
|
||||
: SelectionType.CHARACTER_WISE;
|
||||
return VimPlugin.getChange().changeRange(editor, caret, range, type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.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.SelectionType;
|
||||
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.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,12 +41,13 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeVisualLinesAction extends VimCommandAction {
|
||||
public ChangeVisualLinesAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
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()),
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.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.SelectionType;
|
||||
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.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -39,10 +42,10 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeVisualLinesEndAction extends VimCommandAction {
|
||||
public ChangeVisualLinesEndAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
if (range.isMultiple()) {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
if (EditorData.wasVisualBlockMode(editor) && range.isMultiple()) {
|
||||
final int[] starts = range.getStartOffsets();
|
||||
final int[] ends = range.getEndOffsets();
|
||||
for (int i = 0; i < starts.length; i++) {
|
||||
@@ -51,12 +54,12 @@ public class ChangeVisualLinesEndAction extends VimCommandAction {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -43,7 +43,9 @@ public class FilterMotionAction extends EditorAction {
|
||||
if (argument == null) {
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
@@ -52,7 +54,7 @@ public class FilterMotionAction extends EditorAction {
|
||||
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
|
||||
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
|
||||
if (current.line != start.line) {
|
||||
MotionGroup.moveCaret(editor, range.getStartOffset());
|
||||
MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), range.getStartOffset());
|
||||
}
|
||||
|
||||
int count;
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class DeleteCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().deleteCharacter(editor, 1, false);
|
||||
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 VimPlugin.getChange().deleteCharacter(editor, caret, 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class DeleteCharacterLeftAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().deleteCharacter(editor, -count, false);
|
||||
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) {
|
||||
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class DeleteCharacterRightAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().deleteCharacter(editor, count, false);
|
||||
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 VimPlugin.getChange().deleteCharacter(editor, caret, count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,14 @@ public class DeleteEndOfLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().deleteEndOfLine(editor, count);
|
||||
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 VimPlugin.getChange().deleteEndOfLine(editor, caret, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,12 +37,18 @@ public class DeleteJoinLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VimPlugin.getChange().deleteJoinLines(editor, count, false);
|
||||
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,12 +37,18 @@ public class DeleteJoinLinesSpacesAction extends EditorAction {
|
||||
}
|
||||
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VimPlugin.getChange().deleteJoinLines(editor, count, true);
|
||||
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,13 +19,16 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
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.helper.EditorData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -37,10 +40,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class DeleteJoinVisualLinesAction extends VimCommandAction {
|
||||
public DeleteJoinVisualLinesAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, false);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,13 +19,16 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
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.helper.EditorData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -37,10 +40,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
|
||||
public DeleteJoinVisualLinesSpacesAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, true);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class DeleteLineAction extends EditorAction {
|
||||
public DeleteLineAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getChange().deleteLine(editor, count);
|
||||
}
|
||||
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) {
|
||||
return VimPlugin.getChange().deleteLine(editor, caret, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.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;
|
||||
@@ -35,8 +37,15 @@ public class DeleteMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return argument != null && VimPlugin.getChange().deleteMotion(editor, context, count, rawCount, argument, false);
|
||||
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 &&
|
||||
VimPlugin.getChange().deleteMotion(editor, caret, context, count, rawCount, argument, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.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.SelectionType;
|
||||
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.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -40,17 +42,18 @@ import java.util.Set;
|
||||
*/
|
||||
public class DeleteVisualAction extends VimCommandAction {
|
||||
public DeleteVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
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();
|
||||
if (mode == CommandState.SubMode.VISUAL_LINE) {
|
||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
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 {
|
||||
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false);
|
||||
return VimPlugin.getChange().deleteRange(editor, caret, range, SelectionType.fromSubMode(mode), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.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.SelectionType;
|
||||
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.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -40,17 +42,20 @@ import java.util.Set;
|
||||
*/
|
||||
public class DeleteVisualLinesAction extends VimCommandAction {
|
||||
public DeleteVisualLinesAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
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();
|
||||
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 {
|
||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -19,13 +19,16 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
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.SelectionType;
|
||||
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.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,10 +42,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class DeleteVisualLinesEndAction extends VimCommandAction {
|
||||
public DeleteVisualLinesEndAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
if (range.isMultiple()) {
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
if (CommandState.inVisualBlockMode(editor)) {
|
||||
final int[] starts = range.getStartOffsets();
|
||||
final int[] ends = range.getEndOffsets();
|
||||
for (int i = 0; i < starts.length; i++) {
|
||||
@@ -51,12 +55,13 @@ public class DeleteVisualLinesEndAction extends VimCommandAction {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class InsertAfterCursorAction extends EditorAction {
|
||||
public InsertAfterCursorAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertAfterCursor(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertAfterCursor(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class InsertAfterLineEndAction extends EditorAction {
|
||||
public InsertAfterLineEndAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertAfterLineEnd(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertAfterLineEnd(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class InsertAtPreviousInsertAction extends EditorAction {
|
||||
public InsertAtPreviousInsertAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class InsertBeforeFirstNonBlankAction extends EditorAction {
|
||||
public InsertBeforeFirstNonBlankAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,15 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
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.Command;
|
||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||
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;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -33,13 +36,19 @@ public class InsertCharacterAboveCursorAction extends EditorAction {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, -1);
|
||||
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,15 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
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.Command;
|
||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||
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;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -33,13 +36,19 @@ public class InsertCharacterBelowCursorAction extends EditorAction {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, 1);
|
||||
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,17 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
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.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -33,9 +38,15 @@ public class InsertDeleteInsertedTextAction extends EditorAction {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
return VimPlugin.getChange().insertDeleteInsertedText(editor);
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
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) {
|
||||
return VimPlugin.getChange().insertDeleteInsertedText(editor, caret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,17 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
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.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -33,9 +38,15 @@ public class InsertDeletePreviousWordAction extends EditorAction {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
return VimPlugin.getChange().insertDeletePreviousWord(editor);
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
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 VimPlugin.getChange().insertDeletePreviousWord(editor, caret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
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.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
@@ -36,15 +35,16 @@ import java.util.Set;
|
||||
public class InsertExitModeAction extends VimCommandAction {
|
||||
private static final String ACTION_ID = "VimInsertExitMode";
|
||||
|
||||
public InsertExitModeAction() {
|
||||
protected InsertExitModeAction() {
|
||||
super(new EditorActionHandlerBase() {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
VimPlugin.getChange().processEscape(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
VimPlugin.getChange().processEscape(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<MappingMode> getMappingModes() {
|
||||
|
@@ -35,7 +35,7 @@ public class InsertInsertAction extends EditorAction {
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class InsertLineStartAction extends EditorAction {
|
||||
public InsertLineStartAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertLineStart(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertLineStart(editor, context);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,8 @@ public class InsertNewLineBelowAction extends EditorAction {
|
||||
}
|
||||
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
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.command.Argument;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class InsertPreviousInsertAction extends EditorAction {
|
||||
public InsertPreviousInsertAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, false);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertPreviousInsert(editor, context, false);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
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.command.Argument;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class InsertPreviousInsertExitAction extends EditorAction {
|
||||
public InsertPreviousInsertExitAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, true);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
VimPlugin.getChange().insertPreviousInsert(editor, context, true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -38,9 +38,12 @@ import java.util.Set;
|
||||
public class VisualBlockAppendAction extends VimCommandAction {
|
||||
public VisualBlockAppendAction() {
|
||||
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) {
|
||||
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, true);
|
||||
if (editor.isOneLineMode()) return false;
|
||||
return VimPlugin.getChange().blockInsert(editor, context, range, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -38,9 +38,13 @@ import java.util.Set;
|
||||
public class VisualBlockInsertAction extends VimCommandAction {
|
||||
public VisualBlockInsertAction() {
|
||||
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) {
|
||||
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, false);
|
||||
if (editor.isOneLineMode()) return false;
|
||||
return VimPlugin.getChange().blockInsert(editor, context, range, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
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;
|
||||
@@ -30,14 +32,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
*/
|
||||
public class AutoIndentLinesAction extends EditorAction {
|
||||
public AutoIndentLinesAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().autoIndentLines(editor, context, count);
|
||||
return true;
|
||||
}
|
||||
protected AutoIndentLinesAction() {
|
||||
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) {
|
||||
VimPlugin.getChange().autoIndentLines(editor, caret, context, count);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
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;
|
||||
@@ -31,20 +33,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @author Aleksey Lagoshin
|
||||
*/
|
||||
public class AutoIndentMotionAction extends EditorAction {
|
||||
public AutoIndentMotionAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
if (argument != null) {
|
||||
VimPlugin.getChange().autoIndentMotion(editor, context, count, rawCount, argument);
|
||||
VimPlugin.getChange().autoIndentMotion(editor, caret, context, count, rawCount, argument);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
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;
|
||||
@@ -35,8 +37,14 @@ public class ShiftLeftLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().indentLines(editor, context, count, -1);
|
||||
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) {
|
||||
VimPlugin.getChange().indentLines(editor, caret, context, count, -1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
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;
|
||||
@@ -35,9 +37,15 @@ public class ShiftLeftMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
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 (argument != null) {
|
||||
VimPlugin.getChange().indentMotion(editor, context, count, rawCount, argument, -1);
|
||||
VimPlugin.getChange().indentMotion(editor, caret, context, count, rawCount, argument, -1);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -37,10 +39,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class ShiftLeftVisualAction extends VimCommandAction {
|
||||
public ShiftLeftVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
VimPlugin.getChange().indentRange(editor, context, range, cmd.getCount(), -1);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
VimPlugin.getChange().indentRange(editor, caret, context, range, cmd.getCount(), -1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@@ -19,10 +19,12 @@
|
||||
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;
|
||||
@@ -35,8 +37,14 @@ public class ShiftRightLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
VimPlugin.getChange().indentLines(editor, context, count, 1);
|
||||
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) {
|
||||
VimPlugin.getChange().indentLines(editor, caret, context, count, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -19,10 +19,12 @@
|
||||
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;
|
||||
@@ -35,9 +37,15 @@ public class ShiftRightMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
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 (argument != null) {
|
||||
VimPlugin.getChange().indentMotion(editor, context, count, rawCount, argument, 1);
|
||||
VimPlugin.getChange().indentMotion(editor, caret, context, count, rawCount, argument, 1);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.VimCommandAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.MappingMode;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.handler.CaretOrder;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -37,10 +39,10 @@ import java.util.Set;
|
||||
*/
|
||||
public class ShiftRightVisualAction extends VimCommandAction {
|
||||
public ShiftRightVisualAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
VimPlugin.getChange().indentRange(editor, context, range, cmd.getCount(), 1);
|
||||
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd, @NotNull TextRange range) {
|
||||
VimPlugin.getChange().indentRange(editor, caret, context, range, cmd.getCount(), 1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@@ -31,12 +31,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PutTextAfterCursorAction extends EditorAction {
|
||||
public PutTextAfterCursorAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putTextAfterCursor(editor, context, count, true, false);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putText(editor, context, count, true, false, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PutTextAfterCursorActionMoveCursor extends EditorAction {
|
||||
public PutTextAfterCursorActionMoveCursor() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putTextAfterCursor(editor, context, count, true, true);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putText(editor, context, count, true, true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PutTextAfterCursorNoIndentAction extends EditorAction {
|
||||
public PutTextAfterCursorNoIndentAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putTextAfterCursor(editor, context, count, false, false);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putText(editor, context, count, false, false, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PutTextBeforeCursorAction extends EditorAction {
|
||||
public PutTextBeforeCursorAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putTextBeforeCursor(editor, context, count, true, false);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putText(editor, context, count, true, false, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PutTextBeforeCursorActionMoveCursor extends EditorAction {
|
||||
public PutTextBeforeCursorActionMoveCursor() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putTextBeforeCursor(editor, context, count, true, true);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putText(editor, context, count, true, true, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PutTextBeforeCursorNoIndentAction extends EditorAction {
|
||||
public PutTextBeforeCursorNoIndentAction() {
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putTextBeforeCursor(editor, context, count, false, false);
|
||||
}
|
||||
super(new ChangeEditorActionHandler() {
|
||||
@Override
|
||||
public boolean execute(@NotNull Editor editor,
|
||||
@NotNull DataContext context,
|
||||
int count,
|
||||
int rawCount,
|
||||
@Nullable Argument argument) {
|
||||
return VimPlugin.getCopy().putText(editor, context, count, false, false, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,10 @@ import java.util.Set;
|
||||
public class PutVisualTextAction extends VimCommandAction {
|
||||
public PutVisualTextAction() {
|
||||
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) {
|
||||
return VimPlugin.getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, false);
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ import java.util.Set;
|
||||
public class PutVisualTextMoveCursorAction extends VimCommandAction {
|
||||
public PutVisualTextMoveCursorAction() {
|
||||
super(new VisualOperatorActionHandler() {
|
||||
@Override
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
|
||||
@NotNull TextRange range) {
|
||||
return VimPlugin.getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, true);
|
||||
|
@@ -38,7 +38,10 @@ import java.util.Set;
|
||||
public class PutVisualTextNoIndentAction extends VimCommandAction {
|
||||
public PutVisualTextNoIndentAction() {
|
||||
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) {
|
||||
return VimPlugin.getCopy().putVisualRange(editor, context, range, cmd.getCount(), false, false);
|
||||
}
|
||||
|
@@ -37,8 +37,11 @@ public class YankMotionAction extends EditorAction {
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
final Argument argument = cmd.getArgument();
|
||||
return argument != null && VimPlugin.getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(),
|
||||
argument);
|
||||
if (argument == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VimPlugin.getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(), argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ import com.maddyhome.idea.vim.command.MappingMode;
|
||||
import com.maddyhome.idea.vim.command.SelectionType;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -48,9 +47,7 @@ public class YankVisualLinesAction extends VimCommandAction {
|
||||
return VimPlugin.getCopy().yankRange(editor, range, SelectionType.fromSubMode(mode), true);
|
||||
}
|
||||
else {
|
||||
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
return VimPlugin.getCopy().yankRange(editor, lineRange, SelectionType.LINE_WISE, true);
|
||||
return VimPlugin.getCopy().yankRange(editor, range, SelectionType.LINE_WISE, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
// TODO: Unused action. Delete it?
|
||||
public class FileSaveAction extends EditorAction {
|
||||
public FileSaveAction() {
|
||||
super(new Handler());
|
||||
@@ -35,7 +36,7 @@ public class FileSaveAction extends EditorAction {
|
||||
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
VimPlugin.getFile().saveFile(editor, context);
|
||||
VimPlugin.getFile().saveFile(editor);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public class FileSaveCloseAction extends EditorAction {
|
||||
|
||||
private static class Handler extends EditorActionHandlerBase {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
VimPlugin.getFile().saveFile(editor, context);
|
||||
VimPlugin.getFile().saveFile(editor);
|
||||
VimPlugin.getFile().closeFile(editor, context);
|
||||
|
||||
return true;
|
||||
|
148
src/com/maddyhome/idea/vim/action/internal/AddInlaysAction.java
Normal file
148
src/com/maddyhome/idea/vim/action/internal/AddInlaysAction.java
Normal file
@@ -0,0 +1,148 @@
|
||||
package com.maddyhome.idea.vim.action.internal;
|
||||
|
||||
import com.intellij.ide.ui.AntialiasingType;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.editor.impl.FontInfo;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.LineMetrics;
|
||||
import java.util.Random;
|
||||
|
||||
public class AddInlaysAction extends AnAction {
|
||||
private static Random random = new Random();
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Editor editor = getEditor(dataContext);
|
||||
if (editor == null) return;
|
||||
|
||||
InlayModel inlayModel = editor.getInlayModel();
|
||||
|
||||
Document document = editor.getDocument();
|
||||
int lineCount = document.getLineCount();
|
||||
for (int i = random.nextInt(10); i < lineCount; ) {
|
||||
|
||||
int offset = document.getLineStartOffset(i);
|
||||
|
||||
// Mostly above
|
||||
boolean above = random.nextInt(10) > 3;
|
||||
|
||||
// Mostly do one, but occasionally throw in a bunch
|
||||
int count = random.nextInt(10) > 7 ? random.nextInt(5) : 1;
|
||||
for (int j = 0; j < count; j++) {
|
||||
|
||||
float factor = Math.max(1.75f * random.nextFloat(), 0.9f);
|
||||
String text = String.format("---------- %s line %d ----------", above ? "above" : "below", i + 1);
|
||||
|
||||
inlayModel.addBlockElement(offset, true, above, 0, new MyBlockRenderer(factor, text));
|
||||
}
|
||||
|
||||
// Every 10 lines +/- 3 lines
|
||||
i += 10 + (random.nextInt(6) - 3);
|
||||
}
|
||||
}
|
||||
|
||||
protected Editor getEditor(@NotNull DataContext dataContext) {
|
||||
return CommonDataKeys.EDITOR.getData(dataContext);
|
||||
}
|
||||
|
||||
private static class MyBlockRenderer implements EditorCustomElementRenderer {
|
||||
|
||||
private static Key<MyFontMetrics> HINT_FONT_METRICS = Key.create("DummyInlayFontMetrics");
|
||||
private float factor;
|
||||
private String text;
|
||||
|
||||
MyBlockRenderer(float factor, String text) {
|
||||
this.factor = factor;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calcWidthInPixels(@NotNull Inlay inlay) {
|
||||
Editor editor = inlay.getEditor();
|
||||
FontMetrics fontMetrics = getFontMetrics(editor).metrics;
|
||||
return doCalcWidth(text, fontMetrics);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calcHeightInPixels(@NotNull Inlay inlay) {
|
||||
Editor editor = inlay.getEditor();
|
||||
FontMetrics fontMetrics = getFontMetrics(editor).metrics;
|
||||
return fontMetrics.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(@NotNull Inlay inlay,
|
||||
@NotNull Graphics g,
|
||||
@NotNull Rectangle targetRegion,
|
||||
@NotNull TextAttributes textAttributes) {
|
||||
Editor editor = inlay.getEditor();
|
||||
FontMetrics fontMetrics = getFontMetrics(editor).metrics;
|
||||
LineMetrics lineMetrics = fontMetrics.getLineMetrics(text, g);
|
||||
|
||||
g.setColor(JBColor.GRAY);
|
||||
g.setFont(fontMetrics.getFont());
|
||||
g.drawString(text, 0, targetRegion.y + (int)(lineMetrics.getHeight() - lineMetrics.getDescent()));
|
||||
g.setColor(JBColor.LIGHT_GRAY);
|
||||
g.drawRect(targetRegion.x, targetRegion.y, targetRegion.width, targetRegion.height);
|
||||
}
|
||||
|
||||
private MyFontMetrics getFontMetrics(Editor editor) {
|
||||
String familyName = UIManager.getFont("Label.font").getFamily();
|
||||
int size = (int)(Math.max(1, editor.getColorsScheme().getEditorFontSize() - 1) * factor);
|
||||
MyFontMetrics metrics = editor.getUserData(HINT_FONT_METRICS);
|
||||
if (metrics != null && !metrics.isActual(editor, familyName, size)) {
|
||||
metrics = null;
|
||||
}
|
||||
if (metrics == null) {
|
||||
metrics = new MyFontMetrics(editor, familyName, size);
|
||||
editor.putUserData(HINT_FONT_METRICS, metrics);
|
||||
}
|
||||
return metrics;
|
||||
}
|
||||
|
||||
private int doCalcWidth(String text, FontMetrics fontMetrics) {
|
||||
return (text == null) ? 0 : fontMetrics.stringWidth(text);
|
||||
}
|
||||
|
||||
|
||||
protected class MyFontMetrics {
|
||||
private FontMetrics metrics;
|
||||
|
||||
MyFontMetrics(Editor editor, String familyName, int size) {
|
||||
Font font = UIUtil.getFontWithFallback(familyName, Font.PLAIN, size);
|
||||
FontRenderContext context = getCurrentContext(editor);
|
||||
metrics = FontInfo.getFontMetrics(font, context);
|
||||
// We assume this will be a better approximation to a real line height for a given font
|
||||
}
|
||||
|
||||
public boolean isActual(Editor editor, String familyName, int size) {
|
||||
Font font = metrics.getFont();
|
||||
if (!familyName.equals(font.getFamily()) || size != font.getSize()) return false;
|
||||
FontRenderContext currentContext = getCurrentContext(editor);
|
||||
return currentContext.equals(metrics.getFontRenderContext());
|
||||
}
|
||||
|
||||
private FontRenderContext getCurrentContext(Editor editor) {
|
||||
FontRenderContext editorContext = FontInfo.getFontRenderContext(editor.getContentComponent());
|
||||
return new FontRenderContext(editorContext.getTransform(),
|
||||
AntialiasingType.getKeyForCurrentScope(false), editor instanceof EditorImpl
|
||||
? ((EditorImpl)editor).myFractionalMetricsHintValue
|
||||
: RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -19,10 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.motion;
|
||||
|
||||
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.command.Argument;
|
||||
import com.maddyhome.idea.vim.handler.ExecuteMethodNotOverriddenException;
|
||||
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -32,8 +36,9 @@ public abstract class MotionEditorAction extends EditorAction {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public int getOffset(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return handler.getOffset(editor, context, count, rawCount, argument);
|
||||
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||
int rawCount, @Nullable Argument argument) throws ExecuteMethodNotOverriddenException {
|
||||
return handler.getOffset(editor, caret, context, count, rawCount, argument);
|
||||
}
|
||||
|
||||
private final MotionEditorActionHandler handler;
|
||||
|
@@ -19,11 +19,13 @@
|
||||
package com.maddyhome.idea.vim.action.motion;
|
||||
|
||||
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.command.Argument;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -35,8 +37,9 @@ public abstract class TextObjectAction extends EditorAction {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TextRange getRange(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return handler.getRange(editor, context, count, rawCount, argument);
|
||||
public TextRange getRange(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||
int rawCount, @Nullable Argument argument) {
|
||||
return handler.getRange(editor, caret, context, count, rawCount, argument);
|
||||
}
|
||||
|
||||
private final TextObjectActionHandler handler;
|
||||
|
@@ -19,14 +19,16 @@
|
||||
package com.maddyhome.idea.vim.action.motion.leftright;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.helper.CaretData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -36,12 +38,20 @@ public class MotionColumnAction extends MotionEditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends MotionEditorActionHandler {
|
||||
public int getOffset(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return VimPlugin.getMotion().moveCaretToColumn(editor, count - 1, false);
|
||||
public Handler() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
protected void postMove(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
|
||||
EditorData.setLastColumn(editor, cmd.getCount() - 1);
|
||||
@Override
|
||||
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||
int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getMotion().moveCaretToColumn(editor, caret, count - 1, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postMove(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
|
||||
@NotNull Command cmd) {
|
||||
CaretData.setLastColumn(editor, caret, cmd.getCount() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.motion.leftright;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +36,14 @@ public class MotionFirstColumnAction extends MotionEditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends MotionEditorActionHandler {
|
||||
public int getOffset(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return VimPlugin.getMotion().moveCaretToLineStart(editor);
|
||||
public Handler() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||
int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getMotion().moveCaretToLineStart(editor, caret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,12 +19,14 @@
|
||||
package com.maddyhome.idea.vim.action.motion.leftright;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +36,14 @@ public class MotionFirstNonSpaceAction extends MotionEditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends MotionEditorActionHandler {
|
||||
public int getOffset(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor);
|
||||
public Handler() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
|
||||
int rawCount, @Nullable Argument argument) {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, caret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user