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

Compare commits

..

266 Commits

Author SHA1 Message Date
Alex Plate
e89e0466eb Prepare for 0.60 release 2020-10-09 11:24:48 +02:00
Alex Plate
c9d0d7aef6 [VIM-2140] Downgrade java version to 1.8 2020-10-09 11:06:38 +02:00
Alex Plate
90c7d5a74a Update gradle to 6.6.1 2020-10-09 10:30:41 +02:00
Alex Plate
b19e11b5b6 Use proper access syntax 2020-10-09 10:16:30 +02:00
Alex Plate
2d002c044d Report if time for calculation of isIdeaVimDisabledHere take more than 10ms 2020-10-08 11:39:49 +02:00
Alex Plate
9a7b2bd158 Update the implementation of disabled IdeaVim editors 2020-10-08 11:25:47 +02:00
Alex Plate
461c874de6 Reformat some code 2020-10-08 10:31:21 +02:00
Alex Plate
992ff97877 Use setUp function for VimOptionTestCase 2020-09-24 11:15:48 +03:00
Alex Plate
96689eab23 Update changes 2020-09-24 09:52:07 +03:00
Alex Pláte
0dd47c192b Merge pull request #252 from citizenmatt/VIM-2104
Fixes for scrolling
2020-09-24 09:45:32 +03:00
Alex Plate
5875ce58fb Update notification about missing action id 2020-09-23 10:46:21 +03:00
Alex Pláte
1c21968259 Merge branch 'master' into VIM-2104 2020-09-23 09:51:10 +03:00
Alex Plate
1d8ac4fc02 Move scroll data objects up to avoid conflicts 2020-09-23 09:50:00 +03:00
Alex Plate
0a863f32b2 Small formatting 2020-09-22 10:48:15 +03:00
Alex Plate
cd0d503402 Convert test to option test 2020-09-22 10:41:03 +03:00
Alex Plate
0bac6bf8b6 Rename tracking id action 2020-09-18 10:48:41 +03:00
Alex Plate
6436a59528 Rename "ideawaonw" to "ideawrite" 2020-09-18 10:11:01 +03:00
Matt Ellis
2dc54ea882 Use deterministic width for inlays 2020-09-17 16:15:27 +01:00
Matt Ellis
63db148aae Merge branch 'master' into VIM-2104 2020-09-17 15:29:05 +01:00
Matt Ellis
78f1c8499a Use test inlay renderer for consistent width 2020-09-17 14:55:41 +01:00
Matt Ellis
26dae9b4e0 Add zH scroll half screen width action 2020-09-17 14:35:43 +01:00
Alex Plate
10f1d75f2e Add Iain Ballard to contributors list 2020-09-17 11:22:53 +03:00
Alex Plate
5b3984ce7a Refactor test 2020-09-17 11:18:27 +03:00
Alex Plate
43810ba730 Rename moveCaretHorizontal to getOffsetOfHorizontalMotion 2020-09-17 11:18:27 +03:00
Alex Pláte
5bf2818b2a Merge pull request #242 from i-e-b/master
Partial implementation of virtualedit config
2020-09-17 11:15:14 +03:00
Alex Plate
76587d672f Refactor tests according to IdeaVim practices 2020-09-17 11:13:02 +03:00
Alex Plate
890d48769f Get rid of unused variables 2020-09-17 10:30:56 +03:00
Alex Plate
fffe8e2499 Add static import of EditorHelper 2020-09-17 10:15:09 +03:00
Alex Plate
fffc2d3b11 Use amountOfInlaysBeforeCaret function 2020-09-17 10:13:53 +03:00
Matt Ellis
007f33be0b Add zL scroll half screen width action 2020-09-17 00:01:24 +01:00
Matt Ellis
fa17af8d33 Fix keeping caret on screen with preceding inlay 2020-09-16 18:58:21 +01:00
Matt Ellis
eabe43061c Add tests and fixes for ScrollColumnLeftAction 2020-09-16 16:59:14 +01:00
Matt Ellis
64502fb31b Reformat comments 2020-09-16 12:11:48 +01:00
Matt Ellis
d693906905 Add tests and fixes for ScrollColumnRightAction 2020-09-16 11:47:28 +01:00
Alex Plate
cf25f7e201 Refactor processing of vimLastColumn 2020-09-16 12:42:43 +03:00
Matt Ellis
df3a533515 Fix arithmetic for scrolling columns 2020-09-16 09:29:43 +01:00
Matt Ellis
53a687fd53 Fix issues with side scrolling and inline inlays
Fixes VIM-1556, fixes VIM-1770, fixes VIM-2110
2020-09-15 17:07:42 +01:00
Matt Ellis
2091bbc025 Improve cursor position handling with inlay hints
E.g. navigation around Kotlin type annotations, replacing a character with a preceding parameter hint
2020-09-08 17:45:44 +01:00
Alex Plate
eb46ed8f00 Small refactorings based on inspections 2020-09-08 10:18:44 +03:00
Alex Plate
3096c2e7ad Update changelog 2020-09-08 09:58:57 +03:00
Alex Plate
f8d66f354a Fix typos in file 2020-09-08 09:56:28 +03:00
Alex Pláte
67c5601fdc Merge pull request #248 from yaohui-wyh/master
Check if project is disposed when editorDeinit
2020-09-08 09:55:58 +03:00
Matt Ellis
62601686aa Add internal action to show inline inlays 2020-09-08 00:20:54 +01:00
Alex Plate
e92c0d5098 [VIM-1968] Create and enable option to execute :wa command on :w 2020-09-07 10:55:47 +03:00
Matt Ellis
5ca0298497 Add tests for ScrollHalfPage actions
<C-D> and <C-U>
2020-09-03 17:46:30 +01:00
Matt Ellis
7321099a0f Add tests for ScrollMiddleScreenLine actions
z. and zz
2020-09-03 10:10:57 +01:00
Matt Ellis
63d9a33d80 Add tests for ScrollLastScreenLine actions
z- and zb
2020-09-03 09:57:32 +01:00
Matt Ellis
a7ba6d6004 Add tests for ScrollFirstScreenLine actions
z<CR> and zt
2020-09-03 09:55:53 +01:00
Alex Plate
5008d5c8c4 Make better notifications about tracked action id 2020-09-03 11:35:40 +03:00
Alex Plate
33f8a00679 VIM-2099 Fix operations with backward inclusive motions 2020-09-03 10:16:16 +03:00
Matt Ellis
be0adb833f Add tests for ScrollLastScreenLinePageStartAction 2020-09-03 01:10:58 +01:00
Matt Ellis
8f90ff8a65 Add tests for ScrollFirstScreenLinePageStartAction 2020-09-03 00:05:01 +01:00
Matt Ellis
c8a1938155 Add tests for ScrollPageUpAction 2020-09-02 23:27:16 +01:00
Matt Ellis
3cf42c86f3 Add tests for ScrollPageDownAction 2020-09-02 23:11:53 +01:00
Matt Ellis
632e9fad2e Remove incorrect mappings for page up/down
i_<C-Down> and i_<C-Up> are not standard Vim mappings, but can be set up in .ideavimrc if required
2020-09-02 17:18:03 +01:00
Matt Ellis
a5de935192 Add tests for ScrollLineDownAction 2020-09-02 17:05:01 +01:00
Matt Ellis
111c1ebe32 Add tests for ScrollLineUpAction 2020-09-02 15:09:11 +01:00
Matt Ellis
8a42bff6ad Add tests for scrolloff and scrolljump
Behaviour matches Vim, apart from soft wraps
2020-09-02 14:11:04 +01:00
Matt Ellis
d878c3e05d Improve handling of scrolljump
Now very closely follows Vim's somewhat unintuitive handling. Doesn't work properly with soft wraps (like a lot of other parts of IdeaVim)
2020-09-01 17:46:18 +01:00
Matt Ellis
d08da77b2f Split scrollPositionIntoView method into two 2020-09-01 17:44:24 +01:00
Alex Pláte
86d6876db4 Update README.md 2020-09-01 17:17:43 +03:00
Alex Plate
a7985e1e9b VIM-2080 Fix S command with count 2020-09-01 12:08:24 +03:00
Alex Plate
879ca456f7 Do not apply mappings in REGISTER_PENDING submode 2020-09-01 12:08:23 +03:00
Alex Plate
1863cbdef0 Add functionality to track action ids 2020-08-31 10:30:10 +03:00
Alex Plate
ac4755a6ff VIM-2071 Fix unexpected moving of caret
#VIM-2071 Request State {Ready To Release}
2020-08-28 10:17:08 +03:00
Alex Plate
61600b07a4 VIM-2084 Fix execution of plugins with existing mappings
#VIM-2084 State {Ready To Release}
2020-08-27 12:26:50 +03:00
Iain Ballard
6be6e7f173 Partial implementation of virtualedit config
This does not support all config settings,
but does add the 'onemore' option.

This partly addresses https://youtrack.jetbrains.com/issue/VIM-844
2020-08-26 08:35:00 +01:00
Alex Plate
e597e06324 Preparation for the 0.59 release 2020-08-25 10:25:32 +03:00
Matt Ellis
4cebaa865b Fix scrolljump 2020-08-20 14:21:53 +01:00
Matt Ellis
589e43f825 [VIM-2104] Use side scroll offset for horizontal scrolling 2020-08-20 11:45:39 +01:00
Yaohui Wang
61a70704c5 Check if project is disposed when editorDeinit 2020-08-03 07:21:19 +08:00
Alex Plate
174f86f91e Add gif with highlight_yank 2020-07-30 10:34:44 +03:00
Alex Plate
77a462702e Add a note about property based tests 2020-07-29 11:34:58 +03:00
Alex Plate
d20955900d Prepare to 0.58.1 EAP 2020-07-28 09:38:16 +03:00
Alex Plate
b952d2b96a Note the PR from KostkaBrukowa 2020-07-27 20:59:38 +03:00
Alex Plate
428d1d6699 Add KostkaBrukowa to contributors list 2020-07-27 20:39:16 +03:00
Alex Pláte
35863581e9 Merge pull request #245 from KostkaBrukowa/VIM-1970
VIM-1970 | Working solution of plugin vim-highlightedyank
2020-07-27 20:34:18 +03:00
Alex Plate
041f6af607 Add insert listener; small refactorings 2020-07-27 20:25:03 +03:00
Alex Plate
0e8a1bfc87 Refactor neovim tests 2020-07-27 10:07:19 +03:00
Alex Plate
442e739447 Fix propertyBased test 2020-07-27 09:57:53 +03:00
Alex Plate
47bb155989 Replace IJ pair with kotlin Pair 2020-07-26 19:09:35 +03:00
Alex Plate
bd733b72a7 Write property based test for inc/dec 2020-07-26 19:04:58 +03:00
Alex Plate
e01327ab29 Update implementation for inc/dec 2020-07-26 19:04:46 +03:00
Alex Plate
2a10247653 Update implementation for inc/dec actions 2020-07-24 21:50:04 +03:00
kostkabrukowa
e3b7ed7657 VIM-1970 | Adds yank listeners, updates tests 2020-07-24 13:36:23 +02:00
Alex Plate
d4357ce801 Start implementing property based test for increment/decrement 2020-07-24 13:54:52 +03:00
Alex Plate
5bdeaed416 Fix number change for an incorrect oct number 2020-07-24 13:53:16 +03:00
Alex Plate
a44d93283f Refactor ChangeNumberIncAction.kt 2020-07-24 10:17:36 +03:00
Alex Plate
804f69e9c8 Fix Ctrl-A for selections 2020-07-23 21:12:28 +03:00
kostkabrukowa
086c2f201b VIM-1970 | Adds feature to change highlight background color 2020-07-22 17:29:54 +02:00
Alex Plate
0b22360891 Add a couple of tests for macros 2020-07-22 11:14:49 +03:00
Alex Plate
808fb24bbc Remove unused methods 2020-07-22 10:40:35 +03:00
Alex Plate
febd8eccf0 Update changelog 2020-07-22 10:25:45 +03:00
Alex Plate
22b1209eb5 Revert the behaviour of :reg command 2020-07-22 10:21:57 +03:00
Alex Plate
485c5501b3 [VIM-2075] Fix zR command 2020-07-22 10:20:54 +03:00
Alex Plate
81ceba8926 Optimize imports 2020-07-22 10:20:54 +03:00
Alex Pláte
3edd95da4e Merge pull request #240 from rieonke/VIM-2059
add support for putting & editing macros
2020-07-22 10:20:23 +03:00
kostkabrukowa
c1bb364cbe VIM-1970 | Removes box around yank highlight 2020-07-21 15:18:00 +02:00
Alex Pláte
db8fa31503 Merge pull request #246 from gaganis/add_resources_to_contributors_md
Add resource links helpful to contributors
2020-07-21 13:09:01 +03:00
Giorgos Gaganis
1a5a65dcb1 Add resource links helpful to contributors 2020-07-20 14:40:10 +03:00
Alex Plate
1c96f4491e Comment out failing tests 2020-07-20 12:45:56 +03:00
Alex Plate
30ddb4071f Add information about neovim integration 2020-07-20 11:19:35 +03:00
kostkabrukowa
dccc793fc7 VIM-1970 | Tries to remove thread related test failure 2020-07-19 16:54:05 +02:00
kostkabrukowa
f070a57148 VIM-1970 | Tries to remove thread related test failure 2020-07-19 16:08:21 +02:00
kostkabrukowa
2dde2cfb3b VIM-1970 | Refactores some tests 2020-07-19 15:34:28 +02:00
kostkabrukowa
e0fef4f017 VIM-1970 | Adds some tests and updates plugins docs 2020-07-19 13:30:49 +02:00
kostkabrukowa
3a40b9689c VIM-1970 | Fixes register bug 2020-07-18 19:12:08 +02:00
kostkabrukowa
3937a395b7 VIM-1970 | Moves functionality to extension class, adds possibility to dynamically set highlight duration 2020-07-18 18:51:07 +02:00
kostkabrukowa
7e3d532075 VIM-1970 | Clears highlighters after its removal 2020-07-18 11:30:52 +02:00
kostkabrukowa
4f658c4734 VIM-1970 | Draft of working solution to plugin vim-highlightedyank 2020-07-18 10:14:45 +02:00
Alex Plate
26aa753d9e Update syntax of TabCloseHandler.kt 2020-07-16 11:13:20 +03:00
Alex Plate
bd9c40aabc Add Rieon Ke to contributions list 2020-07-16 11:02:45 +03:00
Alex Pláte
008edc7e33 Merge pull request #244 from rieonke/VIM-2068
Implement tabc[lose] ex command
2020-07-16 10:57:59 +03:00
Alex Plate
2901bf45b7 Update the contributing doc 2020-07-15 10:11:51 +03:00
Alex Plate
24e7f655fc Add linewise motion type 2020-07-14 11:31:29 +03:00
Alex Plate
ab8de509d9 Create visual type for the text objects 2020-07-14 02:37:54 +03:00
Alex Plate
4fc4ed7675 Remove FLAG_MOT_CHARACTERWISE flag 2020-07-14 02:10:20 +03:00
Alex Plate
b35ad2bb9d Remove FLAG_MOT_BLOCKWISE 2020-07-14 02:03:08 +03:00
Alex Plate
895c7f1af1 Remove deprecated class 2020-07-14 01:37:08 +03:00
Alex Plate
fbca5712e3 Run some tests with neovim 2020-07-14 01:24:05 +03:00
Alex Pláte
58850960b8 Merge pull request #243 from strogiyotec/master
Fix alternative XDG path in README
2020-07-13 11:37:38 +03:00
Alex Plate
1c874d3957 Assert mode in neovim testing 2020-07-13 11:23:28 +03:00
Alex Plate
a42a19a174 Add converting mode to vim notation 2020-07-13 11:21:53 +03:00
Alex Plate
bbe39d5942 Convert command state to kt 2020-07-13 10:42:43 +03:00
Alex Plate
f5fb844442 Rename .java to .kt 2020-07-13 10:42:42 +03:00
Alex Plate
cb186a686e Fix typo in readme 2020-07-13 10:21:37 +03:00
Alex Plate
0c22bb2f4f Add logging for used ideavimrc file 2020-07-13 10:05:16 +03:00
Alex Plate
49756c5c2f Split editor setup and command typing 2020-07-12 21:35:54 +03:00
Alex Plate
7efc2e1631 Enable neovim testing only for testWithNeovim task 2020-07-12 16:41:13 +03:00
Alex Plate
ed23f5958c Rename doTestWithNeovim to doTest 2020-07-12 13:14:42 +03:00
Alex Plate
0ea53f3445 Remove unused doTest method 2020-07-12 13:09:27 +03:00
Alex Plate
4531b38c89 Annotate tests with TestWithoutNeovim 2020-07-12 12:58:51 +03:00
Alex Plate
2114725dab DotToTab is now extension function 2020-07-11 21:30:21 +03:00
Alex Plate
6877ffcb47 Use neovim for tests with VimBehaviourDiffers 2020-07-11 17:55:51 +03:00
Alex Plate
c4a3cc6718 Disable neovim test for tests that are marked with VimBehaviourDiffers 2020-07-11 17:32:00 +03:00
Alex Plate
a53ed1705a Extract NeovimTesting to the separate class 2020-07-11 16:58:27 +03:00
Alex Plate
ae13eed152 Move all tests to use neovim or describe the reason why it cant 2020-07-11 16:14:48 +03:00
Alex Plate
2c2c023200 Move some tests to neovim or describe the reason 2020-07-10 12:03:54 +03:00
Alex Plate
1dbe7735df Rename api to neovimApi 2020-07-10 10:49:12 +03:00
Alex Plate
a321e77e2e Support setreg for neovim 2020-07-10 10:48:46 +03:00
Alex Plate
9b52b496b2 Convert some tests to testing with neovim 2020-07-09 22:47:41 +03:00
Alex Plate
deeddc22be More methods use neovim 2020-07-09 21:55:21 +03:00
Alex Plate
680693448f Two more tests to work with neovim 2020-07-09 19:28:44 +03:00
Alex Plate
b4b5c0c77e Convert VimTestCase to kt 2020-07-09 18:01:02 +03:00
Alex Plate
3f3305706d Rename .java to .kt 2020-07-09 18:01:01 +03:00
Alex Plate
bd942e2ea1 Add initial implementation of neovim integration for tests 2020-07-09 17:36:57 +03:00
Alex Plate
a4c3fd8f0b Removed redundant class name 2020-07-09 17:35:20 +03:00
Alex Plate
f54fc09a37 Make modes the same as in vanilla vim 2020-07-09 12:45:34 +03:00
Alex Plate
fd6bdde5b0 Add merged commits to changeslog 2020-07-09 11:17:36 +03:00
Alex Plate
85c8007084 Update authors and changes 2020-07-09 11:14:03 +03:00
Alex Pláte
8a82d60172 Merge pull request #241 from patrick-elmquist/fix/reset-operator
Properly reset when pressing Esc in the middle of command
2020-07-09 11:10:02 +03:00
Alex Pláte
8b3f5d5e81 Merge branch 'master' into fix/reset-operator 2020-07-09 11:09:41 +03:00
Alex Pláte
e222294c6e Merge pull request #237 from adriafarres/master
Reset operator-pending commands on escape
2020-07-09 11:01:03 +03:00
Alex Plate
a04b536df8 Mark codeblocks as vim script 2020-07-08 12:05:13 +03:00
Alex Plate
2a0bd8722e Check is project is disposed in isTemplateActive 2020-07-07 17:56:52 +03:00
Patrick Elmquist
742187919f Properly reset with Esc in the middle of command 2020-07-07 11:09:56 +02:00
Alex Plate
aece559400 Remove unused deprecated methods 2020-07-07 12:07:11 +03:00
Alex Plate
8b6e41afb8 Remove [To Be Released] mark 2020-07-07 09:55:08 +03:00
Alex Plate
9eed5802d6 Prepare for the 0.58 release 2020-07-07 09:28:17 +03:00
Alex Plate
437932d023 Revert and move neovim to fork 2020-07-06 19:49:27 +03:00
Alex Plate
e8dd4f2e59 Default execution amount for property based tests 2020-07-06 19:06:33 +03:00
Alex Plate
93cdf3828b Add initial implementation of neovim integration for tests 2020-07-06 19:03:07 +03:00
Alex Plate
99a91404ce Revert "Add initial implementation of neovim integration for tests"
This reverts commit 15ebcb5b
2020-07-06 16:06:09 +03:00
Alex Plate
28ae3a104a Revert "Create neovim helper"
This reverts commit bc08839b
2020-07-06 16:05:55 +03:00
Alex Plate
bc08839b16 Create neovim helper 2020-07-06 15:47:15 +03:00
Alex Plate
15ebcb5b6a Add initial implementation of neovim integration for tests 2020-07-06 12:20:02 +03:00
Alex Plate
93fd8b0ff7 More complicated texts for property based tests 2020-07-03 21:49:24 +03:00
Alex Plate
6d0f280f19 Different initial position for caret 2020-07-03 21:36:09 +03:00
Alex Plate
3b26a4c26d Unignore property based test 2020-07-03 12:37:34 +03:00
Alex Plate
60315744d1 Fix exceptions in word under caret search 2020-07-03 12:35:43 +03:00
Alex Plate
40a6617816 Reset last search during property based tests 2020-07-03 12:11:23 +03:00
Alex Plate
a6964a37ac Fix exception during sentence start search 2020-07-03 11:54:25 +03:00
Alex Plate
9249ae073c Fix bug in anyNonWhitespace 2020-07-03 11:21:03 +03:00
Alex Plate
2a216728f1 Add KtDock for property based test 2020-07-02 14:00:27 +03:00
Alex Plate
b186cb585e Rename property based test 2020-07-02 13:59:39 +03:00
Alex Plate
4e26f62391 Cleanup property based test 2020-07-02 13:58:29 +03:00
Alex Plate
ddb502acb3 Fix exception for d]] command 2020-07-02 13:48:36 +03:00
Alex Plate
89cb6867d4 Tests for exiting insert mode 2020-07-02 13:27:27 +03:00
Alex Plate
f7892b33c8 Add method doTest that accepts string instead of list of KeyStrokes 2020-07-02 12:17:22 +03:00
Alex Plate
e04e0e69f3 Enable strict mode for tests 2020-07-02 12:15:57 +03:00
Alex Plate
7172faf7b5 Revert strict mode for all normalization methods
This should be done in a more smooth way
2020-07-02 12:09:56 +03:00
Rieon Ke
6e1761a1f5 impl tabc[lose] ex command 2020-07-02 15:21:19 +08:00
Alex Plate
baa7d4f098 Fix big word motion for last word 2020-07-01 20:49:34 +03:00
Alex Plate
baa5557010 Fix bug in dollar motion at the end 2020-07-01 20:47:16 +03:00
Alex Plate
5ce25ebc23 Fix deleting from the start of document 2020-07-01 20:47:14 +03:00
Alex Plate
1f4d5b0140 Really ignore property based test 2020-07-01 19:01:51 +03:00
Alex Plate
ddd1a0a5f0 Reset digraph during propertyBased tests 2020-07-01 19:01:08 +03:00
Alex Plate
802c887b60 Well, JetCheck is accessible from IJ sources 2020-07-01 15:55:01 +03:00
Alex Plate
e15fd8fa24 Add initial implementation of property based tests 2020-07-01 15:46:52 +03:00
Alex Plate
034cc3a725 Fix sentence motion with two new lines at start 2020-07-01 15:43:24 +03:00
Alex Plate
f34dcc0386 Add test for block selection on empty file 2020-07-01 15:02:39 +03:00
Alex Plate
a7b278553f Make typeText accessible from non vim test cases 2020-07-01 14:11:14 +03:00
Alex Plate
bd52eb12bd Fix star search on the last dot 2020-06-30 23:08:09 +03:00
Alex Plate
2d9a0a7559 Fix case yk for first line 2020-06-30 22:47:19 +03:00
strogiyotec
67d3698a40 Fix alternative XDG path in README 2020-06-30 11:30:10 -07:00
Alex Plate
7b40281875 Use strict mode in normalize methods 2020-06-30 20:27:41 +03:00
Alex Plate
dc1d01c91d Use ifEmpty method 2020-06-30 19:48:53 +03:00
Alex Plate
1e2618fddc Fix missing set command in docs 2020-06-30 10:22:26 +03:00
Alex Plate
85194b772b Vim.showMessage should show localized string 2020-06-30 10:22:12 +03:00
Alex Plate
5a048139d6 Extract action names and descriptions to message bundle 2020-06-30 10:07:37 +03:00
Alex Plate
7809842348 Remove unused command flags 2020-06-30 09:55:52 +03:00
Alex Plate
c7948374fd Cleanup 2020-06-29 13:30:23 +03:00
Alex Plate
f8afdf304b Use @TestFor instead of custom annotation 2020-06-29 12:21:06 +03:00
Alex Plate
29d617f7bb Fix missing mapping to FileHandler 2020-06-29 11:00:17 +03:00
Alex Plate
0e7b05e360 Continue cleanup 2020-06-29 10:57:53 +03:00
Alex Plate
5f18e99128 Action is not nullable for Command 2020-06-29 10:49:46 +03:00
Alex Plate
b2e0af587f Continue code cleanup 2020-06-29 10:42:02 +03:00
Alex Plate
b0b0817668 Code cleanup 2020-06-29 10:29:52 +03:00
Alex Plate
a6ef654c05 Add tests for exchange plugin with unnamed register in clipboard 2020-06-26 10:43:42 +03:00
Alex Plate
e428b9fa0a IdeaVim should save to unnamed register, not default one 2020-06-26 10:34:06 +03:00
Alex Plate
7008185735 Prepare to the 0.57.1 EAP release 2020-06-26 09:32:57 +03:00
Alex Plate
e4bbc7b962 Change type of string 2020-06-26 09:27:25 +03:00
Alex Plate
68704a2e3d Oh, we have an issue for vim-exchange 2020-06-25 19:44:24 +03:00
Alex Plate
6f0222c55e IntelliJ IDEA wants this properties in this order 2020-06-25 19:43:14 +03:00
Alex Plate
e0646541e8 Revert incompatible changes 2020-06-24 18:57:25 +03:00
Alex Plate
2d1fee0516 Add [version update] marks 2020-06-24 18:17:42 +03:00
Alex Plate
149899c34e Fix fold tests 2020-06-24 18:05:54 +03:00
Alex Plate
c6573b48c2 Convert test to kt 2020-06-24 18:01:34 +03:00
Alex Plate
476ba265d2 Rename .java to .kt 2020-06-24 17:59:42 +03:00
Alex Plate
9904de1946 Use fold action names from platform 2020-06-24 17:54:04 +03:00
Alex Plate
e73aec2e9e Update gradle wrapper 2020-06-23 23:53:59 +03:00
Alex Plate
d6658a1771 Update test 2020-06-23 11:09:25 +03:00
Alex Plate
583988034b Fix incompatibility for 202 eap 2020-06-23 09:55:06 +03:00
Rieon Ke
e57d6f3d97 fix test failure after changing to key notations from printable chars 2020-06-22 22:56:47 +08:00
Rieon Ke
55e553c2a0 add support for putting & editing macros 2020-06-22 22:47:35 +08:00
Alex Plate
44a3263a86 Update CHANGES.md 2020-06-22 11:23:04 +03:00
Alex Plate
80723a6cad Use latest-eap for local builds 2020-06-22 11:16:51 +03:00
Alex Plate
ca15c60d52 Remove the ability to download EAP from notification (access to plugin download mechanism was restricted) 2020-06-22 11:16:43 +03:00
Alex Pláte
8be075b36a Merge pull request #239
Use new API for relative line numbers
2020-06-22 11:16:30 +03:00
Alex Plate
ca203f8297 Add compatibility section 2020-06-21 21:58:59 +03:00
Alex Plate
934c3065b9 Add contributions welcome badge 2020-06-21 21:56:13 +03:00
Matt Ellis
5d95917727 Do not add line numbers when caret moves
Fixes VIM-2021
2020-06-20 19:00:59 +01:00
Alex Plate
a53b67f0ef Add option to disable IdeaVim in dialogs 2020-06-20 18:20:27 +03:00
Matt Ellis
eff13180b3 Update to new line number API
Fixes VIM-1934, fixes VIM-1852
2020-06-19 23:51:46 +01:00
Alex Plate
354aec4713 Disable IdeaVim in database table cells 2020-06-19 18:55:49 +03:00
Alex Plate
d2acb88dd4 Add experimental options to disable IdeaVim in one-line editors and enable escape in dialogs 2020-06-19 16:46:37 +03:00
Alex Plate
e96ece23b8 Add strictMode to enable additional checks in dev mode 2020-06-19 09:45:46 +03:00
Alex Plate
a3a3db9bc8 Extract ListenerSuppressor from ListenerManager 2020-06-19 09:29:49 +03:00
Alex Plate
ede0737261 Update changelog 2020-06-19 07:11:54 +03:00
Alex Plate
dc7efad420 Fix links in CONTRIBUTING.md 2020-06-16 15:34:43 +03:00
Alex Plate
423d51a6f9 Update documentation and contribution section 2020-06-16 15:28:43 +03:00
Alex Plate
c350650f9c Commands work on the last line 2020-06-09 03:41:38 +03:00
Alex Plate
8c3cbc49b3 Add tests for G command 2020-06-09 03:15:16 +03:00
Alex Plate
786b7193d0 getLineCount does now respect last new line character 2020-06-09 03:04:48 +03:00
Alex Plate
2a6acba07f S is now a synonym of cc and doesn't have a separate logic 2020-06-09 03:01:45 +03:00
Alex Plate
e5a5d112ca Deprecate getFileSize method 2020-06-07 20:47:15 +03:00
Alex Plate
9e2cfe548b [WIP] Removing usages of deprecated getFileSize 2020-06-07 19:50:32 +03:00
Alex Plate
f4d595f5c2 [WIP] Removing usages of deprecated getFileSize for SearchHelper 2020-06-07 19:42:01 +03:00
Alex Plate
c1e5b7d111 Remove deprecated usage in different files 2020-06-07 19:35:25 +03:00
Alex Plate
1eccc60cb3 Remove deprecated usage in moveTextHandler 2020-06-07 19:19:29 +03:00
Alex Plate
9f8095ae52 Formatting for MoveTextHandler.kt 2020-06-07 19:17:19 +03:00
Alex Plate
3674cf4aad [WIP] Removing usages of deprecated getFileSize for MotionGroup 2020-06-07 19:17:05 +03:00
Alex Plate
6b0d2157c8 [WIP] Removing usages of deprecated getFileSize for go command 2020-06-07 19:06:04 +03:00
Alex Plate
5a629d6256 [WIP] Removing usages of deprecated getFileSize in getting file info 2020-06-07 18:37:15 +03:00
Alex Plate
b8909f97aa [WIP] Removing usages of depracated getFileSize 2020-06-07 14:13:07 +03:00
Alex Plate
8c83ed6b55 Remove usage of deprecated getFileSize 2020-06-06 18:24:24 +03:00
Alex Plate
b161346171 Trying to get rid of getFileSize with allowEnd 2020-06-06 18:07:15 +03:00
Alex Plate
330e717518 Fix offset bounds 2020-06-04 10:24:18 +03:00
Alex Plate
dafc031ef6 Add checks for selectWord 2020-06-04 10:03:43 +03:00
Alex Plate
b00a2d3b79 Do not get findManager for nullable project
Fixes EA-231806
2020-06-04 09:36:53 +03:00
Alex Plate
c64ec34a1f Fix let mapleader="\<SPACE>" 2020-06-03 11:42:39 +03:00
Alex Plate
8ed709c7bb Use different file for storing local configs 2020-06-03 11:14:37 +03:00
Alex Plate
8e8e52c6f9 Create configuration migrators for IdeaVim 2020-06-03 11:05:48 +03:00
Alex Plate
f3e806c4a6 Create config package 2020-05-28 11:14:53 +03:00
Alex Plate
3bae95ae5b Fix typo 2020-05-28 11:07:10 +03:00
Adrià Farrés
660b243056 Reset operator-pending commands on escape
Suppose we have the text "|Hello, world", with | being the position of
the cursor. Pressing `d<Esc>dw` simply moves the cursor on top of the
comma instead of leaving the text as ", world".

This fixes issue VIM-1421.
2020-05-13 05:03:49 +02:00
358 changed files with 13401 additions and 4205 deletions

View File

@@ -299,6 +299,30 @@ Contributors:
[![icon][github]](https://github.com/pmnoxx)
&nbsp;
Piotr Mikulski
* [![icon][mail]](mailto:14farresa@gmail.com)
[![icon][github]](https://github.com/adriafarres)
&nbsp;
Adrià Farrés
* [![icon][mail]](mailto:patrick.j.elmquist@gmail.com)
[![icon][github]](https://github.com/patrick-elmquist)
&nbsp;
Patrick Elmquist
* [![icon][mail]](mailto:rieon@rieon.cn)
[![icon][github]](https://github.com/rieonke)
&nbsp;
Rieon Ke
* [![icon][mail]](mailto:jiirra@gmail.com)
[![icon][github]](https://github.com/KostkaBrukowa)
&nbsp;
KostkaBrukowa
* [![icon][mail]](mailto:wangyaohuicn@gmail.com)
[![icon][github]](https://github.com/yaohui-wyh)
&nbsp;
Yaohui Wang
* [![icon][mail]](mailto:iain.ballard@bjss.com)
[![icon][github]](https://github.com/i-e-b)
&nbsp;
Iain Ballard
If you are a contributor and your name is not listed here, feel free to
contact the maintainers.

View File

@@ -22,13 +22,64 @@ 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
-------------
_Available since 0.57.1 EAP:_
0.60, 2020-10-09
-----------
**Features:**
* `exchange` plugin emulation ([vim-exchange](https://github.com/tommcdo/vim-exchange)).
* Support of `virtualedit=onemore` ([VIM-844](https://youtrack.jetbrains.com/issue/VIM-844))
**Fixes:**
* [VIM-2097](https://youtrack.jetbrains.com/issue/VIM-2097) Do not apply mappings for register selecting
* [VIM-2080](https://youtrack.jetbrains.com/issue/VIM-2080) Fix S command with count
* [VIM-2099](https://youtrack.jetbrains.com/issue/VIM-2099) Fix operations with backward inclusive motions
* [VIM-2104](https://youtrack.jetbrains.com/issue/VIM-2104) Use `sidescrolloff` for horizontal offset
* [VIM-1080](https://youtrack.jetbrains.com/issue/VIM-1080) Fix `zt` for virtual space enabled
* [VIM-1556](https://youtrack.jetbrains.com/issue/VIM-1556) Fix horizontal scrolling
* [VIM-1770](https://youtrack.jetbrains.com/issue/VIM-1770) Fix goto end with large inline hints
* [VIM-2110](https://youtrack.jetbrains.com/issue/VIM-2110) Fix scrolling for non-monospaced fonts
**Changes:**
* `:w` works as `:wa` by default. This can be disabled with `ideawrite` option.
Now features like `Prettier on save` or `Run on save for files` would work with `:w` command as well.
See [VIM-1968](https://youtrack.jetbrains.com/issue/VIM-1968).
**Merged PRs:**
* [248](https://github.com/JetBrains/ideavim/pull/248) by [Yaohui Wang](https://github.com/yaohui-wyh): Check if project is disposed when editorDeinit
* [242](https://github.com/JetBrains/ideavim/pull/242) by [Iain Ballard](https://github.com/i-e-b): Partial implementation of virtualedit config
* [252](https://github.com/JetBrains/ideavim/pull/252) by [Matt Ellis](https://github.com/citizenmatt): Fixes for scrolling
0.59, 2020-08-25
------------
**Features:**
* `vim-highlightedyank` plugin emulation ([VIM-1970](https://youtrack.jetbrains.com/issue/VIM-1970) | [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank)).
* <details>
<summary><strong>Click to see details</strong></summary>
<img src="resources/changes/0.59/highlight_yank.gif" alt="highlight yank"/>
</details>
* [VIM-2068](https://youtrack.jetbrains.com/issue/VIM-2068) `:tabclose` command
**Fixes:**
* [VIM-1421](https://youtrack.jetbrains.com/issue/VIM-1421) Escape key finishes `t` and `f` motions
* [VIM-2075](https://youtrack.jetbrains.com/issue/VIM-2075) Fix zR command
* [VIM-2059](https://youtrack.jetbrains.com/issue/VIM-2059) Fixed macro editing
**Merged PRs:**
* [237](https://github.com/JetBrains/ideavim/pull/237) by [Adrià Farrés](https://github.com/adriafarres): Reset operator-pending commands on escape
* [241](https://github.com/JetBrains/ideavim/pull/241) by [Patrick Elmquist](https://github.com/patrick-elmquist): Properly reset when pressing Esc in the middle of command
* [244](https://github.com/JetBrains/ideavim/pull/244) by [Rieon Ke](https://github.com/rieonke): Implement tabc[lose] ex command
* [240](https://github.com/JetBrains/ideavim/pull/240) by [Rieon Ke](https://github.com/rieonke): add support for putting & editing macros
* [245](https://github.com/JetBrains/ideavim/pull/245) by [KostkaBrukowa](https://github.com/KostkaBrukowa): VIM-1970 | Working solution of plugin vim-highlightedyank
0.58, 2020-07-07
-------------
**Features:**
* `exchange` plugin emulation ([VIM-921](https://youtrack.jetbrains.com/issue/VIM-921) | [vim-exchange](https://github.com/tommcdo/vim-exchange)).
* `~/.ideavimrc` file can be reloaded using the new floating action.
* <details>
@@ -44,6 +95,12 @@ _Available since 0.57.1 EAP:_
**Fixes:**
* [VIM-1994](https://youtrack.jetbrains.com/issue/VIM-1994) Correct paste after `y}P` command.
* [VIM-1924](https://youtrack.jetbrains.com/issue/VIM-1924) Select next occurrence doesn't become block selection.
* [VIM-2038](https://youtrack.jetbrains.com/issue/VIM-2038) Last line is now accessible in normal mode
* [VIM-1934](https://youtrack.jetbrains.com/issue/VIM-1934) Line number is not clipped for relative line numbers
* [VIM-1852](https://youtrack.jetbrains.com/issue/VIM-1852) Line number doesn't flickers for relative line numbers
* [VIM-2021](https://youtrack.jetbrains.com/issue/VIM-2021) Line numbers don't reactivating
* Fix mappings to `"\<SPACE>"` including `let mapleader="\<SPACE>"`
**Merged PRs:**
* [233](https://github.com/JetBrains/ideavim/pull/233) by [valis](https://github.com/valis): [VIM-1994] Correct paste after `y}P` command.
@@ -51,11 +108,7 @@ _Available since 0.57.1 EAP:_
* [227](https://github.com/JetBrains/ideavim/pull/227) by [angelbot](https://github.com/angelbot): Add support for buffer command.
* [230](https://github.com/JetBrains/ideavim/pull/230) by [fan-tom](https://github.com/fan-tom): VIM-1924.
* [231](https://github.com/JetBrains/ideavim/pull/231) by [citizenmatt](https://github.com/citizenmatt): Support smooth scrolling.
_To Be Released..._
...
* [239](https://github.com/JetBrains/ideavim/pull/239) by [citizenmatt](https://github.com/citizenmatt): Use new API for relative line numbers
0.57, 2020-04-28
-------------

View File

@@ -1,71 +1,140 @@
[![TeamCity Build][teamcity-build-status-svg]][teamcity-build-status]
IdeaVim is an open source project created by 60+ contributors. Would you like to make it even better? Thats wonderful!
### Where to Start
This page is created to help you start contributing. And who knows, maybe in a few days this project will be brighter than ever!
In order to contribute to IdeaVim, you should have some understanding of [Kotlin](https://kotlinlang.org/) or Java.
## Before you begin
See also these docs on the IntelliJ API:
- The project is written in Kotlin and Java. Choose whichever language you feel more comfortable with,
or maybe one that youd like to get to know better (why not start [learning Kotlin](https://kotlinlang.org/docs/tutorials/) right now?).
* [IntelliJ architectural overview](https://www.jetbrains.org/intellij/sdk/docs/platform/fundamentals.html)
* [IntelliJ plugin development resources](https://www.jetbrains.org/intellij/sdk/docs/welcome.html)
- If you come across some IntelliJ Platform code, these links may prove helpful:
You can start by:
* [IntelliJ architectural overview](https://www.jetbrains.org/intellij/sdk/docs/platform/fundamentals.html)
* [IntelliJ plugin development resources](https://www.jetbrains.org/intellij/sdk/docs/welcome.html)
- Picking relatively simple tasks that are tagged with
- Having any difficulties?
Join the brand new
[![Join the chat at https://gitter.im/JetBrains/ideavim](https://badges.gitter.im/JetBrains/ideavim.svg)](https://gitter.im/JetBrains/ideavim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
for IdeaVim developers and contributors!
OK, ready to do some coding?
## Yes, I'm ready for some coding
* Fork the repository and clone it to the local machine.
* Open the project with IntelliJ IDEA.
Yoo hoo! Youre all set to begin contributing. Here are some useful gradle commands:
* `./gradlew runIde` — start the dev version of IntelliJ IDEA with IdeaVim installed.
* `./gradlew test` — run tests.
* `./gradlew buildPlugin` — build the plugin. The result will be located in `build/distributions`. This file can be
installed by using `Settings | Plugin | >Gear Icon< | Install Plugin from Disk...`. You can stay with your personal build
for a few days or send it to a friend for testing.
## Warmup
- Pick a few relatively simple tasks that are tagged with
[#patch_welcome](https://youtrack.jetbrains.com/issues/VIM?q=%23patch_welcome%20%23Unresolved%20sort%20by:%20votes%20)
in the issue tracker.
- Read about the `@VimBehaviorDiffers` annotation and fix the corresponding functionality.
in the issue tracker.
- Read the javadoc for the `@VimBehaviorDiffers` annotation in the source code and fix the corresponding functionality.
- Implement one of the requested [#vim plugin](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved%20tag:%20%7Bvim%20plugin%7D%20sort%20by:%20votes%20)s.
Also join the brand new [![Join the chat at https://gitter.im/JetBrains/ideavim](https://badges.gitter.im/JetBrains/ideavim.svg)](https://gitter.im/JetBrains/ideavim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) for IdeaVim developers!
> :small_orange_diamond: Selected an issue to work on? Leave a comment in a YouTrack ticket or create a draft PR
> to indicate that you've started working on it so that you might get additional guidance and feedback from the maintainers.
## Where to start in the codebase
If you are looking for:
- Vim commands (`w`, `<C-O>`, `p`, etc.):
- Any particular command: `package-info.java`.
- How commands are executed in common: `EditorActionHandlerBase`.
- Key mapping: `KeyHandler.handleKey()`.
- Ex commands (`:set`, `:s`, `:nohlsearch`):
- Any particular ex command: package `com.maddyhome.idea.vim.ex.handler`.
- Ex command executor: `CommandHandler`.
- Extensions:
- Extensions handler: `VimExtensionHandler`.
- Available extensions: package `com/maddyhome/idea/vim/extension`.
- Common features:
- State machine. How every particular keystroke is parsed in IdeaVim: `KeyHandler.handleKey()`.
- Options (`incsearch`, `iskeyword`, `relativenumber`): `OptionsManager`.
- Plugin startup: `PluginStartup`.
- Notifications: `NotificationService`.
- Status bar icon: `StatusBar.kt`.
- On/off switch: `VimPlugin.setEnabled()`.
### Development Environment
## Testing
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
Here are some guides for testing:
2. Import the project from the existing sources in IntelliJ IDEA 2018.1 or newer (Community or
Ultimate), by selecting "File | New | Project from Existing Sources..." or selecting "Import
Project" from the Welcome screen.
* In the project wizard, select "Import project from external model | Gradle".
1. Read the javadoc for the `@VimBehaviorDiffers` annotation in the source code.
2. Please avoid senseless text like "dhjkwaldjwa", "asdasdasd", "123 123 123 123", etc. Try to choose an example
text that is easy to read and understand what is wrong if the test fails. For example, take a few lines from your
favorite poem, or use Vladimir Nabokovs “A Discovery" if you don't have one.
3. Don't forget to test your functionality with line start, line end, file start, file end, empty line, multiple
carets, dollar motion, etc.
* Select your Java 8+ JDK as the Gradle JVM; leave other parameters unchanged.
3. Run your IdeaVim plugin within IntelliJ via a Gradle task:
##### Neovim
IdeaVim has an experimental integration with neovim in tests. Tests that are performed with `doTest` also executed in
neovim instance, and the state of IdeaVim is asserted to be the same as the state of neovim.
- Only tests that use `doTest` are checked with neovim.
- Tests with `@VimBehaviorDiffers` or `@TestWithoutNeovim` annotations don't use neovim.
* Select the "View | Tool Windows | Gradle" tool window.
* Launch "ideavim | intellij | runIde" from the tool window.
#### Property-based tests
Property-based tests are located under `propertybased` package. These tests a flaky by nature
although in most cases they are stable. If the test fails on your TeamCity run, try to check the test output and understand
if the fail is caused by your changes. If it's not, just ignore the test.
4. Run IdeaVim tests via a Gradle task:
* Select the "View | Tool Windows | Gradle" tool window.
* Launch "ideavim | verification | test" from the tool window.
## A common direction
5. Build the plugin distribution by running `./gradlew clean buildPlugin` in the
terminal in your project root.
Were trying to make IdeaVim close to the original Vim both in terms of functionality and architecture.
* The resulting distribution file will be located at build/distributions/IdeaVim-VERSION.zip
- Vim motions can be [either inclusive, exclusive, or linewise](http://vimdoc.sourceforge.net/htmldoc/motion.html#inclusive).
In IdeaVim, you can use `MotionType` for that.
- Have you read the [interesting things](https://github.com/JetBrains/ideavim#some-facts-about-vim) about IdeaVim?
Do you remember how `dd`, `yy`, and other similar commands work? `DuplicableOperatorAction` will help you with that.
And we also translate it to `d_` and `y_`: `KeyHandler.mapOpCommand()`.
- All IdeaVim extensions use the same command names as the originals (e.g. `<Plug>(CommentMotion)`, `<Plug>ReplaceWithRegisterLine`),
so you can reuse your `.vimrc` settings.
We also support proper command mappings (functions are mapped to `<Plug>...`), the operator function (`OperatorFunction`), and so on.
- Magic is supported as well. See `Magic`.
* You can install this file by selecting "Settings | Plugins | Install plugin
from disk...".
### Testing
-----
1. Read about the `@VimBehaviorDiffers` annotation.
### I read the whole page but something is still unclear.
2. Please avoid senseless text like "dhjkwaldjwa", "asdasdasd",
"123 123 123 123", etc. Try to choose an example text that is easy to
read and understand what is wrong if the test fails.
For example, take a few lines from your favorite poem, or use
"Vladimir Nabokov A Discovery" if you don't have one.
Oh no! No cookies for the maintainers today! Please [tell us](https://github.com/JetBrains/ideavim#contact-maintainers) about it so we can help.
3. Test your functionality properly.
Especially check whether your command works with:
line start, line end, file start, file end, empty line, multiple carets, dollar motion, etc.
<!-- Badges -->
### Ive found a bug in this documentation.
No beer in the bar for us unless it's fixed. [Let us know](https://github.com/JetBrains/ideavim#contact-maintainers) situation so we might be able to fix it.
### The lack of documentation or a javadoc/ktdoc makes it difficult to start contributing.
This is just terrible. [You know what to do](https://github.com/JetBrains/ideavim#contact-maintainers).
### Resources:
* [Continuous integration builds](https://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
* [Chat on gitter](https://gitter.im/JetBrains/ideavim)
* [Unofficial discord server](https://jb.gg/bi6zp7)
* [Plugin homepage](https://plugins.jetbrains.com/plugin/164-ideavim)
* [Changelog](CHANGES.md)
* [Contributors listing](AUTHORS.md)
[teamcity-build-status]: https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20201&guest=1
[teamcity-build-status-svg]: https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20201)/statusIcon.svg?guest=1

188
README.md
View File

@@ -4,6 +4,7 @@ IdeaVim
===
[![Official JetBrains Project][jb-official-svg]][jb-official]
[![Contributions welcome][contributions-welcome-svg]][contributions-welcome]
[![Downloads][plugin-downloads-svg]][plugin-repo]
[![Rating][plugin-rating-svg]][plugin-repo]
[![Version][plugin-version-svg]][plugin-repo]
@@ -11,31 +12,38 @@ IdeaVim
[![Twitter][twitter-svg]][twitter]
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform.
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
Resources:
##### Contact maintainers:
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
* [@IdeaVim](https://twitter.com/ideavim) on Twitter
* [Chat on gitter](https://gitter.im/JetBrains/ideavim)
* [Unofficial discord server](https://jb.gg/bi6zp7)
##### Resources:
* [Plugin homepage](https://plugins.jetbrains.com/plugin/164-ideavim)
* [Changelog](CHANGES.md)
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
* [Continuous integration builds](https://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
* [@IdeaVim](https://twitter.com/ideavim) in Twitter
#### Compatibility
IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive,
Android Studio and other IntelliJ platform based IDEs.
Setup
------------
- IdeaVim can be installed via `Settings | Plugins`.
See [detailed instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#).
See the [detailed instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#).
- Use `Tools | Vim Emulator` to enable or disable emulation.
- Use `~/.ideavimrc` file as an analog of `~/.vimrc` ([details](#Files)). XGD standard is supported as well.
- Use the `~/.ideavimrc` file as an analog of `~/.vimrc` ([learn more](#Files)). The XDG standard is supported, as well.
- Shortcut conflicts can be resolved using:
- Linux & Windows: `File | Settings | Editor | Vim Emulation` & `File | Settings | Keymap`,
- macOS: `Preferences | Editor | Vim Emulation` & `Preferences | Keymap`,
- regular vim mappings in the `~/.ideavimrc` file.
- Shortcut conflicts can be resolved by using:
- On Linux & Windows: `File | Settings | Editor | Vim Emulation` & `File | Settings | Keymap`,
- On macOS: `Preferences | Editor | Vim Emulation` & `Preferences | Keymap`,
- Regular Vim mappings in the `~/.ideavimrc` file.
Get Early Access
-------------------
@@ -67,25 +75,16 @@ You can always leave your feedback with:
Summary of Supported Vim Features
---------------------------------
Supported:
Here are some examples of supported vim features and commands:
* Motion keys
* Deletion/changing
* Insert mode commands
* Marks
* Registers
* Undo/redo
* Visual mode commands
* Some Ex commands
* Some [:set options](doc/set-commands.md)
* Full Vim regexps for search and search/replace
* Normal / insert / visual / select / etc. modes
* Motion / deletion / change / window / etc. commands
* Key mappings
* Macros
* Digraphs
* Command line and search history
* Window commands
* Marks / Macros / Digraphs / Registers
* Some [set commands](doc/set-commands.md)
* Full Vim regexps for search and search/replace
* Vim web help
* Select mode
* `~/.ideavimrc` configuration file
[Emulated Vim plugins](doc/emulated-plugins.md):
@@ -96,17 +95,13 @@ Supported:
* argtextobj.vim
* vim-textobj-entire
* ReplaceWithRegister
* vim-exchange [To Be Released]
Not supported (yet):
* Jump lists
* Various less-used commands
* vim-exchange
* vim-highlightedyank
See also:
* [The list of all supported commands](src/com/maddyhome/idea/vim/package-info.java)
* [Top features and bugs](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
* [Top feature requests and bugs](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
Files
@@ -114,12 +109,63 @@ Files
* `~/.ideavimrc`
* Your IdeaVim-specific Vim initialization commands
<details>
<summary><strong>Example</strong> (click to see)</summary>
```vim
""" Map leader to space ---------------------
let mapleader=" "
""" Plugins --------------------------------
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
""" Plugin settings -------------------------
let g:argtextobj_pairs="[:],(:),<:>"
""" Common settings -------------------------
set showmode
set so=5
set incsearch
set nu
""" Idea specific settings ------------------
set ideajoin
set ideastatusicon=gray
set idearefactormode=keep
""" Mappings --------------------------------
map <leader>f <Plug>(easymotion-s)
map <leader>e <Plug>(easymotion-f)
map <leader>d :action Debug<CR>
map <leader>r :action RenameElement<CR>
map <leader>c :action Stop<CR>
map <leader>z :action ToggleDistractionFreeMode<CR>
map <leader>s :action SelectInProjectView<CR>
map <leader>a :action Annotate<CR>
map <leader>h :action Vcs.ShowTabbedFileHistory<CR>
map <S-Space> :action GotoNextError<CR>
map <leader>b :action ToggleLineBreakpoint<CR>
map <leader>o :action FileStructurePopup<CR>
```
</details>
You can read your `~/.vimrc` file from `~/.ideavimrc` with this command:
source ~/.vimrc
Note, that IdeaVim currently parses `~/.ideavimrc` file via simple pattern matching.
Please note that IdeaVim currently parses `~/.ideavimrc` & `~/.vimrc` files via simple pattern-matching.
See [VIM-669](https://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
of VimL files.
@@ -129,7 +175,7 @@ have `-Duser.home=/my/alternate/home` then IdeaVim will source
`/my/alternate/home/.ideavimrc` instead of `~/.ideavimrc`.
Alternatively, you can set up initialization commands using [XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) standard.
Put your settings to `$XDG_CONFIG_HOME$/ideavim/ideavimrc` file.
Put your settings to `$XDG_CONFIG_HOME/ideavim/ideavimrc` file.
Emulated Vim Plugins
@@ -150,9 +196,18 @@ Ex commands or via `:map` command mappings:
* `:action {name}`
* Execute an action named `NAME`
For example, here `\r` is mapped to the Reformat Code action:
Examples:
:map \r :action ReformatCode<CR>
```vim
" Map \r to the Reformat Code action
:map \r :action ReformatCode<CR>
" Map <leader>d to start debug
:map <leader>d :action Debug<CR>
" Map \b to toggle the breakpoint on the current line
:map \b :action ToggleLineBreakpoint<CR>
```
### Undo/Redo
@@ -172,10 +227,12 @@ improvement.
See also [unresolved escape issues](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
Contributing
:gem: Contributing
------------
See [CONTRIBUTING.md](CONTRIBUTING.md)
The power of contributing drives IdeaVim :muscle:. Even small contributions matter!
See [CONTRIBUTING.md](CONTRIBUTING.md) to start bringing your value to the project.
Authors
-------
@@ -183,6 +240,54 @@ Authors
See [AUTHORS.md](AUTHORS.md)
for a list of authors and contributors.
IdeaVim tips and tricks
-------
- Use the power of IJ and Vim:
- `set ideajoin` to enable join via the IDE. See the [examples](https://jb.gg/f9zji9).
- Make sure `ideaput` is enabled for `clipboard` to enable native IJ insertion in Vim.
- Sync IJ bookmarks and Vim marks: `set ideamarks`
- Check out more [ex commands](doc/set-commands.md).
- Use your vim settings with IdeaVim. Put `source ~/.vimrc` in `~/.ideavimrc`.
> :warning: Please note that IdeaVim currently parses `~/.ideavimrc` & `~/.vimrc` files via simple pattern-matching.
See [VIM-669](https://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
of VimL files.
- Control the status bar icon via the [`ideastatusicon` option](doc/set-commands.md).
- Not familiar with the default behaviour during a refactoring? See the [`idearefactormode` option](doc/set-commands.md).
Some facts about Vim
-------
Lets relax and have some fun now! Here are a few things we've found interesting during development
and would like to share with you.
- There are no such commands as `dd`, `yy`, or `cc`. For example, `dd` is not a separate command for deleting the line,
but a `d` command with a `d` motion.
Wait, but there isn't a `d` motion in Vim! Thats right, and thats why Vim has a dedicated set of commands
for which it checks whether the
[command equals to motion](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/normal.c#L6468)
and if so, it executes `_` motion instead.
`_` is an interesting motion that isn't even documented in vi, and it refers to the current line.
So, commands like `dd`, `yy`, and similar ones are simply translated to `d_`, `y_`, etc.
[Here](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/normal.c#L6502)
is the source of this knowledge.
- `x`, `D`, and `&` are not separate commands either. They are synonyms of `dl`, `d$`, and `:s\r`, respectively.
[Here](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/normal.c#L5365)
is the full list of synonyms.
- Have you ever used `U` after `dd`? [Don't even try](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/ops.c#L874).
- A lot of variables that refers to visual mode start with two uppercase letters, e.g. `VIsual_active`. [Some examples](https://github.com/vim/vim/blob/master/src/normal.c#L17).
- Other [strange things](https://github.com/vim/vim/blob/759d81549c1340185f0d92524c563bb37697ea88/src/ex_docmd.c#L1845) from vi:
* ":3" jumps to line 3
* ":3|..." prints line 3
* ":|" prints current line
- Vim script doesn't skip white space before comma. `F(a ,b)` => E475.
License
-------
@@ -205,3 +310,6 @@ or any later version.
[twitter]: https://twitter.com/ideavim
[twitter-svg]: https://img.shields.io/twitter/follow/ideavim?label=twitter%20%40ideavim
[contributions-welcome-svg]: http://img.shields.io/badge/contributions-welcome-brightgreen
[contributions-welcome]: https://github.com/JetBrains/ideavim/blob/master/CONTRIBUTING.md

View File

@@ -53,6 +53,9 @@ repositories {
dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compileOnly "org.jetbrains:annotations:19.0.0"
// https://mvnrepository.com/artifact/com.ensarsarajcic.neovim.java/neovim-api
compile group: 'com.ensarsarajcic.neovim.java', name: 'neovim-api', version: '0.1.16'
}
compileKotlin {
@@ -66,6 +69,11 @@ compileTestKotlin {
}
}
task testWithNeovim(type : Test) {
group = "verification"
systemProperty "ideavim.neovim.test", 'true'
}
tasks.register("slackEapNotification") {
doLast {
if (!slackUrl) return
@@ -82,7 +90,7 @@ tasks.register("slackEapNotification") {
"type": "section",
"text": {
"type": "mrkdwn",
"text": "IdeaVim EAP $version has been relesed\\n$changeLog"
"text": "IdeaVim EAP $version has been released\\n$changeLog"
}
}
]
@@ -122,4 +130,4 @@ def extractChangelog() {
}
}
return res.toString()
}
}

View File

@@ -34,12 +34,14 @@ Available extensions:
* Setup: `set commentary`
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
* Commands: `gcc`, `gc + motion`, `v_gc`
* By [Daniel Leong](https://github.com/dhleong)
## ReplaceWithRegister
* Setup: `set ReplaceWithRegister`
* Emulates [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister)
* Commands: `gr`, `grr`
* By [igrekster](https://github.com/igrekster)
## argtextobj
@@ -54,15 +56,29 @@ Available extensions:
* Emulates [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699)
* Additional text objects: `aa`, `ia`
## exchange [To Be Released]
## exchange
* Setup: `set exchange`
* Emulates [vim-exchange](https://github.com/tommcdo/vim-exchange)
* Commands: `cx`, `cxx`, `X`, `cxc`
* By [fan-tom](https://github.com/fan-tom)
## textobj-entire
* Setup: `set textobj-entire`
* Emulates [vim-textobj-entire](https://github.com/kana/vim-textobj-entire)
* Additional text objects: `ae`, `ie`
* By [Alexandre Grison](https://github.com/agrison)
## highlightedyank
* Setup:
* `set highlightedyank`
* if you want to optimize highlight duration, assign a time in milliseconds:
`let g:highlightedyank_highlight_duration = "1000"`
A negative number makes the highlight persistent.
`let g:highlightedyank_highlight_duration = "-1"`
* if you want to change background color of highlight you can provide the rgba of the color you want e.g.
`let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"`
* Emulates [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank)
* By [KostkaBrukowa](https://github.com/KostkaBrukowa)

View File

@@ -38,6 +38,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
acts like startsel is enabled
'matchpairs' 'mps' pairs of characters that "%" can match
'more' 'more' When on, listings pause when the whole screen is filled.
'nrformats' 'nf' number formats recognized for CTRL-A command
'number' 'nu' print the line number in front of each line
'relativenumber' 'rnu' show the line number relative to the line with
@@ -118,6 +119,13 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
- enabled - icon is shown in the status bar
- gray - use the gray version of the icon
- disabled - hide the icon
`ideawrite` `ideawrite` String (default "all")
"file" or "all". Defines the behaviour of ":w" command.
Value "all" enables execution of ":wa" (save all) command on ":w" (save).
This feature exists because some IJ options like "Prettier on save" or "ESlint on save"
work only with "save all" action. If this option is set to "all", these actions work
also with ":w" command.
`lookupkeys` `lookupkeys` List of strings

View File

@@ -1,6 +1,6 @@
# suppress inspection "UnusedProperty" for whole file
ideaVersion=2020.1
ideaVersion=LATEST-EAP-SNAPSHOT
downloadIdeaSources=true
instrumentPluginCode=true
version=SNAPSHOT

Binary file not shown.

View File

@@ -1,6 +1,5 @@
#Fri Apr 10 10:57:10 MSK 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

31
gradlew vendored
View File

@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

4
gradlew.bat vendored
View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

View File

@@ -150,6 +150,8 @@
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenColumnAction" mappingModes="NXO" keys="ze"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnLeftAction" mappingModes="NXO" keys="zl,z«Right»"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnRightAction" mappingModes="NXO" keys="zh,z«Left»"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfWidthLeftAction" mappingModes="NXO" keys="zL"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfWidthRightAction" mappingModes="NXO" keys="zH"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftDownAction" mappingModes="NV" keys="«S-Down»"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.updown.MotionShiftUpAction" mappingModes="NV" keys="«S-Up»"/>
<vimAction implementation="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftRightAction" mappingModes="NV" keys="«S-Right»"/>

View File

@@ -15,6 +15,7 @@
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ActionHandler" names="action"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.EchoHandler" names="ec[ho]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.ExitHandler" names="qa[ll],quita[ll],wqa[ll],xa[ll]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FileHandler" names="f[ile]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindClassHandler" names="cla[ss]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindFileHandler" names="fin[d]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.FindSymbolHandler" names="sym[bol]"/>
@@ -60,6 +61,7 @@
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextTabHandler" names="tabn[ext]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PreviousTabHandler" names="tabp[revious],tabN[ext]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabOnlyHandler" names="tabo[nly]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabCloseHandler" names="tabc[lose]"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.BufferListHandler" names="buffers,ls,files"/>
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.BufferHandler" names="b[uffer]"/>
</extensions>

View File

@@ -7,5 +7,6 @@
<vimExtension implementation="com.maddyhome.idea.vim.extension.argtextobj.VimArgTextObjExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.replacewithregister.ReplaceWithRegister"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.highlightedyank.VimHighlightedYank"/>
</extensions>
</idea-plugin>

View File

@@ -3,9 +3,8 @@
<id>IdeaVIM</id>
<change-notes><![CDATA[
<ul>
<li>vim-exchange plugin emulation</li>
<li>A new floating action for reloading .ideavimrc</li>
<li>Various bug fixes</li>
<li>Support of `virtualedit=onemore`</li>
<li>A lot of fixes for scrolling</li>
</ul>
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
]]></change-notes>
@@ -23,7 +22,7 @@
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
<!-- Check for [Version Update] tag in YouTrack as well -->
<idea-version since-build="201.5985"/>
<idea-version since-build="201.5985.32"/>
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
<depends>com.intellij.modules.lang</depends>
@@ -54,7 +53,7 @@
<statusBarWidgetFactory implementation="com.maddyhome.idea.vim.ui.StatusBarIconFactory"/>
<statusBarWidgetFactory implementation="com.maddyhome.idea.vim.ui.ShowCmdStatusBarWidgetFactory" order="first"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimLocalConfig"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.config.VimLocalConfig"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimPlugin"/>
<!-- Initialise as early as possible so that we're ready to edit quickly. This is especially important for Rider,
@@ -72,15 +71,16 @@
<xi:include href="/META-INF/includes/VimListeners.xml" xpointer="xpointer(/idea-plugin/*)"/>
<actions>
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.action.VimPluginToggleAction" text="Vim Emulator" description="Toggle the vim plugin On/off">
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.action.VimPluginToggleAction">
<add-to-group group-id="ToolsMenu" anchor="last"/>
</action>
<!-- Internal -->
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Add Test Inlays | IdeaVim Internal" internal="true"/>
<action id="VimInternalAddBlockInlays" class="com.maddyhome.idea.vim.action.internal.AddBlockInlaysAction" text="Add Test Block Inlays | IdeaVim Internal" internal="true"/>
<action id="VimInternalAddInlineInlays" class="com.maddyhome.idea.vim.action.internal.AddInlineInlaysAction" text="Add Test Inline Inlays | IdeaVim Internal" internal="true"/>
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
<action id="VimActions" class="com.maddyhome.idea.vim.ui.VimActions" text="Vim Actions"/>
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction"/>
<action id="VimActions" class="com.maddyhome.idea.vim.ui.VimActions"/>
<!-- [Version Update] 202+ use-shortcut-of="ExternalSystem.ProjectRefreshAction" -->
<group id="IdeaVim.ReloadVimRc.group" class="com.maddyhome.idea.vim.ui.ReloadFloatingToolbarActionGroup">
@@ -95,5 +95,9 @@
<keyboard-shortcut first-keystroke="meta shift I" keymap="Mac OS X 10.5+" replace-all="true"/>
</action>
</group>
<action id="VimFindActionIdAction"
class="com.maddyhome.idea.vim.listener.FindActionIdAction" text="IdeaVim: Track Action Ids"
description="Starts tracking ids of executed actions"/>
</actions>
</idea-plugin>

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@@ -70,3 +70,10 @@ unkopt=Unknown option: {0}
e_invarg=Invalid argument: {0}
E475=E475: Invalid argument: {0}
E774=E774: 'operatorfunc' is empty
action.VimPluginToggle.text=Vim Emulator
description.VimPluginToggle.description=Toggle the vim plugin On/off
action.VimShortcutKeyAction.text=Shortcuts
action.VimActions.text=Vim Actions

View File

@@ -19,15 +19,9 @@
package com.maddyhome.idea.vim;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.TemplateManagerListener;
import com.intellij.find.FindManager;
import com.intellij.find.FindModelListener;
import com.intellij.ide.bookmarks.BookmarksListener;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.actionSystem.ex.AnActionListener;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
@@ -35,10 +29,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.actionSystem.TypedAction;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.event.*;
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.util.messages.MessageBusConnection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -46,8 +37,6 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Map;
/**
* @author vlan
@@ -87,7 +76,7 @@ public class EventFacade {
action.registerCustomShortcutSet(shortcutSet, component, disposable);
}
public void unregisterCustomShortcutSet(@NotNull AnAction action, @Nullable JComponent component) {
public void unregisterCustomShortcutSet(@NotNull AnAction action, @NotNull JComponent component) {
action.unregisterCustomShortcutSet(component);
}

View File

@@ -337,7 +337,8 @@ public class KeyHandler {
if (commandBuilder.isAwaitingCharOrDigraphArgument()
|| commandBuilder.isBuildingMultiKeyCommand()
|| isMappingDisabledForKey(key, commandState)) {
|| isMappingDisabledForKey(key, commandState)
|| commandState.getSubMode() == CommandState.SubMode.REGISTER_PENDING) {
return false;
}
@@ -560,20 +561,33 @@ public class KeyHandler {
return true;
}
@SuppressWarnings("RedundantIfStatement")
private boolean isCommandCountKey(char chKey, @NotNull CommandState editorState) {
// Make sure to avoid handling '0' as the start of a count.
final CommandBuilder commandBuilder = editorState.getCommandBuilder();
return ((editorState.getMode() == CommandState.Mode.COMMAND
&&editorState.getSubMode()!=CommandState.SubMode.REGISTER_PENDING)
|| editorState.getMode() == CommandState.Mode.VISUAL)
&& commandBuilder.isExpectingCount() && Character.isDigit(chKey) && (commandBuilder.getCount() > 0 || chKey != '0');
boolean notRegisterPendingCommand = editorState.getMode() == CommandState.Mode.COMMAND &&
editorState.getSubMode() != CommandState.SubMode.REGISTER_PENDING;
boolean visualMode = editorState.getMode() == CommandState.Mode.VISUAL;
boolean opPendingMode = editorState.getMode() == CommandState.Mode.OP_PENDING;
if (notRegisterPendingCommand || visualMode || opPendingMode) {
if (commandBuilder.isExpectingCount() &&
Character.isDigit(chKey) &&
(commandBuilder.getCount() > 0 || chKey != '0')) {
return true;
}
}
return false;
}
private boolean isDeleteCommandCountKey(@NotNull KeyStroke key, @NotNull CommandState editorState) {
// See `:help N<Del>`
final CommandBuilder commandBuilder = editorState.getCommandBuilder();
return (editorState.getMode() == CommandState.Mode.COMMAND || editorState.getMode() == CommandState.Mode.VISUAL)
&& commandBuilder.isExpectingCount() && commandBuilder.getCount() > 0 && key.getKeyCode() == KeyEvent.VK_DELETE;
return (editorState.getMode() == CommandState.Mode.COMMAND ||
editorState.getMode() == CommandState.Mode.VISUAL ||
editorState.getMode() == CommandState.Mode.OP_PENDING) &&
commandBuilder.isExpectingCount() &&
commandBuilder.getCount() > 0 &&
key.getKeyCode() == KeyEvent.VK_DELETE;
}
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
@@ -800,7 +814,7 @@ public class KeyHandler {
if (editorState.isDotRepeatInProgress() && VimRepeater.Extension.INSTANCE.getArgumentCaptured() != null) {
commandBuilder.completeCommandPart(VimRepeater.Extension.INSTANCE.getArgumentCaptured());
}
editorState.pushModes(editorState.getMode(), CommandState.SubMode.OP_PENDING);
editorState.pushModes(CommandState.Mode.OP_PENDING, CommandState.SubMode.NONE);
break;
case DIGRAPH:
// Command actions represent the completion of a command. Showcmd relies on this - if the action represents a

View File

@@ -17,9 +17,7 @@
*/
package com.maddyhome.idea.vim;
import com.intellij.openapi.extensions.ExtensionPointListener;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.PluginDescriptor;
import com.maddyhome.idea.vim.group.KeyGroup;
import com.maddyhome.idea.vim.handler.ActionBeanClass;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;

View File

@@ -40,6 +40,9 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
import com.maddyhome.idea.vim.config.VimLocalConfig;
import com.maddyhome.idea.vim.config.VimState;
import com.maddyhome.idea.vim.config.migration.ApplicationConfigurationMigrator;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser;
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar;
@@ -55,6 +58,7 @@ import com.maddyhome.idea.vim.ui.StatusBarIconFactory;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import com.maddyhome.idea.vim.ui.VimRcFileState;
import org.jdom.Element;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -77,7 +81,7 @@ import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
@State(name = "VimSettings", storages = {@Storage("$APP_CONFIG$/vim_settings.xml")})
public class VimPlugin implements PersistentStateComponent<Element>, Disposable {
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
private static final int STATE_VERSION = 6;
public static final int STATE_VERSION = 7;
private static long lastBeepTimeMillis;
@@ -94,6 +98,10 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
private final @NotNull VimState state = new VimState();
VimPlugin() {
ApplicationConfigurationMigrator.getInstance().migrate();
}
public void initialize() {
LOG.debug("initComponent");
@@ -241,9 +249,13 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
public void executeIdeaVimRc() {
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
if (ideaVimRc != null) {
LOG.info("Execute ideavimrc file: " + ideaVimRc.getAbsolutePath());
List<String> parsedLines = VimScriptParser.executeFile(ideaVimRc);
VimRcFileState.INSTANCE.saveFileState(ideaVimRc.getAbsolutePath(), parsedLines);
}
else {
LOG.info("ideavimrc file isn't found");
}
}
public static @NotNull PluginId getPluginId() {
@@ -315,7 +327,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
showMessage(msg);
}
public static void showMessage(@Nullable String msg) {
public static void showMessage(@Nls @Nullable String msg) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
getInstance().message = msg;
}

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.actionSystem.ActionPlan
import com.intellij.openapi.editor.actionSystem.TypedActionHandler
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx
import com.maddyhome.idea.vim.helper.EditorDataContext
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
import java.awt.event.KeyAdapter
import java.awt.event.KeyEvent
import javax.swing.KeyStroke
@@ -41,12 +42,22 @@ class VimTypedActionHandler(origHandler: TypedActionHandler?) : TypedActionHandl
}
override fun beforeExecute(editor: Editor, charTyped: Char, context: DataContext, plan: ActionPlan) {
if (editor.isIdeaVimDisabledHere) {
(handler.originalHandler as? TypedActionHandlerEx)?.beforeExecute(editor, charTyped, context, plan)
return
}
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
handler.beforeHandleKey(editor, keyStroke, context, plan)
}
override fun execute(editor: Editor, charTyped: Char, context: DataContext) {
if (editor.isIdeaVimDisabledHere) {
handler.originalHandler.execute(editor, charTyped, context)
return
}
try {
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
@@ -71,4 +82,4 @@ object VimKeyListener : KeyAdapter() {
override fun keyPressed(e: KeyEvent) {
isSpaceShift = e.modifiersEx and KeyEvent.SHIFT_DOWN_MASK != 0 && e.keyChar == ' '
}
}
}

View File

@@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.getTopLevelEditor
class ResetModeAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.RESET
override val type: Command.Type = Command.Type.OTHER_WRITABLE
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.getInstance().fullReset(editor.getTopLevelEditor())

View File

@@ -20,8 +20,8 @@ package com.maddyhome.idea.vim.action
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareToggleAction
import com.maddyhome.idea.vim.ui.VimActions
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.ui.VimActions
/**
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option

View File

@@ -26,8 +26,6 @@ import com.intellij.openapi.actionSystem.EmptyAction
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.ex.util.EditorUtil
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.util.Key
@@ -39,6 +37,8 @@ import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.StringHelper
import com.maddyhome.idea.vim.helper.inInsertMode
import com.maddyhome.idea.vim.helper.inNormalMode
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
import com.maddyhome.idea.vim.helper.isPrimaryEditor
import com.maddyhome.idea.vim.key.ShortcutOwner
import com.maddyhome.idea.vim.listener.IdeaSpecifics.aceJumpActive
import com.maddyhome.idea.vim.option.OptionsManager
@@ -82,6 +82,7 @@ class VimShortcutKeyAction : AnAction(), DumbAware {
val editor = getEditor(e)
val keyStroke = getKeyStroke(e)
if (editor != null && keyStroke != null) {
if (editor.isIdeaVimDisabledHere) return false
// Workaround for smart step into
@Suppress("DEPRECATION")
val SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA")
@@ -122,16 +123,9 @@ class VimShortcutKeyAction : AnAction(), DumbAware {
}
private fun isEnabledForEscape(editor: Editor): Boolean {
return isPrimaryEditor(editor) || EditorHelper.isFileEditor(editor) && !editor.inNormalMode
}
/**
* Checks if the editor is a primary editor in the main editing area.
*/
private fun isPrimaryEditor(editor: Editor): Boolean {
val project = editor.project ?: return false
val fileEditorManager = FileEditorManagerEx.getInstanceEx(project) ?: return false
return fileEditorManager.allEditors.any { fileEditor -> editor == EditorUtil.getEditorEx(fileEditor) }
return editor.isPrimaryEditor()
|| EditorHelper.isFileEditor(editor) && !editor.inNormalMode
|| OptionsManager.dialogescape.value == "on" && !editor.inNormalMode
}
private fun isShortcutConflict(keyStroke: KeyStroke): Boolean {

View File

@@ -51,7 +51,7 @@ class OperatorAction : VimActionHandler.SingleExecution() {
.getMotionRange(editor, editor.caretModel.primaryCaret, context, cmd.count, cmd.rawCount, argument)
if (range != null) {
VimPlugin.getMark().setChangeMarks(editor, range)
val selectionType = SelectionType.fromCommandFlags(motion.flags)
val selectionType = if (motion.isLinewiseMotion()) SelectionType.LINE_WISE else SelectionType.CHARACTER_WISE
KeyHandler.getInstance().reset(editor)
val result = operatorFunction.apply(editor, context, selectionType)
VimRepeater.repeatHandler = saveRepeatHandler

View File

@@ -64,7 +64,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
}
state.setExecutingCommand(lastCommand)
KeyHandler.executeVimAction(editor, lastCommand.action!!, context)
KeyHandler.executeVimAction(editor, lastCommand.action, context)
VimRepeater.saveLastChange(lastCommand)
}

View File

@@ -21,6 +21,7 @@ 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.updown.MotionDownLess1FirstNonSpaceAction
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
@@ -39,6 +40,9 @@ class ChangeLineAction : ChangeEditorActionHandler.ForEachCaret() {
count: Int,
rawCount: Int,
argument: Argument?): Boolean {
return VimPlugin.getChange().changeLine(editor, caret, count, context)
// `S` command is a synonym of `cc`
val motion = MotionDownLess1FirstNonSpaceAction()
val command = Command(1, motion, motion.type, motion.flags)
return VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, Argument(command))
}
}

View File

@@ -25,15 +25,13 @@ import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
class ChangeNumberIncAction : ChangeEditorActionHandler.ForEachCaret() {
sealed class IncAction(val inc: Int) : ChangeEditorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
override fun execute(editor: Editor,
caret: Caret,
context: DataContext,
count: Int,
rawCount: Int,
argument: Argument?): Boolean {
return VimPlugin.getChange().changeNumber(editor, caret, count)
override fun execute(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Boolean {
return VimPlugin.getChange().changeNumber(editor, caret, inc * count)
}
}
class ChangeNumberIncAction : IncAction(1)
class ChangeNumberDecAction : IncAction(-1)

View File

@@ -1,44 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2020 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class ChangeVisualNumberAvalancheDecAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.count, true)
}
}

View File

@@ -1,44 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2020 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class ChangeVisualNumberAvalancheIncAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, true)
}
}

View File

@@ -1,44 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2020 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.change.number
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class ChangeVisualNumberDecAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.count, false)
}
}

View File

@@ -28,17 +28,16 @@ import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class ChangeVisualNumberIncAction : VisualOperatorActionHandler.ForEachCaret() {
sealed class IncNumber(val inc: Int, val avalanche: Boolean) : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.CHANGE
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
override fun executeAction(editor: Editor,
caret: Caret,
context: DataContext,
cmd: Command,
range: VimSelection): Boolean {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.count, false)
override fun executeAction(editor: Editor, caret: Caret, context: DataContext, cmd: Command, range: VimSelection): Boolean {
return VimPlugin.getChange().changeNumberVisualMode(editor, caret, range.toVimTextRange(false), inc * cmd.count, avalanche)
}
}
class ChangeVisualNumberIncAction : IncNumber(1, false)
class ChangeVisualNumberDecAction : IncNumber(-1, false)
class ChangeVisualNumberAvalancheIncAction : IncNumber(1, true)
class ChangeVisualNumberAvalancheDecAction : IncNumber(-1, true)

View File

@@ -25,6 +25,7 @@ import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.group.copy.PutData
import com.maddyhome.idea.vim.group.copy.PutData.TextData
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
import com.maddyhome.idea.vim.helper.StringHelper
sealed class PutTextBaseAction(
private val insertTextBeforeCaret: Boolean,
@@ -35,7 +36,7 @@ sealed class PutTextBaseAction(
override fun execute(editor: Editor, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Boolean {
val lastRegister = VimPlugin.getRegister().lastRegister
val textData = if (lastRegister != null) TextData(lastRegister.text, lastRegister.type, lastRegister.transferableData) else null
val textData = if (lastRegister != null) TextData(lastRegister.text ?: StringHelper.toKeyNotation(lastRegister.keys), lastRegister.type, lastRegister.transferableData) else null
val putData = PutData(textData, null, count, insertTextBeforeCaret, indent, caretAfterInsertedText, -1)
return VimPlugin.getPut().putText(editor, context, putData)
}

View File

@@ -19,73 +19,72 @@
package com.maddyhome.idea.vim.action.fold
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_ALL_REGIONS
import com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_REGION
import com.intellij.openapi.actionSystem.IdeActions.ACTION_COLLAPSE_REGION_RECURSIVELY
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_ALL_REGIONS
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_REGION
import com.intellij.openapi.actionSystem.IdeActions.ACTION_EXPAND_REGION_RECURSIVELY
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.handler.VimActionHandler
class VimCollapseAllRegions : VimActionHandler.SingleExecution() {
val actionName: String = "CollapseAllRegions"
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.executeAction(actionName, context)
KeyHandler.executeAction(ACTION_COLLAPSE_ALL_REGIONS, context)
return true
}
}
class VimCollapseRegion : VimActionHandler.SingleExecution() {
private val actionName: String = "CollapseRegion"
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.executeAction(actionName, context)
KeyHandler.executeAction(ACTION_COLLAPSE_REGION, context)
return true
}
}
class VimCollapseRegionRecursively : VimActionHandler.SingleExecution() {
private val actionName: String = "CollapseRegionRecursively"
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.executeAction(actionName, context)
KeyHandler.executeAction(ACTION_COLLAPSE_REGION_RECURSIVELY, context)
return true
}
}
class VimExpandAllRegions : VimActionHandler.SingleExecution() {
private val actionName: String = "ExpandAllRegions"
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.executeAction(actionName, context)
KeyHandler.executeAction(ACTION_EXPAND_ALL_REGIONS, context)
return true
}
}
class VimExpandRegion : VimActionHandler.SingleExecution() {
private val actionName: String = "ExpandRegion"
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.executeAction(actionName, context)
KeyHandler.executeAction(ACTION_EXPAND_REGION, context)
return true
}
}
class VimExpandRegionRecursively : VimActionHandler.SingleExecution() {
private val actionName: String = "ExpandRegionRecursively"
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
KeyHandler.executeAction(actionName, context)
KeyHandler.executeAction(ACTION_EXPAND_REGION_RECURSIVELY, context)
return true
}
}

View File

@@ -39,8 +39,9 @@ import java.awt.RenderingHints
import java.awt.font.FontRenderContext
import java.util.*
import javax.swing.UIManager
import kotlin.math.max
class AddInlaysAction : AnAction() {
class AddBlockInlaysAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val dataContext = e.dataContext
val editor = getEditor(dataContext) ?: return
@@ -94,7 +95,7 @@ class AddInlaysAction : AnAction() {
private fun getFontMetrics(editor: Editor): MyFontMetrics {
val familyName = UIManager.getFont("Label.font").family
val size = (Math.max(1, editor.colorsScheme.editorFontSize - 1) * factor).toInt()
val size = (max(1, editor.colorsScheme.editorFontSize - 1) * factor).toInt()
var metrics = editor.getUserData(HINT_FONT_METRICS)
if (metrics != null && !metrics.isActual(editor, familyName, size)) {
metrics = null
@@ -110,7 +111,7 @@ class AddInlaysAction : AnAction() {
return if (text == null) 0 else fontMetrics.stringWidth(text)
}
private inner class MyFontMetrics internal constructor(editor: Editor, familyName: String?, size: Int) {
private inner class MyFontMetrics(editor: Editor, familyName: String?, size: Int) {
val metrics: FontMetrics
fun isActual(editor: Editor, familyName: String, size: Int): Boolean {
val font = metrics.font

View File

@@ -0,0 +1,58 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2020 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.internal
import com.intellij.codeInsight.daemon.impl.HintRenderer
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.VisualPosition
import com.maddyhome.idea.vim.helper.EditorHelper
import java.util.*
import kotlin.math.max
class AddInlineInlaysAction : AnAction() {
companion object {
private val random = Random()
}
override fun actionPerformed(e: AnActionEvent) {
val dataContext = e.dataContext
val editor = getEditor(dataContext) ?: return
val inlayModel = editor.inlayModel
val currentVisualLine = editor.caretModel.primaryCaret.visualPosition.line
var i = random.nextInt(10)
val lineLength = EditorHelper.getLineLength(editor, EditorHelper.visualLineToLogicalLine(editor, currentVisualLine))
while (i < lineLength) {
val relatesToPrecedingText = random.nextInt(10) > 7
val text = "a".repeat(max(1, random.nextInt(7)))
val offset = EditorHelper.visualPositionToOffset(editor, VisualPosition(currentVisualLine, i))
// We don't need a custom renderer, just use the standard parameter hint renderer
inlayModel.addInlineElement(offset, relatesToPrecedingText, HintRenderer(if (relatesToPrecedingText) ":$text" else "$text:"))
// Every 20 chars +/- 5 chars
i += 20 + (random.nextInt(10) - 5)
}
}
private fun getEditor(dataContext: DataContext): Editor? {
return CommonDataKeys.EDITOR.getData(dataContext)
}
}

View File

@@ -23,12 +23,9 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
import javax.swing.KeyStroke
/**
* @author Alex Plate
@@ -36,7 +33,7 @@ import javax.swing.KeyStroke
class GnNextTextObject : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
if (caret != editor.caretModel.primaryCaret) return null

View File

@@ -23,11 +23,9 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
/**
* @author Alex Plate
@@ -35,7 +33,8 @@ import java.util.*
class GnPreviousTextObject : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
if (caret != editor.caretModel.primaryCaret) return null
val range = VimPlugin.getSearch().getNextSearchRange(editor, count, false)

View File

@@ -36,7 +36,7 @@ class MotionArrowLeftAction : NonShiftedSpecialKeyHandler(), ComplicatedKeysActi
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(parseKeys("<Left>"), listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0)))
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
}
}

View File

@@ -27,6 +27,8 @@ import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.commandState
import com.maddyhome.idea.vim.helper.isEndAllowed
import java.awt.event.KeyEvent
import javax.swing.KeyStroke
@@ -39,7 +41,8 @@ class MotionArrowRightAction : NonShiftedSpecialKeyHandler(), ComplicatedKeysAct
)
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, false)
val allowPastEnd = editor.commandState.mode.isEndAllowed
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, allowPastEnd)
}
}

View File

@@ -38,7 +38,7 @@ class MotionLeftAction : MotionActionHandler.ForEachCaret() {
count: Int,
rawCount: Int,
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
}
}
@@ -56,6 +56,6 @@ class MotionLeftInsertModeAction : MotionActionHandler.ForEachCaret(), Complicat
count: Int,
rawCount: Int,
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
}
}

View File

@@ -38,7 +38,7 @@ class MotionRightAction : MotionActionHandler.ForEachCaret() {
count: Int,
rawCount: Int,
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, true)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, true)
}
}
@@ -56,6 +56,6 @@ class MotionRightInsertAction : MotionActionHandler.ForEachCaret(), ComplicatedK
count: Int,
rawCount: Int,
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, true)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, true)
}
}

View File

@@ -36,7 +36,7 @@ class MotionShiftLeftAction : ShiftedArrowKeyHandler() {
override fun motionWithKeyModel(editor: Editor, context: DataContext, cmd: Command) {
editor.vimForEachCaret { caret ->
val vertical = VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -cmd.count, true)
val vertical = VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -cmd.count, true)
MotionGroup.moveCaret(editor, caret, vertical)
}
}

View File

@@ -36,7 +36,7 @@ class MotionShiftRightAction : ShiftedArrowKeyHandler() {
override fun motionWithKeyModel(editor: Editor, context: DataContext, cmd: Command) {
editor.vimForEachCaret { caret ->
val vertical = VimPlugin.getMotion().moveCaretHorizontal(editor, caret, cmd.count, true)
val vertical = VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, cmd.count, true)
MotionGroup.moveCaret(editor, caret, vertical)
}
}

View File

@@ -29,11 +29,11 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
import java.util.*
class MotionGotoFileMarkLineAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.INCLUSIVE
override val motionType: MotionType = MotionType.LINE_WISE
override val argumentType: Argument.Type = Argument.Type.CHARACTER
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
override fun getOffset(editor: Editor,
caret: Caret,
@@ -49,12 +49,10 @@ class MotionGotoFileMarkLineAction : MotionActionHandler.ForEachCaret() {
}
class MotionGotoFileMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.INCLUSIVE
override val motionType: MotionType = MotionType.LINE_WISE
override val argumentType: Argument.Type = Argument.Type.CHARACTER
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE)
override fun getOffset(editor: Editor,
caret: Caret,
context: DataContext,

View File

@@ -29,11 +29,11 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
import java.util.*
class MotionGotoMarkLineAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.INCLUSIVE
override val motionType: MotionType = MotionType.LINE_WISE
override val argumentType: Argument.Type = Argument.Type.CHARACTER
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
override fun getOffset(editor: Editor,
caret: Caret,
@@ -49,12 +49,10 @@ class MotionGotoMarkLineAction : MotionActionHandler.ForEachCaret() {
}
class MotionGotoMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
override val motionType: MotionType = MotionType.INCLUSIVE
override val motionType: MotionType = MotionType.LINE_WISE
override val argumentType: Argument.Type = Argument.Type.CHARACTER
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE)
override fun getOffset(editor: Editor,
caret: Caret,
context: DataContext,

View File

@@ -23,15 +23,13 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionInnerBigWordAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor,
caret: Caret,

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionInnerBlockAngleAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor,
caret: Caret,

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionInnerBlockBackQuoteAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor,
caret: Caret,

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionInnerBlockBraceAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor,
caret: Caret,

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionInnerBlockBracketAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor,
caret: Caret,

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionInnerBlockDoubleQuoteAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor,
caret: Caret,

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionInnerBlockParenAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockRange(editor, caret, count, false, '(')

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionInnerBlockSingleQuoteAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '\'', false)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionInnerBlockTagAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockTagRange(editor, caret, count, false)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionInnerParagraphAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.LINE_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getParagraphRange(editor, caret, count, false)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -34,6 +35,8 @@ class MotionInnerSentenceAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getSentenceRange(editor, caret, count, false)
}

View File

@@ -23,15 +23,13 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionInnerWordAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getWordRange(editor, caret, count, false, false)

View File

@@ -23,16 +23,14 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionOuterBigWordAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getWordRange(editor, caret, count, true, true)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionOuterBlockAngleAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '<')

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionOuterBlockBackQuoteAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '`', true)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionOuterBlockBraceAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '{')

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionOuterBlockBracketAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '[')

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionOuterBlockDoubleQuoteAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '"', true)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionOuterBlockParenAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockRange(editor, caret, count, true, '(')

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionOuterBlockSingleQuoteAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockQuoteRange(editor, caret, '\'', true)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -31,7 +32,9 @@ import java.util.*
class MotionOuterBlockTagAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getBlockTagRange(editor, caret, count, true)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -32,7 +33,9 @@ import java.util.*
class MotionOuterParagraphAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_TEXT_BLOCK)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.LINE_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getParagraphRange(editor, caret, count, true)

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
@@ -34,6 +35,8 @@ class MotionOuterSentenceAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_TEXT_BLOCK)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getSentenceRange(editor, caret, count, true)
}

View File

@@ -23,16 +23,14 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionOuterWordAction : TextObjectActionHandler() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_CHARACTERWISE)
override val visualType: TextObjectVisualType = TextObjectVisualType.CHARACTER_WISE
override fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
return VimPlugin.getMotion().getWordRange(editor, caret, count, true, false)

View File

@@ -29,7 +29,9 @@ import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionFirstScreenLineAction : MotionActionHandler.ForEachCaret() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
override val motionType: MotionType = MotionType.LINE_WISE
override fun getOffset(editor: Editor,
caret: Caret,
@@ -39,6 +41,4 @@ class MotionFirstScreenLineAction : MotionActionHandler.ForEachCaret() {
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretToFirstScreenLine(editor, count)
}
override val motionType: MotionType = MotionType.INCLUSIVE
}

View File

@@ -29,7 +29,9 @@ import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionLastScreenLineAction : MotionActionHandler.ForEachCaret() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
override val motionType: MotionType = MotionType.LINE_WISE
override fun getOffset(editor: Editor,
caret: Caret,
@@ -39,6 +41,4 @@ class MotionLastScreenLineAction : MotionActionHandler.ForEachCaret() {
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretToLastScreenLine(editor, count)
}
override val motionType: MotionType = MotionType.INCLUSIVE
}

View File

@@ -29,7 +29,9 @@ import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionMiddleScreenLineAction : MotionActionHandler.ForEachCaret() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_SAVE_JUMP)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
override val motionType: MotionType = MotionType.LINE_WISE
override fun getOffset(editor: Editor,
caret: Caret,
@@ -39,6 +41,4 @@ class MotionMiddleScreenLineAction : MotionActionHandler.ForEachCaret() {
argument: Argument?): Int {
return VimPlugin.getMotion().moveCaretToMiddleScreenLine(editor)
}
override val motionType: MotionType = MotionType.INCLUSIVE
}

View File

@@ -32,6 +32,6 @@ class MotionScrollColumnLeftAction : VimActionHandler.SingleExecution() {
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollColumn(editor, cmd.count)
return VimPlugin.getMotion().scrollColumns(editor, cmd.count)
}
}

View File

@@ -31,6 +31,6 @@ class MotionScrollColumnRightAction : VimActionHandler.SingleExecution() {
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollColumn(editor, -cmd.count)
return VimPlugin.getMotion().scrollColumns(editor, -cmd.count)
}
}

View File

@@ -27,6 +27,6 @@ class MotionScrollFirstScreenColumnAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollColumnToFirstScreenColumn(editor)
return VimPlugin.getMotion().scrollCaretColumnToFirstScreenColumn(editor)
}
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollFirstScreenLineAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, cmd.rawCount, false)
}

View File

@@ -21,18 +21,24 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollFirstScreenLinePageStartAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
var line = cmd.rawCount
if (line == 0) {
val nextVisualLine = EditorHelper.getVisualLineAtBottomOfScreen(editor) + 1
line = EditorHelper.visualLineToLogicalLine(editor, nextVisualLine) + 1 // rawCount is 1 based
var rawCount = cmd.rawCount
if (rawCount == 0) {
val nextVisualLine = EditorHelper.normalizeVisualLine(editor,
EditorHelper.getVisualLineAtBottomOfScreen(editor) + 1)
rawCount = EditorHelper.visualLineToLogicalLine(editor, nextVisualLine) + 1 // rawCount is 1 based
}
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, line, true)
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, rawCount, true)
}
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollFirstScreenLineStartAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLineToFirstScreenLine(editor, cmd.rawCount, true)
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollHalfPageDownAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollScreen(editor, cmd.rawCount, true)
}

View File

@@ -0,0 +1,53 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2020 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.motion.scroll
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
/*
For the following four commands the cursor follows the screen. If the
character that the cursor is on is moved off the screen, the cursor is moved
to the closest character that is on the screen. The value of 'sidescroll' is
not used.
*zH*
zH Move the view on the text half a screenwidth to the
left, thus scroll the text half a screenwidth to the
right. This only works when 'wrap' is off.
[count] is used but undocumented.
*/
class MotionScrollHalfWidthLeftAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
// Vim's screen width is the full screen width, including columns used for gutters.
return VimPlugin.getMotion().scrollColumns(editor, cmd.count * (EditorHelper.getApproximateScreenWidth(editor) / 2));
}
}

View File

@@ -0,0 +1,53 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2020 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.motion.scroll
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
/*
For the following four commands the cursor follows the screen. If the
character that the cursor is on is moved off the screen, the cursor is moved
to the closest character that is on the screen. The value of 'sidescroll' is
not used.
*zH*
zH Move the view on the text half a screenwidth to the
left, thus scroll the text half a screenwidth to the
right. This only works when 'wrap' is off.
[count] is used but undocumented.
*/
class MotionScrollHalfWidthRightAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SIDE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
// Vim's screen width is the full screen width, including columns used for gutters.
return VimPlugin.getMotion().scrollColumns(editor, -cmd.count * (EditorHelper.getApproximateScreenWidth(editor) / 2));
}
}

View File

@@ -27,6 +27,6 @@ class MotionScrollLastScreenColumnAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollColumnToLastScreenColumn(editor)
return VimPlugin.getMotion().scrollCaretColumnToLastScreenColumn(editor)
}
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollLastScreenLineAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLineToLastScreenLine(editor, cmd.rawCount, false)
}

View File

@@ -21,28 +21,37 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollLastScreenLinePageStartAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
val motion = VimPlugin.getMotion()
var line = cmd.rawCount
if (line == 0) {
val prevVisualLine = EditorHelper.getVisualLineAtTopOfScreen(editor) - 1
line = EditorHelper.visualLineToLogicalLine(editor, prevVisualLine) + 1 // rawCount is 1 based
return motion.scrollLineToLastScreenLine(editor, line, true)
// Without [count]: Redraw with the line just above the window at the bottom of the window. Put the cursor in that
// line, at the first non-blank in the line.
if (cmd.rawCount == 0) {
val prevVisualLine = EditorHelper.normalizeVisualLine(editor,
EditorHelper.getVisualLineAtTopOfScreen(editor) - 1)
val logicalLine = EditorHelper.visualLineToLogicalLine(editor, prevVisualLine)
return motion.scrollLineToLastScreenLine(editor, logicalLine + 1, true)
}
// [count]z^ first scrolls [count] to the bottom of the window, then moves the caret to the line that is now at
// the top, and then move that line to the bottom of the window
line = EditorHelper.normalizeLine(editor, line)
if (motion.scrollLineToLastScreenLine(editor, line, true)) {
line = EditorHelper.getVisualLineAtTopOfScreen(editor)
line = EditorHelper.visualLineToLogicalLine(editor, line) + 1 // rawCount is 1 based
return motion.scrollLineToLastScreenLine(editor, line, true)
var logicalLine = EditorHelper.normalizeLine(editor, cmd.rawCount - 1)
if (motion.scrollLineToLastScreenLine(editor, logicalLine + 1, false)) {
logicalLine = EditorHelper.visualLineToLogicalLine(editor, EditorHelper.getVisualLineAtTopOfScreen(editor))
return motion.scrollLineToLastScreenLine(editor, logicalLine + 1, true)
}
return false
}
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollLastScreenLineStartAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLineToLastScreenLine(editor, cmd.rawCount, true)
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollLineDownAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLine(editor, cmd.count)
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollLineUpAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLine(editor, -cmd.count)
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollMiddleScreenLineAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLineToMiddleScreenLine(editor, cmd.rawCount, false)
}

View File

@@ -21,11 +21,16 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.util.*
class MotionScrollMiddleScreenLineStartAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollLineToMiddleScreenLine(editor, cmd.rawCount, true)
}

View File

@@ -35,6 +35,8 @@ class MotionScrollPageDownAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollFullPage(editor, cmd.count)
}
@@ -44,15 +46,13 @@ class MotionScrollPageDownInsertModeAction : VimActionHandler.SingleExecution(),
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, KeyEvent.CTRL_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, KeyEvent.SHIFT_DOWN_MASK))
)
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_CLEAR_STROKES)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP, CommandFlags.FLAG_CLEAR_STROKES)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollFullPage(editor, cmd.count)

View File

@@ -35,6 +35,8 @@ class MotionScrollPageUpAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollFullPage(editor, -cmd.count)
}
@@ -44,15 +46,13 @@ class MotionScrollPageUpInsertModeAction : VimActionHandler.SingleExecution(), C
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, KeyEvent.CTRL_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, KeyEvent.SHIFT_DOWN_MASK))
)
override val type: Command.Type = Command.Type.OTHER_READONLY
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_CLEAR_STROKES)
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_IGNORE_SCROLL_JUMP, CommandFlags.FLAG_CLEAR_STROKES)
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
return VimPlugin.getMotion().scrollFullPage(editor, -cmd.count)

View File

@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
import com.maddyhome.idea.vim.group.visual.vimSetSystemSelectionSilently
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.EditorHelper
@@ -41,7 +42,7 @@ class SelectEnableBlockModeAction : VimActionHandler.SingleExecution() {
val lineEnd = EditorHelper.getLineEndForOffset(editor, editor.caretModel.primaryCaret.offset)
editor.caretModel.primaryCaret.run {
vimSetSystemSelectionSilently(offset, (offset + 1).coerceAtMost(lineEnd))
moveToOffset((offset + 1).coerceAtMost(lineEnd))
moveToInlayAwareOffset((offset + 1).coerceAtMost(lineEnd))
vimLastColumn = visualPosition.column
}
return VimPlugin.getVisualMotion().enterSelectMode(editor, CommandState.SubMode.VISUAL_BLOCK)

View File

@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
import com.maddyhome.idea.vim.group.visual.vimSetSystemSelectionSilently
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.EditorHelper
@@ -41,7 +42,7 @@ class SelectEnableCharacterModeAction : VimActionHandler.SingleExecution() {
val lineEnd = EditorHelper.getLineEndForOffset(editor, caret.offset)
caret.run {
vimSetSystemSelectionSilently(offset, (offset + 1).coerceAtMost(lineEnd))
moveToOffset((offset + 1).coerceAtMost(lineEnd))
moveToInlayAwareOffset((offset + 1).coerceAtMost(lineEnd))
vimLastColumn = visualPosition.column
}
}

View File

@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandState
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
import com.maddyhome.idea.vim.group.visual.updateCaretState
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.commandState
@@ -45,7 +46,7 @@ class SelectToggleVisualMode : VimActionHandler.SingleExecution() {
if (subMode != CommandState.SubMode.VISUAL_LINE) {
editor.caretModel.runForEachCaret {
if (it.offset + VimPlugin.getVisualMotion().selectionAdj == it.selectionEnd) {
it.moveToOffset(it.offset + VimPlugin.getVisualMotion().selectionAdj)
it.moveToInlayAwareOffset(it.offset + VimPlugin.getVisualMotion().selectionAdj)
}
}
}
@@ -54,7 +55,7 @@ class SelectToggleVisualMode : VimActionHandler.SingleExecution() {
if (subMode != CommandState.SubMode.VISUAL_LINE) {
editor.caretModel.runForEachCaret {
if (it.offset == it.selectionEnd && it.visualLineStart <= it.offset - VimPlugin.getVisualMotion().selectionAdj) {
it.moveToOffset(it.offset - VimPlugin.getVisualMotion().selectionAdj)
it.moveToInlayAwareOffset(it.offset - VimPlugin.getVisualMotion().selectionAdj)
}
}
}

View File

@@ -55,7 +55,7 @@ class SelectMotionLeftAction : MotionActionHandler.ForEachCaret() {
}
// No return statement, perform motion to left
}
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, -count, false)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, -count, false)
}
companion object {

View File

@@ -55,7 +55,7 @@ class SelectMotionRightAction : MotionActionHandler.ForEachCaret() {
}
return caret.offset
}
return VimPlugin.getMotion().moveCaretHorizontal(editor, caret, count, false)
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor, caret, count, false)
}
companion object {

View File

@@ -25,22 +25,18 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.ComplicatedKeysAction
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.enumSetOf
import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke
class MotionArrowDownAction : NonShiftedSpecialKeyHandler(), ComplicatedKeysAction {
override val motionType: MotionType = MotionType.INCLUSIVE
override val motionType: MotionType = MotionType.LINE_WISE
override val keyStrokesSet: Set<MutableList<KeyStroke>> = setOf(parseKeys("<Down>"), mutableListOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0)))
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
private var col: Int = 0
override fun offset(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): Int {
@@ -48,11 +44,11 @@ class MotionArrowDownAction : NonShiftedSpecialKeyHandler(), ComplicatedKeysActi
}
override fun preOffsetComputation(editor: Editor, caret: Caret, context: DataContext, cmd: Command): Boolean {
col = EditorHelper.prepareLastColumn(editor, caret)
col = EditorHelper.prepareLastColumn(caret)
return true
}
override fun postMove(editor: Editor, caret: Caret, context: DataContext, cmd: Command) {
EditorHelper.updateLastColumn(editor, caret, col)
EditorHelper.updateLastColumn(caret, col)
}
}

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