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

Compare commits

...

579 Commits
0.39 ... 0.51

Author SHA1 Message Date
Andrey Vlasovskikh
132f52785c Version 0.51 2019-02-12 00:08:12 +03:00
Andrey Vlasovskikh
c556ec2001 Merge branch 'fixes-by-matt'
# Conflicts:
#	resources/META-INF/plugin.xml
2019-01-28 23:05:23 +03:00
Andrey Vlasovskikh
d49683ab2f Updated Kotlin to 1.3 due to compatibility IntelliJ 2019.1
The minimal compatible version is now 2018.3.
2019-01-28 22:56:14 +03:00
Andrey Vlasovskikh
810c3cd561 Use the IntelliJ repo instead of the default cache-redirector due to network issues 2019-01-28 21:54:55 +03:00
Andrey Vlasovskikh
b909157f4b Mention Rider as a compatible IDE 2019-01-28 21:51:16 +03:00
Andrey Vlasovskikh
21c1232ba6 Updated the changelog 2019-01-28 21:42:21 +03:00
Andrey Vlasovskikh
ff61a42670 Updated usages of obsolete APIs 2019-01-28 21:40:14 +03:00
Andrey Vlasovskikh
f160d855c0 Added missing nullity annotations 2019-01-28 21:38:37 +03:00
Andrey Vlasovskikh
51685a2094 Renamed attributes according to naming convention 2019-01-28 20:49:23 +03:00
Andrey Vlasovskikh
487c71ec15 Updated since-build according to the version that introduced the required API 2019-01-28 20:42:40 +03:00
Andrey Vlasovskikh
39aa60850d Fixed inspection warnings 2019-01-28 20:41:56 +03:00
Andrey Vlasovskikh
872921e6b7 Reformat code 2019-01-28 20:39:45 +03:00
Andrey Vlasovskikh
89788df95c Merge branch 'pull/173' 2019-01-28 20:38:03 +03:00
Andrey Vlasovskikh
6ccd8ed0b8 Added Matt Ellis to the list of contributors 2019-01-27 17:04:44 +03:00
Andrey Vlasovskikh
aa7e3bfa69 Updated changelog 2019-01-27 17:03:46 +03:00
Andrey Vlasovskikh
00154f2b9f Merge branch 'pull/170' 2019-01-27 16:48:05 +03:00
Matt Ellis
531a9c28ae VIM-1558 Support block inlays 2019-01-25 12:31:42 +00:00
Matt Ellis
56c4e3e31f VIM-1187 Fix performance with large files and relative line numbers 2019-01-08 13:47:05 +00:00
Matt Ellis
ef2497cadc Update to IJ 2018.3 2019-01-08 13:46:20 +00:00
Andrey Vlasovskikh
95f56a8869 Added Alex Plate to the contributors list 2018-12-31 18:10:44 +03:00
Andrey Vlasovskikh
f5b1112304 Updated changelog 2018-12-31 18:09:55 +03:00
Andrey Vlasovskikh
333a5be30b Merge branch 'pull/162' 2018-12-31 18:05:38 +03:00
Andrey Vlasovskikh
6c9e697892 VIM-620 Fixed handling nested <C-O> & <Esc> in Insert and Replace modes 2018-12-31 18:01:15 +03:00
Alex Plate
7663eb531e Write test to reproduce VIM-620 issue
Enter insert mode after single command produces incorrect behaviour.
Insert mode is not escaped after Esc
2018-12-29 00:36:51 +03:00
Andrey Vlasovskikh
33499fe945 Version 0.50 2018-10-18 15:00:16 +03:00
Andrey Vlasovskikh
2882b638e5 Use latest stable IntelliJ, Kotlin, gradle-intellij-plugin 2018-10-18 14:45:33 +03:00
Alex Plate
5529bf284a VIM-798 Arrow keys for window navigation commands
Add new mappings to allow window navigation with arrow keys:
- ^W-<left> as ^W-h
- ^W-<down> as ^W-j
- ^W-<up> as ^W-k
- ^W-<right> as ^W-l
2018-10-01 20:19:25 +03:00
Andrey Vlasovskikh
81c92cda79 Updated changelog 2018-09-21 19:34:50 +03:00
Andrey Vlasovskikh
6506935d03 Merge branch 'vim-1274' 2018-09-21 19:31:40 +03:00
John Lin
b6be26231f VIM-1274 Fix StringHelper.containsUpperCase behavior
StringHelper.containsUpperCase should return true when one of
the character of the input string satisfies the following two
conditions:

1. The character is upper case.
2. The character is not prefixed with a backslash.

Before this fix, the second condition was incorrectly written.
2018-09-17 11:53:23 +08:00
Andrey Vlasovskikh
a96ba9f717 Updated changelog 2018-09-17 01:13:11 +03:00
Andrey Vlasovskikh
173f570230 EA-108647 Check if the editor is disposed in invokeLater() 2018-09-14 18:19:37 +03:00
Andrey Vlasovskikh
57dcaba367 EA-89803 Fixed running IntelliJ write actions directly within Swing timer handler
We have to switch to a transaction with an appropriate modality state.
2018-09-14 18:08:45 +03:00
Andrey Vlasovskikh
d9f7955356 VIM-1366 Don't wrap secondary event loop for input() into write action
Extension handlers are now run without outer read / write actions and
they are required to synchronize access to the data structures of
IntelliJ by themselves.
2018-09-14 17:28:25 +03:00
Andrey Vlasovskikh
9cf264998f VIM-1317 Don't run Undo/Redo inside write actions
They show UI dialogs, which is not allowed under a write action, and
they use their own write actions when needed.
2018-09-14 17:23:10 +03:00
Andrey Vlasovskikh
0dc67ae467 Updated changelog 2018-09-10 15:40:15 +03:00
Andrey Vlasovskikh
75c1c0b839 Move "Vim Emulation" settings into "File | Settings | Editor" 2018-09-10 14:53:26 +03:00
Andrey Vlasovskikh
1feac95069 VIM-339 Handle <Esc> by Vim only in primary or physical file editors
<Esc> is handled by the Vim emulation in primary editors of the main
window and in non-primary editors with physical files open in them,
but only in modes other than Normal. This is needed for the diff dialog
where you can have both physical file editors and non-physical file
editors, but they are non-primary, so users still expect <Esc> to close
the diff window when the editor is in the Normal mode.
2018-09-10 14:45:22 +03:00
Andrey Vlasovskikh
ed3f87e6a8 VIM-176 Treat console editors like any other editors
If an editor is a writable non-file editor (like a console), then we
activate the 'i' mode *and* allow running write commands. Thus,
Insert mode commands like arrow navigation will work in these editors.
2018-09-08 19:20:53 +03:00
Andrey Vlasovskikh
43662318be Compatibility with IntelliJ 2018.1 and newer due to the platform API changes 2018-08-27 22:06:09 +03:00
Andrey Vlasovskikh
785d1a04da Merge pull request #157 from JetBrains/multiple-carets 2018-08-27 21:55:57 +03:00
Andrey Vlasovskikh
cc76c7f0f3 Merge pull request #156 from karavaevitalii/multiple-carets
Fixed bug with selecting occurrences when ignorecase is set
2018-08-27 21:55:06 +03:00
Vitalii Karavaev
57741cd5ce Fixed bug with selecting occurrences when ignorecase is set 2018-08-27 21:23:25 +03:00
Andrey Vlasovskikh
69bd71148c Added Vasily Alferov and Vitalii Karavaev to the contributors list 2018-08-27 21:00:13 +03:00
Andrey Vlasovskikh
528e363d64 Updated changelog 2018-08-27 20:57:09 +03:00
Andrey Vlasovskikh
bd772daee0 Small reordering of multiple-cursors commands 2018-08-27 20:51:04 +03:00
Andrey Vlasovskikh
23fa55ea11 Updated the list of all supported commands
Removed the multiple carets support marker, since all commands are
basically covered now. We'll handle any bugs left in the same way we
do it for other bugs.
2018-08-27 20:50:07 +03:00
Vitalii Karavaev
0a052e7bb3 Cleanup 2018-08-10 18:18:43 +03:00
Vitalii Karavaev
60a96e9542 Cleanup 2018-08-10 17:32:30 +03:00
Vitalii Karavaev
f3f9abef0c <A-x> shows no more matches message when necessary 2018-08-10 17:06:10 +03:00
Vitalii Karavaev
58fc34d9f7 Implement <A-x> 2018-08-10 17:01:36 +03:00
Vitalii Karavaev
6fdd769d0f Implement <A-p> 2018-08-10 16:43:46 +03:00
Vitalii Karavaev
b54384bb33 Implement <Plug>All<Whole>Occurrences 2018-08-10 16:31:48 +03:00
Vitalii Karavaev
c57f98591a Revert MultipleCursorsExtension and implement <A-n> 2018-08-10 14:08:25 +03:00
Vitalii Karavaev
7dcacd3b01 Minor fixes 2018-08-09 17:45:56 +03:00
Vitalii Karavaev
2225033b7c Reset state and additional checks 2018-08-09 17:32:32 +03:00
Vitalii Karavaev
7c5194fbaa Better work in case of multiple carets 2018-08-09 14:55:22 +03:00
Vitalii Karavaev
cded76d1a2 Test 2018-08-09 14:52:47 +03:00
Vitalii Karavaev
361284fe06 Fixed <A-n> in visual mode 2018-08-09 14:25:29 +03:00
Vitalii Karavaev
aa3e55cacc Fixed bug with multiple carets <A-n> action 2018-08-09 13:54:31 +03:00
Vitalii Karavaev
73987eaf23 Safer work in case of multiple carets 2018-08-09 12:47:40 +03:00
Vitalii Karavaev
06058a45c0 Fixed review issues and README.md updated 2018-08-09 12:35:08 +03:00
Vitalii Karavaev
d46cab6fc8 Fixed review issues 2018-08-09 11:18:39 +03:00
Vitalii Karavaev
77bd800d95 private modifier 2018-08-08 16:11:55 +03:00
Vitalii Karavaev
831373c292 Cleanup 2018-08-08 15:59:44 +03:00
Vitalii Karavaev
9c5e5e117a Cleanup 2018-08-08 15:47:35 +03:00
Vitalii Karavaev
346ada2eff Blank lines 2018-08-08 15:45:56 +03:00
Vitalii Karavaev
485ff37b22 Better work with nulls 2018-08-08 15:38:33 +03:00
Vitalii Karavaev
47ef6f4844 Show message when no more matches 2018-08-08 15:19:03 +03:00
Vitalii Karavaev
cd288ec125 Support for selection all occurrences 2018-08-08 15:16:13 +03:00
Vitalii Karavaev
bde2eb786d g<A-n> support 2018-08-08 14:38:33 +03:00
Vitalii Karavaev
b6896e28c8 Better support for vim-multiple-cursors extension 2018-08-08 13:57:16 +03:00
Vitalii Karavaev
15dc233a86 Overlap carets when jump to mark 2018-08-08 10:20:15 +03:00
Vitalii Karavaev
b070549eca Remove gn action 2018-08-07 17:42:18 +03:00
Vitalii Karavaev
71a3df028b Fixed review issues 2018-08-07 17:37:11 +03:00
Vitalii Karavaev
73ef8c821b Minor review issues 2018-08-07 16:47:18 +03:00
Vitalii Karavaev
bbd314b6df Test :s/// 2018-08-07 15:05:46 +03:00
Vitalii Karavaev
5764fe7555 Multiple carets support for :@ 2018-08-07 14:54:42 +03:00
Vitalii Karavaev
44cc17cb84 Multiple carets support for :s/// 2018-08-07 14:53:10 +03:00
Vitalii Karavaev
dba8879576 Formatted lines 2018-08-07 10:29:56 +03:00
Vitalii Karavaev
1deb48bf60 Fixed broken tests 2018-08-07 10:28:37 +03:00
Vitalii Karavaev
11174b8581 Tests :sor 2018-08-07 10:17:47 +03:00
Vitalii Karavaev
bd35f71c6a :sor multicaret support 2018-08-07 10:17:47 +03:00
Vitalii Karavaev
d29ae6a64d :> fix bug and multiple carets support 2018-08-06 16:01:39 +03:00
Vitalii Karavaev
5b69b9beae :< fix bug and multiple carets support 2018-08-06 15:55:47 +03:00
Vitalii Karavaev
0c78741642 Warnings 2018-08-06 15:54:58 +03:00
Vitalii Karavaev
a9440f41a7 Support skip and remove for vim-multiple-cursors emulation 2018-08-06 15:18:05 +03:00
Vitalii Karavaev
8fc4306d76 :d support 2018-08-06 13:42:21 +03:00
Vitalii Karavaev
371d7385ed Vim Multiple Cursors extension prototype 2018-08-06 12:14:50 +03:00
Vitalii Karavaev
2cacdbaf00 Minor 2018-08-06 10:24:09 +03:00
Vitalii Karavaev
3041fe7c3b Rename VisualSelectNextOccurrence to VimSelectNextOccurrence 2018-08-06 09:45:49 +03:00
Vitalii Karavaev
436e96f734 Test :y 2018-08-03 18:15:24 +03:00
Vitalii Karavaev
67a9e1f8c5 Remove support for ex commands with visual selection and multiple carets support for :y 2018-08-03 17:30:44 +03:00
Vitalii Karavaev
fc0a950af1 Cleanup 2018-08-03 14:35:23 +03:00
Vitalii Karavaev
e1872387d4 Shortcut for caret adding prototype 2018-08-03 14:08:06 +03:00
Vitalii Karavaev
ac10b96280 Better work with nullable carets 2018-08-03 11:15:17 +03:00
Vitalii Karavaev
d5313ebbda Remove warnings 2018-08-02 18:09:36 +03:00
Vitalii Karavaev
c3d1e5c58c Remove warnings 2018-08-02 17:26:08 +03:00
Vitalii Karavaev
478c0cd443 Replace block of code with function call 2018-08-02 17:20:29 +03:00
Vitalii Karavaev
2be2d861c9 Update action for [p and update package-info 2018-08-02 12:04:56 +03:00
Vitalii Karavaev
9731980fe6 Fixed incompatibility wit goto mark action and preparing to remove inconsistency between yank and delete 2018-08-02 11:57:06 +03:00
Vitalii Karavaev
392f8e5e60 Fix goto mark actions 2018-08-02 11:54:16 +03:00
Vitalii Karavaev
a7e1275b5f Remove redundant null check 2018-08-01 14:19:55 +03:00
Vitalii Karavaev
29a6d47cca Correct annotation 2018-08-01 14:18:04 +03:00
Vitalii Karavaev
65483dd34a Correct Javadoc 2018-08-01 14:12:08 +03:00
Vitalii Karavaev
3b290fe356 Add tests and fix bug for CopyGroup 2018-08-01 13:59:05 +03:00
Vitalii Karavaev
2648913b61 Corrected review issues 2018-08-01 10:55:54 +03:00
Vitalii Karavaev
d386e49bd5 Simplify logic and remove unused logger 2018-08-01 10:42:31 +03:00
Vitalii Karavaev
f3c66d131e Test :m 2018-07-31 16:38:00 +03:00
Vitalii Karavaev
c1b4671435 Multiple carets support for :m 2018-07-31 16:37:47 +03:00
Vitalii Karavaev
cbeb0d229b Remove todo 2018-07-31 10:49:35 +03:00
Vitalii Karavaev
7f8db50017 Test :pu 2018-07-31 10:44:56 +03:00
Vitalii Karavaev
0c5ca37412 Multiple carets support for :pu command 2018-07-31 10:41:45 +03:00
Vitalii Karavaev
602071a440 Remove warning 2018-07-30 17:50:17 +03:00
Vitalii Karavaev
7061b58940 Remove warnings 2018-07-30 17:44:25 +03:00
Vitalii Karavaev
76c2c54e5a Remove unnecessary comments 2018-07-30 15:50:26 +03:00
Vitalii Karavaev
f256da8a16 Tests :co 2018-07-30 15:42:31 +03:00
Vitalii Karavaev
ffcf7d0630 Multiple carets support for :co 2018-07-30 15:42:20 +03:00
Vitalii Karavaev
b80205200c Tests for :j 2018-07-30 15:17:28 +03:00
Vitalii Karavaev
40d0f6c1e2 Multiple carets support for join lines via :j 2018-07-30 15:05:41 +03:00
Vitalii Karavaev
bddd4db2b2 Uncertainty 2018-07-30 15:04:19 +03:00
Vitalii Karavaev
7ee18e81c7 Remove unused function 2018-07-30 10:56:50 +03:00
Vitalii Karavaev
700240d441 Remove warnings 2018-07-26 15:24:34 +03:00
Vitalii Karavaev
539d38259c Remove TODO 2018-07-26 15:17:29 +03:00
Vitalii Karavaev
2efb0dfb17 Multicaret support for go to line 2018-07-26 14:52:40 +03:00
Vitalii Karavaev
f38bf65656 Tests for ex commands 2018-07-26 13:56:08 +03:00
Vitalii Karavaev
947d32d905 Multiple carets support for :go command 2018-07-26 13:55:51 +03:00
Vitalii Karavaev
56569966a6 Preparing for multicaret support for ex commands 2018-07-26 13:55:24 +03:00
Vitalii Karavaev
6092535041 Remove some warnings 2018-07-26 11:46:14 +03:00
Vitalii Karavaev
d965eb0d7e Tests for fix overlapping carets 2018-07-26 11:34:05 +03:00
Vitalii Karavaev
44a53ce28e Fix bug with overlapping carets 2018-07-26 11:33:32 +03:00
Vitalii Karavaev
a228f32f34 Remove possible NPE 2018-07-26 11:01:04 +03:00
Vitalii Karavaev
2082981bd6 Permute parameters 2018-07-26 10:28:41 +03:00
Vitalii Karavaev
994ad0b06c Tests 2018-07-25 16:47:14 +03:00
Vitalii Karavaev
3c59ee79f6 Refactoring and TODO 2018-07-25 16:47:00 +03:00
Vitalii Karavaev
b3ebd7c29d Fix caret order for different put cases 2018-07-25 14:53:28 +03:00
Vitalii Karavaev
fcc2355037 Add caret offsets to tests 2018-07-25 12:00:04 +03:00
Vitalii Karavaev
76a5c39fdc Remove warnings and fixed null handling 2018-07-25 11:24:22 +03:00
Vitalii Karavaev
f4ec448d75 Add constants and remove TODO 2018-07-25 11:06:54 +03:00
Vitalii Karavaev
e38390f8a1 Codestyle 2018-07-25 10:59:12 +03:00
Vitalii Karavaev
2990389ea5 Codestyle 2018-07-25 10:50:03 +03:00
Vitalii Karavaev
249dfb166d Change if/else block to switch 2018-07-25 10:03:20 +03:00
Vitalii Karavaev
4c06d21396 Proper marks in case of put [count] 2018-07-25 09:57:56 +03:00
Vitalii Karavaev
a046f2975f Remove TODO: use tabs as needed 2018-07-24 11:51:52 +03:00
Vitalii Karavaev
0bf217ef36 Pair.NonNull instead of Pair 2018-07-24 10:12:19 +03:00
Vitalii Karavaev
f2712d8cfb Pair.create instead of constructor call 2018-07-23 18:14:59 +03:00
Vitalii Karavaev
bb32e7adb4 Multiple carets support for put visual text 2018-07-23 16:33:04 +03:00
Vitalii Karavaev
cadaec585b Minor fixes 2018-07-23 13:25:55 +03:00
Vitalii Karavaev
11c2f5014f Fixed bug yank blockwise 2018-07-23 12:50:58 +03:00
Vitalii Karavaev
2326489658 Multiple carets support for yank visual 2018-07-23 12:39:31 +03:00
Vitalii Karavaev
01ec08e20b Multiple carets support for going to character/line in command mode 2018-07-20 14:16:18 +03:00
Vitalii Karavaev
69ebcc17e9 Put text bug fixed 2018-07-20 14:15:27 +03:00
Vitalii Karavaev
b86bdd7847 Explicitly passing carets to some methods and cleanup 2018-07-20 11:53:50 +03:00
Vitalii Karavaev
fbd7409851 Moved putText to single method and better work with multicaret insertion 2018-07-20 11:25:53 +03:00
Vitalii Karavaev
0773c886ee Fixed bug with put blockwise text. Properly this time 2018-07-19 18:00:14 +03:00
Vitalii Karavaev
d05c7268d9 Fixed bug with put blockwise text 2018-07-19 17:44:11 +03:00
Vitalii Karavaev
80d0748edd minor 2018-07-19 17:15:42 +03:00
Vitalii Karavaev
fcbf228d35 Proper indent after yank commands 2018-07-19 16:53:22 +03:00
Vitalii Karavaev
34feb27bef Yank commands and tests 2018-07-19 16:11:28 +03:00
Vitalii Karavaev
86f707bc51 More tests 2018-07-19 15:57:13 +03:00
Vitalii Karavaev
07f74f82b5 Better tests for put text commands 2018-07-19 12:44:48 +03:00
Vitalii Karavaev
60917433d2 Update package-info 2018-07-19 11:22:36 +03:00
Vitalii Karavaev
dd59e0704a Update package-info 2018-07-19 11:18:57 +03:00
Vitalii Karavaev
d4bf472291 Refactoring 2018-07-19 11:07:56 +03:00
Vitalii Karavaev
039b650953 Remove redundant caret passing 2018-07-19 11:06:31 +03:00
Vitalii Karavaev
0148860b2d Test for put text 2018-07-18 15:39:21 +03:00
Vitalii Karavaev
49590c831f PutTextAfterCursorAction implemented 2018-07-18 15:39:06 +03:00
Vitalii Karavaev
9aed0ce621 Revert CopyGroup and implement putTextBeforeCursor action 2018-07-18 12:27:37 +03:00
Vitalii Karavaev
9b653a7c63 Fix visual block insert/append 2018-07-18 10:38:16 +03:00
Vitalii Karavaev
8d919d6ec8 Added some tests 2018-07-17 15:59:27 +03:00
Vitalii Karavaev
bb0094038a Remove unnecessary caret passing in some cases and started to simplify ChangeGroup methods 2018-07-17 15:59:01 +03:00
Vitalii Karavaev
c29764b164 Updated .gitignore and codestyle config 2018-07-17 09:45:19 +03:00
Vitalii Karavaev
ae55f5d605 Multicaret support for yank visual range 2018-07-16 14:41:48 +03:00
Vitalii Karavaev
81ca21517a Update package-info 2018-07-16 14:41:27 +03:00
Vitalii Karavaev
24a4167296 Multicaret support for yank motion 2018-07-16 13:59:19 +03:00
Vitalii Karavaev
3ffd967b00 Update package-info 2018-07-16 13:41:50 +03:00
Vitalii Karavaev
a2a1f4806a Multicaret support for yank lines 2018-07-16 13:39:16 +03:00
Vitalii Karavaev
6b56d7d1cd Remove redundant code 2018-07-16 12:06:21 +03:00
Vitalii Karavaev
b5a802bf30 Update package-info 2018-07-16 11:58:39 +03:00
Vitalii Karavaev
b4586779b3 Remove unused function 2018-07-16 11:34:43 +03:00
Vitalii Karavaev
d92d5a1b33 Remove unused functions 2018-07-16 11:32:59 +03:00
Vitalii Karavaev
52ec080343 Remove unused function 2018-07-16 11:31:38 +03:00
Vitalii Karavaev
5bff61c2ee Discard redundant changes 2018-07-16 11:23:48 +03:00
Vitalii Karavaev
c12b713543 Remove unused methods and fix bug 2018-07-16 11:19:00 +03:00
Vitalii Karavaev
7bafa0f8c8 Fix broken going to [count] line end. 2018-07-16 11:16:43 +03:00
Vitalii Karavaev
a47cdb9f35 Remove unnecessary throws clause 2018-07-16 11:15:24 +03:00
Vitalii Karavaev
bd9ac3b031 Pull check if caret is not null up in base class 2018-07-16 11:14:29 +03:00
Vitalii Karavaev
22ad45cd58 Fixed expression with both pure and side-effects and inline unnecessary function call 2018-07-16 11:12:53 +03:00
Vitalii Karavaev
58e0b7704b Remove unused method 2018-07-16 10:30:19 +03:00
Vitalii Karavaev
b78854b8de Remove unnecessary function calls and properly handle multicaret jump to mark 2018-07-16 10:29:12 +03:00
Vitalii Karavaev
ae61ed456f Multiple carets support for put text instead of visual block 2018-07-12 17:32:50 +03:00
Vitalii Karavaev
bdc1103641 Proper indents 2018-07-12 15:45:47 +03:00
Vitalii Karavaev
689d19759d Remove indent in pasting text where necessary 2018-07-12 15:44:52 +03:00
Vitalii Karavaev
7f34b826b2 Fix test 2018-07-12 14:29:37 +03:00
Vitalii Karavaev
064d3765c0 Multiple carets support for auto indent and refactoring 2018-07-12 14:29:12 +03:00
Vitalii Karavaev
752814a5fb .idea/Project.xml removed 2018-07-12 14:26:15 +03:00
Vitalii Karavaev
861028ef5c Proper code style 2018-07-12 12:20:03 +03:00
Vitalii Karavaev
dad0d8e559 Tests for pasting 2018-07-12 12:18:44 +03:00
Vitalii Karavaev
75f88c539c Multiple carets support for putting text without indent 2018-07-12 10:20:31 +03:00
Vitalii Karavaev
1109650fde Multiple carets support for put text 2018-07-12 10:06:11 +03:00
Vitalii Karavaev
704f8d7e9d Proper indent in visual mode changes 2018-07-10 15:37:06 +03:00
Vitalii Karavaev
4a2c3d9098 Inserting new line for particular caret bug fixed 2018-07-10 14:22:32 +03:00
Vitalii Karavaev
d21b04acb5 Better multiple carets handling in some cases and cleanup 2018-07-10 13:38:17 +03:00
Vitalii Karavaev
5403336c78 Minor code cleanup 2018-07-09 16:09:54 +03:00
Vitalii Karavaev
def6d2bd5b Change behaviour when inserting previously inserted text 2018-07-09 14:53:54 +03:00
Vitalii Karavaev
04db2764c1 Better insertion after line end 2018-07-09 14:47:24 +03:00
Vitalii Karavaev
0e9b2250bd Multiple carets support for inserting after line end 2018-07-09 14:38:42 +03:00
Vitalii Karavaev
654d345d78 Fix bug in insertion previously inserted text 2018-07-09 11:05:59 +03:00
Vitalii Karavaev
99e379392b Fix typo 2018-07-09 09:54:41 +03:00
Vitalii Karavaev
1debd99701 Multiple carets support for jumping to older/newer cursor position in jump list 2018-07-06 17:03:48 +03:00
Vitalii Karavaev
a099070c79 Multiple carets support for moving caret to the middle column 2018-07-06 15:22:52 +03:00
Vitalii Karavaev
0a09b8bd5a Multiple carets support for motion to first non-blank character of the screen line 2018-07-06 15:09:56 +03:00
Vitalii Karavaev
b3750dd24d Multiple carets support for motion to first/last screen column 2018-07-06 14:59:13 +03:00
Vitalii Karavaev
db1b0c2516 Multiple carets support for searching substrings 2018-07-06 14:32:19 +03:00
Vitalii Karavaev
fc6208b95d Goto first line bug fixed 2018-07-06 14:17:43 +03:00
Vitalii Karavaev
e68d3eac7d Multiple carets support for repeating latest search 2018-07-06 12:41:48 +03:00
Vitalii Karavaev
d093b446c2 Multiple carets support for going to [count] line from bottom of window 2018-07-06 12:19:21 +03:00
Vitalii Karavaev
be839051d5 Multiple carets support for going to [count] line from bottom of window 2018-07-06 12:07:16 +03:00
Vitalii Karavaev
8937068b5f Multiple carets support for going to [count] line from top of window 2018-07-06 11:58:21 +03:00
Vitalii Karavaev
3f82020100 Multiple carets support for going to line 2018-07-06 11:39:57 +03:00
Vitalii Karavaev
63ee6bbc56 Multiple carets support for searching entry in reversed direction 2018-07-05 17:40:23 +03:00
Vitalii Karavaev
7046680765 Multiple carets support for searching entry in forward direction 2018-07-05 17:35:54 +03:00
Vitalii Karavaev
c17334f17f Multiple carets support for jumping on mark line 2018-07-05 17:13:01 +03:00
Vitalii Karavaev
ecd40231a5 Multiple carets support for jumping to mark added 2018-07-05 16:52:32 +03:00
Vitalii Karavaev
c3935aafc9 Tests for finding next item in line 2018-07-05 09:44:25 +03:00
Vitalii Karavaev
9b751da31c Multiple carets support for matching items 2018-07-04 17:48:34 +03:00
Vitalii Karavaev
b464d99bd5 Tests for searching whole word 2018-07-04 16:23:59 +03:00
Vitalii Karavaev
f3d168f19f Multiple carets support for searching whole word 2018-07-04 16:08:37 +03:00
Vitalii Karavaev
bb8fa94668 Tests for moving cursor after last char in the file 2018-07-04 15:11:10 +03:00
Vitalii Karavaev
4f4d9fda0b Multiple carets support for moving cursor after last char in the file 2018-07-04 15:10:32 +03:00
Vitalii Karavaev
24994fa387 Test for moving carets to the first char in the file 2018-07-04 14:44:12 +03:00
Vitalii Karavaev
f4bb745519 Multiple carets support for moving cursor to the first char in the file 2018-07-04 14:41:17 +03:00
Vitalii Karavaev
a03258999a Multiple carets support for deleting the word before cursor in insert mode 2018-07-04 12:31:29 +03:00
Vitalii Karavaev
3f45200cb9 Fixed bug in test 2018-07-04 12:28:08 +03:00
Vitalii Karavaev
4703e75003 Test for inserting previously inserted text and stop inserting added 2018-07-04 10:20:43 +03:00
Vitalii Karavaev
39b166b87f Multiple caret support for insert previously inserted text and stop inserting added 2018-07-04 10:19:17 +03:00
Vitalii Karavaev
ded21efe5f Test for inserting previously inserted text 2018-07-03 15:49:46 +03:00
Vitalii Karavaev
4952ddc494 Multiple carets support for inserting previously inserted text 2018-07-03 15:49:03 +03:00
Vitalii Karavaev
8ffc9b6581 Simple case for insert previous inserted text implemented 2018-07-02 17:46:17 +03:00
Andrey Vlasovskikh
f0be6581b2 Merge branch 'master' into multiple-carets
# Conflicts:
#	src/com/maddyhome/idea/vim/action/motion/object/MotionInnerBlockTagAction.java
#	src/com/maddyhome/idea/vim/action/motion/object/MotionOuterBlockTagAction.java
#	src/com/maddyhome/idea/vim/group/MotionGroup.java
#	src/com/maddyhome/idea/vim/helper/SearchHelper.java
2018-06-29 12:39:39 +03:00
Andrey Vlasovskikh
356217a6af Added Konstantin Petrov to the contributors list 2018-06-28 16:12:39 +03:00
Andrey Vlasovskikh
9b5c86211b Updated changelog 2018-06-28 16:12:20 +03:00
Andrey Vlasovskikh
ef470bd890 Merge branch 'FIX-VIM-1287' 2018-06-28 16:09:47 +03:00
Andrey Vlasovskikh
428d75968c VIM-1287 More tests for badly nested blocks and strings 2018-06-28 16:09:21 +03:00
Andrey Vlasovskikh
dca4b0a399 VIM-1287 Removed redundant code 2018-06-28 16:08:55 +03:00
Andrey Vlasovskikh
2380e1b013 Added Jan Palus to the contributors 2018-06-04 16:11:50 +03:00
Andrey Vlasovskikh
9718445b44 Updated the changelog 2018-06-04 16:11:38 +03:00
Andrey Vlasovskikh
7f897440b7 Merge remote-tracking branch 'jpalus/master' 2018-06-04 16:05:10 +03:00
Andrey Vlasovskikh
5b21074b9d Merge remote-tracking branch 'jpalus/VIM-1431' 2018-06-04 16:01:42 +03:00
Jan Palus
b0714075eb add test for VIM-1427 (tag motion with count) 2018-06-02 15:26:02 +02:00
Jan Palus
956b56a772 add test for VIM-1431 (put in empty file) 2018-06-02 15:10:26 +02:00
Jan Palus
50b2093548 generalize check on offset boundaries 2018-06-02 15:09:28 +02:00
Andrey Vlasovskikh
bc5ca28b13 Fixed API incompatibility 2018-05-30 22:26:50 +03:00
Andrey Vlasovskikh
653a62b5e4 Switched to IntelliJ 2018.1 2018-05-30 22:26:24 +03:00
Andrey Vlasovskikh
08780e1a5c Updated changelist 2018-05-30 21:54:23 +03:00
Andrey Vlasovskikh
ce39355025 Added Florian Hassmann to the list of contributors 2018-05-30 21:53:05 +03:00
Andrey Vlasovskikh
3eed987488 Fixed code inspection warnings in FileGroup 2018-05-30 21:51:20 +03:00
Andrey Vlasovskikh
6f633700ae Removed deprecated API usages 2018-05-30 21:27:57 +03:00
Andrey Vlasovskikh
a7670829d5 Fixed NPE 2018-05-30 21:27:01 +03:00
Andrey Vlasovskikh
6fb8817391 Code style 2018-05-30 21:24:02 +03:00
Jan Palus
e90b7276cb VIM-1431 handle empty documents when checking if line is empty
Signed-off-by: Jan Palus <jpalus@fastmail.com>
2018-05-29 23:08:40 +02:00
Andrey Vlasovskikh
a1ba5fec2b Updated the index of supported and not supported commands 2018-05-29 22:45:04 +03:00
Andrey Vlasovskikh
6606211233 Incomplete commands index with the current status of multi-caret support 2018-05-29 20:08:32 +03:00
Andrey Vlasovskikh
b1daacc9fb Added TODO items for unused actions 2018-05-29 20:04:23 +03:00
Jan Palus
03fe7d9ea2 VIM-1427 add count support to tag motion 2018-05-29 00:45:44 +02:00
Vasily Alferov
2d3da163a8 Attempt to fix Visual Block down movements 2018-05-26 21:52:57 +03:00
Vasily Alferov
49c59764ac Merge in change.insert actions 2018-05-26 20:17:12 +03:00
Vasily Alferov
06cc59b7a3 Got rid of deprecated overrides in EditorActionHandlerBase 2018-05-26 19:47:47 +03:00
Vasily Alferov
7754080323 Various fixes 2018-05-25 11:45:11 +03:00
Vasily Alferov
ebf081e273 Multicaret shift 2018-05-22 22:51:49 +03:00
Vasily Alferov
258467467b Multicaret insert 2018-05-22 22:02:26 +03:00
Vasily Alferov
bbea7e787f Merge pull request #3 from vasalf/multicaret-change
Multicaret change.change
2018-05-22 00:18:05 +03:00
Vasily Alferov
4f468cace7 Multicaret change.change 2018-05-22 00:16:58 +03:00
Vasily Alferov
b2f736adf5 Merge pull request #2 from vasalf/multicaret-change
Multicaret deletion
2018-05-21 19:10:08 +03:00
Vasily Alferov
9ddedbe752 Multicaret delete visual operator actions 2018-05-21 19:08:40 +03:00
Vasily Alferov
63b237114a Multicaret version for VisualOperatorActionHandler 2018-05-21 17:05:38 +03:00
Vasily Alferov
29c789dcf3 Implementations of all of the delete actions whose handlers doesn't override VisualOperatorActionHandler. 2018-05-20 13:55:33 +03:00
Vasily Alferov
59e2ae552e ChangeEditorActionHandler multicaret version and multicaret delete tests 2018-05-12 21:24:28 +03:00
Vasily Alferov
9d396a5cfa Merge remote-tracking branch 'origin/multicaret-motions' into multicaret-motions 2018-05-12 19:04:30 +03:00
Vasily Alferov
422557d4ce Cosmetical changes 2018-05-12 19:01:01 +03:00
Vasily Alferov
04ebbcc3a9 Merge pull request #1 from vasalf/multicaret-visual
Multicaret merging selections & text objects
2018-05-12 17:09:49 +03:00
Vasily Alferov
0919e9d560 Multicaret merging selections & text objects 2018-05-12 17:08:19 +03:00
Vasily Alferov
8af14edf21 Fix accidentally changed file 2018-05-05 12:09:49 +03:00
Vasily Alferov
13c475d73c Fix multiple carets movement in case i<ESC>i<ESC> 2018-05-05 12:01:00 +03:00
Vasily Alferov
1373af6f66 Fix accidentally changed files 2018-05-05 11:13:26 +03:00
Vasily Alferov
291ad2906d Fix accidentally deleted files 2018-05-05 11:06:33 +03:00
Vasily Alferov
be5532b35d Comment out text object multiple carets tests. 2018-05-05 10:59:58 +03:00
Vasily Alferov
b2402aad2e reset accidentally changed file 2018-04-27 20:29:49 +03:00
Vasily Alferov
3b46e44e4f action.motion.text.* multicaret tests and implementation 2018-04-27 20:24:26 +03:00
Vasily Alferov
537ec30936 object.MotionInner* tests 2018-04-24 23:43:21 +03:00
Vasily Alferov
a75db02d05 Fix failed tests on Visual Block Mode. 2018-04-24 22:17:10 +03:00
Vasily Alferov
4698f1be5c Reformat code with IntellIJ IDEA tool. 2018-04-16 16:11:53 +03:00
Vasily Alferov
1db103e352 Basic multicaret up-down motions.
+ Create a class for caret-specific data and move LAST_COLUMN getter/setter there.
2018-04-16 16:05:52 +03:00
Vasily Alferov
5037a1182f Fix unused imports 2018-03-29 17:21:30 +05:30
Vasily Alferov
6b476fa75f Fix accidentally changed file 2018-03-29 10:34:44 +05:30
Vasily Alferov
4d46000ec6 Write most of multicaret leftright actions.
MotionColumnAction, MotionFirstColumnAction, MotionFirstNonSpaceAction, MotionLastColumnAction, MostionLastMatchCharAction, MotionLastMatchCharReverseAction, MotionLastNonSpaceAction, MotionLeftAction, MotionLeftMatchCharAction, MotionLeftTillMatchCharAction, MotionRightAction, MotionRightMatchCharAction, MotionRightTillMatchCharAction now have their own native multi-caret implementations.
2018-03-29 10:18:35 +05:30
Vasily Alferov
56ad6b4c0d Multi-caret basic leftright motions.
Add basic multi-caret interfaces (i.e. deprecated and new functions to EditorActionHandlerBase) and overloaded them in MotionLeftAction and MotionRightAction.
2018-03-21 17:13:57 +03:00
Florian Hassmann
ab750b6e75 Fixes #VIM-1404. 2018-01-29 12:22:15 +01:00
Andrey Vlasovskikh
44a4a858fe IDEA-184351 Check if project is disposed before setting editor line numbers
Setting line numbers requires re-initializing the editor that means
accessing project code style settings. If the project has been disposed
then this operation is illegal.
2017-12-29 11:34:56 +03:00
Andrey Vlasovskikh
74fb59640d Added parameter for toggling code instrumentation
Several recent test runs failed with errors instrumenting code with
nullity checks. This parameter will help to debug the problem.
2017-12-29 11:12:01 +03:00
Andrey Vlasovskikh
797bfaaf3d Updated Gradle to 4.4.1 2017-12-29 11:01:27 +03:00
Andrey Vlasovskikh
0015a4357e Updated changelog 2017-12-29 10:32:22 +03:00
Andrey Vlasovskikh
dbdc15f21f Merge branch 'cypok/vim-1380' 2017-12-29 10:29:34 +03:00
Andrey Vlasovskikh
c9236527e4 Added Vladimir Parfinenko to contributors 2017-12-29 10:20:46 +03:00
Andrey Vlasovskikh
1a8c72d721 Merge branch 'cypok/vim-1379' 2017-12-29 10:19:08 +03:00
Andrey Vlasovskikh
739ef487fa Updated changelog 2017-12-29 10:18:48 +03:00
Andrey Vlasovskikh
b7273bc4f2 VIM-1379 Added check for empty ranges 2017-12-29 10:09:09 +03:00
Andrey Vlasovskikh
c3e9452fdc Added Maximilian Luz to contributors 2017-12-28 15:59:10 +03:00
Andrey Vlasovskikh
a4e34caa5d Updated changelog 2017-12-28 15:58:01 +03:00
Andrey Vlasovskikh
fea2f0ba1e VIM-1110 Added test 2017-12-28 15:54:49 +03:00
qzed
b98427472f VIM-1110 Fix caret jumping after escape from block-insert mode 2017-12-28 15:53:02 +03:00
Andrey Vlasovskikh
bf42822626 VIM-862 Keep selected text after running possibly async IDE action
E.g. `:action ReformatCode` is run asynchronously in another thread, so
we used to exit the visual mode (and thus dropped the selection) before
it was run.
2017-12-27 19:00:42 +03:00
Andrey Vlasovskikh
b71eb465cb Updated contribution guide and supported IDEs 2017-12-19 23:30:42 +03:00
Andrey Vlasovskikh
f072638c8c Merge pull request #129 from jamescmartinez/master
Update README to correct preference paths
2017-12-19 23:17:52 +03:00
Andrey Vlasovskikh
79afcd4b65 Added Naoto Ikeno to the contributors list 2017-12-18 00:58:24 +03:00
Andrey Vlasovskikh
595482048c Updated changelog 2017-12-18 00:57:50 +03:00
Andrey Vlasovskikh
2c99da538e VIM-1329 Use default modality state to run actions after focus settles down 2017-12-18 00:54:52 +03:00
Andrey Vlasovskikh
1393e60ca8 VIM-862 Properly apply and reset visual mode for running visual :action commands
Also fixed minor formatting and Java 8 issues.
2017-12-18 00:53:56 +03:00
Andrey Vlasovskikh
2e67c704f7 VIM-862 Fixed off-by-1 in restoring visual character selection after 'gv' 2017-12-18 00:52:29 +03:00
Andrey Vlasovskikh
c0410131bf Merge remote-tracking branch 'ikenox/feature/action-in-visual-mode' 2017-12-15 01:37:40 +03:00
Andrey Vlasovskikh
473a305e5f Use SecondaryLoop of JDK 8
The current version of IdeaVim is compatible with IntelliJ 2017.1+
which has switched to Java 8+, so we no longer need compatibility
layers for earlier versions.
2017-12-15 01:25:58 +03:00
Andrey Vlasovskikh
d53ca6cd90 Updated changelog 2017-12-14 03:31:02 +03:00
Andrey Vlasovskikh
bd84babecd Converted UiHelper into Kotlin 2017-12-14 03:26:01 +03:00
Andrey Vlasovskikh
1b83231b1c VIM-1329 Use IntelliJ API to request focus reliably 2017-12-14 00:29:11 +03:00
Andrey Vlasovskikh
f39ad34057 VIM-1368 Use IntelliJ API to run stuff after the current component gets focus 2017-12-14 00:28:02 +03:00
Andrey Vlasovskikh
942b64052d Inherit from VimTestCase to setup IntelliJ extension points properly
Otherwise these tests depend on the run order of other tests for
proper initialization.
2017-12-12 20:17:49 +03:00
Andrey Vlasovskikh
559aabd6b8 Version 0.49 2017-12-12 19:55:08 +03:00
Vladimir Parfinenko
52d26f9fb6 VIM-1380 Fixed 'cNw' at the last character of a word
Bug was introduced while fixing VIM-200
2017-11-20 11:37:42 +07:00
Naoto Ikeno
b7d124ce8d Make :action commands work in visual mode 2017-11-19 20:06:02 +09:00
Vladimir Parfinenko
6a5c70ee6a VIM-1379 Fix usage TextRange.size() as lines count
TextRange.size() should be used only for iterating over starts/ends
2017-11-19 13:49:12 +07:00
Andrey Vlasovskikh
a76b41b737 VIM-1367 Fixed resetting the default value
The previous fix tried to parse the current value instead of the default
one.
2017-11-03 05:00:29 +03:00
Andrey Vlasovskikh
2fc6553203 VIM-1367 Correctly reset parsed and stored 'iskeyword' option value 2017-11-03 04:26:46 +03:00
Andrey Vlasovskikh
98b003e601 VIM-1367 Deterministic order of options for reproducible tests 2017-11-03 04:23:29 +03:00
Andrey Vlasovskikh
0dda443cc8 Added iskeyword option to the list of supported set commands 2017-11-03 03:59:13 +03:00
Andrey Vlasovskikh
9322283cb1 Updated changelog 2017-11-03 03:56:00 +03:00
Andrey Vlasovskikh
95d412c78d Added nickgieschen to contributors 2017-11-03 03:54:06 +03:00
Andrey Vlasovskikh
6245b15d8f Cleanup 2017-11-03 03:48:15 +03:00
Andrey Vlasovskikh
ab1d7ba6cb VIM-1367 Removed unnecessary repetition in positive lookbehind
It resulted in an inspection warning that positive lookbehind groups
cannot contain 1 or more repetition patterns.
2017-11-03 03:34:11 +03:00
nickgieschen
ef05491991 VIM-1367 Implement iskeyword
(cherry picked from commit d91d38c)
2017-11-03 03:22:39 +03:00
Andrey Vlasovskikh
113642c8f5 Fixed test configuration URL 2017-11-01 03:15:05 +03:00
Andrey Vlasovskikh
088dd98e0d Updated test configuration ID 2017-11-01 03:14:23 +03:00
Andrey Vlasovskikh
7e0046a715 Updated changelog 2017-11-01 03:00:40 +03:00
Andrey Vlasovskikh
1a11d5df35 Added tieTYT to the list of contributors 2017-11-01 02:58:06 +03:00
tieTYT
57b5b319a7 VIM-523 Fixed global mark remembering only the line number
Bear with me as this is the first thing I've ever done with
Intellij-IDEA plugin development.

I tested this and I believe I fixed the problem.  The cause of the
problem was that the code was checking if the mark was in a different
file but if it was, it was using the editor of the current file to go
to the line of the mark.  I changed the code so that it opens the file
of the mark first, then jumps to its line number.

I need a VirtualFile so that I can get the Editor to open. The Mark
stores the path of the file it's in, but the path is not enough
information to get a VirtualFile.  I also need the "protocol" of the
file.  So, I had to change the structure of the Mark and add a
"protocol" field to it.

I had to update the save/load logic to use this new field, too.  This
way, when you restart Intellij-IDEA, the marks can still be used.  For
old marks, I defaulted the "protocol" to the value of "file".

One thing I couldn't figure out how to do is add a test case to check
that this is working correctly.  This is not due to a lack of effort.
In fact, I tried to write the test case first.  But I have been unable
to find any examples anywhere of testing multiple Editors, and that's
what's involved to fix this issue.  Because of this, this issue may be
best used as a reference to fix the problem instead of worthy of being
used in production.  Either way, I'd love to know how to write such a
test.
2017-11-01 02:35:23 +03:00
Andrey Vlasovskikh
0a4672c050 Updated intellij-gradle-plugin, Kotlin, and IntelliJ platform versions 2017-11-01 02:12:07 +03:00
Andrey Vlasovskikh
8808b651e2 Updated gradle wrapper to 4.3 2017-11-01 02:12:07 +03:00
Andrey Vlasovskikh
e9fca757b7 JetBrains project badge 2017-09-08 23:09:46 +03:00
Andrey Vlasovskikh
98a3801f6a New code style settings format of IntelliJ 2017.3 2017-09-08 23:06:24 +03:00
Konstantin Petrov
e97c49a032 Fix search for braces inside quotes the way vim does 2017-05-31 10:27:48 +02:00
Konstantin Petrov
0335b344a1 Add test to reproduce the bug 2017-05-31 10:27:00 +02:00
James Martinez
63b7bed61a Update README to correct preference paths 2017-05-16 16:20:00 -07:00
Andrey Vlasovskikh
49ecfd6879 Added Pavel Fatin to contributors 2017-01-16 01:03:42 +03:00
Andrey Vlasovskikh
4d4b5967da Updated CHANGES 2017-01-16 01:02:47 +03:00
Andrey Vlasovskikh
a882e37d04 Merge remote-tracking branch 'origin/vim-1007'
# Conflicts:
#	gradle.properties
#	resources/META-INF/plugin.xml
#	src/com/maddyhome/idea/vim/VimTypedActionHandler.java
2017-01-16 00:57:31 +03:00
Andrey Vlasovskikh
4734d23e29 Fixed compilation by adding Kotlin Gradle plugin 2017-01-16 00:42:55 +03:00
Andrey Vlasovskikh
b7416da26d Merge branch 'kotlin'
# Conflicts:
#	build.gradle
#	gradle.properties
2017-01-16 00:30:30 +03:00
Andrey Vlasovskikh
36e768ab37 Allow Java 8 2017-01-16 00:27:51 +03:00
Andrey Vlasovskikh
ede0bd8623 Set minimal version to 2017.1 in order to use new API for zero-latency typing 2017-01-16 00:25:47 +03:00
Andrey Vlasovskikh
b4072eb62d Use gradle-intellij-plugin 0.2.0 2017-01-15 23:36:27 +03:00
Andrey Vlasovskikh
120b69c439 Fixed source API compatibility with branch 171 2017-01-15 23:22:40 +03:00
Andrey Vlasovskikh
b68daf3f3e Version 0.48 2017-01-15 23:01:53 +03:00
Andrey Vlasovskikh
c32a1a5e5b Updated changelog and list of contributors 2016-11-29 00:43:41 +03:00
Andrey Vlasovskikh
a5e303d1ca Merge pull request #121 from gaganis/VIM-1216
Fixed . reseting the last find movement
2016-11-29 00:35:40 +03:00
Giorgos Gaganis
c4d8cef44d Fixed . reseting the last find movement where repeating change that also uses movement.
On the original vim when we repeat a change with . that also contain an find movement the last find that was typed before the repeat is the one used by the motion repeat ;. Before the commit the plugin would have reset the last movement to use the movement contained in the command that was repeated.

To solve this I took a simple approach where I save the last find motion before starting the repeat and then restoring it to its original value after the repeat is over. In order to access the find motion fields from RepeatChangeAction I created getters in MotionGroup for the movement type and character.

	modified:   src/com/maddyhome/idea/vim/action/change/RepeatChangeAction.java
	modified:   src/com/maddyhome/idea/vim/group/MotionGroup.java
	modified:   test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java
2016-11-28 19:05:11 +02:00
Andrey Vlasovskikh
72fbe758b4 VIM-1205 Don't move key handling into separate event for raw handlers 2016-11-22 21:58:32 +03:00
Andrey Vlasovskikh
3344bb3254 Ability to use Kotlin along with Java 2016-11-21 19:40:14 +03:00
Pavel Fatin
6b9ab7163a Support for zero-latency rendering, #VIM-1007 fixed 2016-10-26 12:53:13 +02:00
Andrey Vlasovskikh
563092cffb Fixed caret model exception when changing selection in documents open in several editors 2016-10-21 18:11:15 +03:00
Andrey Vlasovskikh
9a2a0c3b0e Split several channel names by comma 2016-10-19 17:26:23 +03:00
Andrey Vlasovskikh
f3b4726b34 Version 0.47 2016-10-19 15:58:35 +03:00
Andrey Vlasovskikh
30d7c6edf1 Remove obsolete pluginId 2016-09-30 21:15:51 +03:00
Andrey Vlasovskikh
f33f73d2f5 VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
We now use IntelliJ's version of invokeLater() in order to satisfy the
new protocol for running read-write actions in modal dialogs.
2016-09-30 20:44:16 +03:00
Andrey Vlasovskikh
b595dfd443 VIM-1098 Don't start visual selection when mouse click was actually drag over single character 2016-09-01 20:50:55 +03:00
Andrey Vlasovskikh
a3e15b5c76 Possibility to publish the plugin to multiple channels 2016-09-01 18:32:16 +03:00
Andrey Vlasovskikh
31d85c0221 Update gradle-intellij-plugin to 0.2.0-SNAPSHOT for multi-channel plugin publishing 2016-09-01 18:26:30 +03:00
Andrey Vlasovskikh
124bd55e18 Update gradle-intellij-plugin to 0.0.43 2016-07-08 12:19:02 +03:00
Andrey Vlasovskikh
bb9b5b5bde Use IntelliJ 15.0.5 by default 2016-07-08 12:19:02 +03:00
Andrey Vlasovskikh
f586e6dd29 Version 0.46
Due to the plugin versions comparision logic in the IntelliJ platform it's impossible to
update 0.45-eap-XXX to 0.45. Bumped version once again.
2016-07-07 18:27:09 +03:00
Andrey Vlasovskikh
c2b1b67b6b Parameter for customizing publish channel for plugin 2016-07-07 18:03:01 +03:00
Andrey Vlasovskikh
2cb29233c8 Version 0.45 2016-07-07 17:56:57 +03:00
Andrey Vlasovskikh
b0e0bebb7e Removed default error handler 2016-07-07 17:56:23 +03:00
Andrey Vlasovskikh
364b3567fc VIM-1126 Fixed warning about modifying shortcuts of global actions for 2016.2 2016-07-07 17:39:29 +03:00
Andrey Vlasovskikh
9522a51dc7 Enabling key repeat on Mac OS X doesn't require restart 2016-04-29 21:52:35 +03:00
Andrey Vlasovskikh
75335a8a01 Added Paulo Bu to the list of contributors 2016-04-29 21:37:42 +03:00
Andrey Vlasovskikh
0bf561e326 Merge remote-tracking branch 'pbu88/adds_more_folding_commands' 2016-04-29 21:34:19 +03:00
Andrey Vlasovskikh
7e6c2c2a7c Updated changelog 2016-04-29 21:28:41 +03:00
Andrey Vlasovskikh
b132d490f0 Typo 2016-04-29 21:20:22 +03:00
Andrey Vlasovskikh
3fde0fc209 Non-public methods made private 2016-04-29 21:19:17 +03:00
Andrey Vlasovskikh
24bc09796f Fixed NPE 2016-04-29 21:18:28 +03:00
Andrey Vlasovskikh
758bff79d6 Removed unused code 2016-04-29 21:16:05 +03:00
Andrey Vlasovskikh
3b0660799b VIM-843 Don't highlight search results after restart
Added limited support for 'viminfo' option. Only 'h' in 'viminfo' is
taken into account.
2016-04-29 21:15:01 +03:00
Andrey Vlasovskikh
6880afa73c VIM-139 Focus on current search and use modal confirmation for ':s///gc' 2016-04-29 01:33:28 +03:00
Andrey Vlasovskikh
01aae065ff Updated changelog 2016-04-28 20:17:22 +03:00
Andrey Vlasovskikh
8ee49edef0 VIM-287 Fixed insert new line before and after folds 2016-04-28 20:13:08 +03:00
Andrey Vlasovskikh
e09f6c7886 Failing tests for VIM-287 2016-04-28 19:38:19 +03:00
Andrey Vlasovskikh
dd0a7207d5 Removed old block selection API usages to become compatible with IntelliJ branch 146 2016-04-22 03:22:02 +03:00
Andrey Vlasovskikh
17700a6537 Updated changelog 2016-04-20 03:02:15 +03:00
Andrey Vlasovskikh
949444f6dd EAP for IdeaVim 2016-04-20 03:00:54 +03:00
Andrey Vlasovskikh
31832ac230 Don't specify build number as a separate entity in the plugin description 2016-04-20 02:31:38 +03:00
Andrey Vlasovskikh
33200f8208 Settings for publishing the plugin to the EAP channel 2016-04-20 01:56:46 +03:00
Andrey Vlasovskikh
893cd17c1a Updated changelog 2016-04-18 03:32:34 +03:00
Andrey Vlasovskikh
c471ddd12f Merge remote-tracking branch 'ayzenquwe/ayzen/VIM-259' 2016-04-18 02:47:38 +03:00
Andrey Vlasovskikh
b0ac8f89c5 Merge remote-tracking branch 'ayzenquwe/ayzen/VIM-964' 2016-04-18 02:41:35 +03:00
Andrey Vlasovskikh
a47338d8b7 Merge remote-tracking branch 'ayzenquwe/ayzen/VIM-564' 2016-04-18 02:36:58 +03:00
Andrey Vlasovskikh
76d00ab47f Merge remote-tracking branch 'ayzenquwe/ayzen/gomethod' 2016-04-18 02:31:11 +03:00
Andrey Vlasovskikh
22b8552939 Updated changelog 2016-04-18 02:29:15 +03:00
Andrey Vlasovskikh
1d25a04377 Added Aleksey Lagoshin to list of contributors 2016-04-18 02:26:41 +03:00
Andrey Vlasovskikh
52148f69c1 Merge remote-tracking branch 'ayzenquwe/ayzen/registers' 2016-04-18 02:24:00 +03:00
Andrey Vlasovskikh
f280f8138d Support <Plug> in mapping commands 2016-04-18 01:46:46 +03:00
Andrey Vlasovskikh
530846bc7a Added 'timeout' option for toggling timeout for mapping commands 2016-04-18 01:46:46 +03:00
Andrey Vlasovskikh
27adde7af0 Merge pull request #108 from agriesbaum/master
Improve diction of README
2016-04-06 19:41:57 +04:00
Alexander Griesbaum
e3869a201f Improve diction of README 2016-04-05 22:44:26 +02:00
Andrey Vlasovskikh
745a356c87 Cleanup 2016-02-21 07:08:21 +03:00
Andrey Vlasovskikh
b16a4a1343 Handle <Esc> in modal input better 2016-02-21 07:00:44 +03:00
Andrey Vlasovskikh
36e41555ea Cleaned up ModalEntry 2016-02-21 06:16:11 +03:00
Andrey Vlasovskikh
3f824cf205 Enable SecondaryLoop-based implementation for Java 7+ 2016-02-21 06:07:34 +03:00
dhleong
c61b3c2f29 More closely emulate SecondaryLoop with reflection and a Proxy 2016-02-17 20:46:33 -05:00
dhleong
fd97cfbd15 Add compat layer for JDK6
JDK7 mode works like a dream, but JDK6 still seems to break
after the first invocation.
2016-02-15 09:19:18 -05:00
dhleong
4b4c293008 Refactor modal input for Vim Extensions
Doesn't use dialogs, so should fix VIM-1086
2016-02-14 13:23:51 -05:00
Andrey Vlasovskikh
69a573a279 Handle <Esc> in inputKeyStroke() uniformly as "typed Esc" 2016-02-09 00:40:37 +03:00
Andrey Vlasovskikh
c33d4d989e Clearer offsets comparison + multi-line deletion test 2016-02-09 00:20:58 +03:00
dhleong
3cd1134973 Fix calculation of how to paste surrounded value
Fixes VIM-1085; includes test
2016-02-06 10:23:05 -05:00
Andrey Vlasovskikh
4f42d4dc4f Merge branch 'vlasovskikh/surround'
# Conflicts:
#	CHANGES.md
#	resources/META-INF/plugin.xml
#	src/com/maddyhome/idea/vim/option/Options.java
2016-02-04 23:08:37 +03:00
Andrey Vlasovskikh
a3b4aecded Docs about 'surround' extension 2016-02-04 23:02:29 +03:00
Andrey Vlasovskikh
534ae6aa81 Added Daniel Leong to the list of contributors 2016-02-04 22:54:15 +03:00
Andrey Vlasovskikh
7e1e50ffde Cleanup 2016-02-04 22:52:59 +03:00
Andrey Vlasovskikh
ab3cbb113e Restore caret position properly 2016-02-04 22:18:37 +03:00
dhleong
1c7e6af1fc Fix <esc> not sent after VSurround; support change with tags 2016-02-02 20:57:54 -05:00
dhleong
84f7e25c5e Cleanup overly verbose code; remove unused import 2016-02-02 20:32:09 -05:00
dhleong
458fe97b75 Add visual surround (S) command 2016-01-30 09:31:25 -05:00
dhleong
31364607f5 Add ds command; jump to start when executed to match vim-surround 2016-01-30 09:14:34 -05:00
dhleong
56ec2c7ebc Add cs action
Note that, unfortunately, we can't do `cst`, as IdeaVim doesn't
support the tag textobject. Once that's supported, however, we
just need to disable the safety check to enable that.
2016-01-30 09:02:06 -05:00
Andrey Vlasovskikh
f944d91d62 Updated changelog 2016-01-30 02:10:31 +03:00
Andrey Vlasovskikh
2cf7d89581 VIM-271 Added 'incsearch' option for showing search results while typing 2016-01-30 02:05:24 +03:00
Andrey Vlasovskikh
91546700d4 Added simple ys{motion}t tag surround and input() function 2016-01-26 22:25:36 +03:00
Andrey Vlasovskikh
a972aec9b0 Implementation notes 2016-01-26 21:33:31 +03:00
Andrey Vlasovskikh
6328575639 'ys{motion}<' requires further user input to wrap text into HTML tags 2016-01-26 21:15:29 +03:00
Andrey Vlasovskikh
af534c9209 Repeat is not supported for 'ys' yet 2016-01-26 21:14:43 +03:00
Andrey Vlasovskikh
82a1e920e0 Initial refactoring of dhleong's 'ys' on top of extension infrastructure 2016-01-26 21:14:15 +03:00
Andrey Vlasovskikh
d46d292865 Added surround tests for 'ys' by dhleong 2016-01-26 18:15:00 +03:00
Andrey Vlasovskikh
1a96533a3c Added unit test-friendly version of VimExtensionFacade.getKeyStroke() 2016-01-26 18:14:14 +03:00
Andrey Vlasovskikh
2d86054fe8 Fixed regression after setChangeMarks() refactoring 2016-01-26 17:49:05 +03:00
Andrey Vlasovskikh
50e3af7b82 Added modal getKeyStroke() similar to Vim's getchar() 2016-01-26 04:17:19 +03:00
Andrey Vlasovskikh
27af4b926b Added the 'g@' command for IdeaVim extensions 2016-01-26 01:02:20 +03:00
Andrey Vlasovskikh
1d035acb6d Vim extension facade for executing emulated Vim statements built-in functions 2016-01-24 20:14:54 +03:00
Andrey Vlasovskikh
3704c321fa Added the ability to map keys to IdeaVim extension handlers 2016-01-24 19:57:37 +03:00
Andrey Vlasovskikh
9c6f35f3bd Added mechanism for providing extensions for IdeaVim like ported Vim plugins 2016-01-24 19:04:12 +03:00
Andrey Vlasovskikh
47b49c3e03 Merge pull request #93 from raimon49/use-relative-links
Use relative links that recommended way by GitHub Inc.
2016-01-23 02:24:35 +03:00
Andrey Vlasovskikh
7a99261979 Updated "Setting up development environment" for Gradle 2016-01-23 02:15:08 +03:00
Andrey Vlasovskikh
8eda58825f Put /out/ back 2016-01-23 02:14:40 +03:00
Andrey Vlasovskikh
6ee43c0014 Removed old project files 2016-01-23 01:46:43 +03:00
Andrey Vlasovskikh
bea3d58ddb Removed old project file 2016-01-23 01:45:44 +03:00
Andrey Vlasovskikh
71b121c15c Use source code for Gradle Wrapper 2016-01-23 00:32:01 +03:00
Andrey Vlasovskikh
7c8b6d2fe6 Removed old IntelliJ project files in favor of non-version-controlled Gradle files 2016-01-23 00:31:31 +03:00
Andrey Vlasovskikh
5d33c46e6b Updated code style settings 2016-01-23 00:30:22 +03:00
Andrey Vlasovskikh
8aac0ebdb6 Configurable option for downloading IntelliJ sources 2016-01-22 23:49:32 +03:00
Andrey Vlasovskikh
6072aae338 Add build number to archive name 2016-01-22 23:47:29 +03:00
Andrey Vlasovskikh
872b916d46 Added Gradle Wrapper 2016-01-22 22:46:44 +03:00
Alexander Zolotov
86303b58df Use retina-friendly svg status images 2016-01-22 22:44:48 +03:00
Andrey Vlasovskikh
78b1ad6df6 Switched from Ant to Gradle for easier dependency on IntelliJ in automated builds 2016-01-22 22:15:38 +03:00
Andrey Vlasovskikh
e5ac7ee607 Send stats reports in internal mode 2016-01-22 21:41:35 +03:00
Andrey Vlasovskikh
480b32b5af Fixed AIOOBE in tag selection for files starting with '/' and containing '>' 2016-01-21 18:28:14 +03:00
Andrey Vlasovskikh
8c9cf09bd8 Report usage statistics 2016-01-21 17:51:21 +03:00
Andrey Vlasovskikh
7ceea17050 Added DataGrip to the list of supported IDEs 2016-01-21 02:22:48 +03:00
Andrey Vlasovskikh
76333c5a24 Updated copyright years 2016-01-21 02:20:57 +03:00
Andrey Vlasovskikh
85857a3319 Updated changelog 2016-01-21 02:02:08 +03:00
Andrey Vlasovskikh
5ad2bb4bea Updated current IntelliJ URL 2016-01-21 02:01:51 +03:00
Andrey Vlasovskikh
cb9d205336 VIM-796 Execute :action handler strictly after request focus handler 2016-01-21 01:44:27 +03:00
Andrey Vlasovskikh
e1a292ba33 Merge remote-tracking branch 'smartbomb/ActionHandler-focus-fix' 2016-01-21 01:28:20 +03:00
Andrey Vlasovskikh
fa4e54b32e Inline since-build into build.xml for running in internal mode 2016-01-21 01:27:22 +03:00
smartbomb
3ba41ac458 VIM-892 Fix various focus related issues when executing :action commands a keymap
also fixes VIM-1001, VIM-1016 and hopefully VIM-962 but unable to fully reproduce
2015-12-30 22:06:52 +01:00
Andrey Vlasovskikh
2fbe85e60f Added Teruo and Liubov to the list of contributors 2015-12-03 15:39:54 +03:00
Andrey Vlasovskikh
676a518fa8 Updated changelog 2015-12-03 15:39:23 +03:00
Andrey Vlasovskikh
992c1923f6 Use Guava for more idiomatic list operations 2015-12-03 15:33:04 +03:00
lubba
a22afdd0f6 VIM-364 Added support for tag block selection 2015-12-03 15:19:54 +03:00
Andrey Vlasovskikh
0da8625f30 VIM-1040 Fixed typing keys in completion menus and typing with the plugin disabled 2015-11-02 15:53:50 +03:00
Andrey Vlasovskikh
4cc784eb95 VIM-1039 Fixed running the plugin with Java 6 2015-11-02 00:45:23 +03:00
Andrey Vlasovskikh
ee3bec9eed Version 0.42 2015-11-01 02:23:09 +03:00
Andrey Vlasovskikh
24788ac86f Updated changelog 2015-10-30 16:11:16 +03:00
Andrey Vlasovskikh
9af3c732b5 Updated CI icons 2015-10-30 16:04:35 +03:00
Andrey Vlasovskikh
e5873fe5f9 Use HTTP by default 2015-10-30 15:41:55 +03:00
Andrey Vlasovskikh
39f088cdcd VIM-970 Use raw typed handlers in order not to require write action in read-only files
This change requires the API of IntelliJ platform branch 143+.
2015-10-30 15:37:17 +03:00
Andrey Vlasovskikh
e805852721 Platform prefix initialization is no longer needed 2015-10-30 15:20:36 +03:00
Andrey Vlasovskikh
e136ecc1f8 Added generated idea/ to excluded folders 2015-10-30 15:19:42 +03:00
Andrey Vlasovskikh
efa4001440 Require minimal platform version 143 2015-10-30 15:19:19 +03:00
Paulo Bu
52a0af1636 Adds zC and zO folding commands 2015-08-28 15:59:13 +02:00
ayzen
5fc66b5896 ={motion} implementation, == with count and fix for VIM-259 2015-07-11 21:44:36 +03:00
ayzen
80dec29832 Fix for VIM-965 with a test 2015-07-01 23:31:25 +03:00
raimon
2c7d3c9971 Use relative links that recommended way by GitHub Inc. 2015-06-23 21:56:46 +09:00
ayzen
30a16e9496 Corrected typo that prevented correct calculation for marks vertical shifting; added a test 2015-06-14 10:54:15 +03:00
ayzen
0d6526ea31 Mark should not be deleted due to change commands that start from the beginning of the mark line 2015-06-14 10:41:52 +03:00
ayzen
4428340fd9 Fix for VIM-964 (marks get removed if one-char line is replaced by r) with a test 2015-06-14 10:38:36 +03:00
ayzen
900ce21445 Fix for VIM-564 (g_ didn't work correctly) with tests 2015-06-12 22:43:19 +03:00
Andrey Vlasovskikh
68c20ed48d Version 0.41 2015-06-10 15:42:02 +03:00
Andrey Vlasovskikh
c5760ceaab VIM-957 Fixed compatibility with IDEs other than IntelliJ 2015-06-10 15:41:33 +03:00
Andrey Vlasovskikh
8c7c9a67a6 Version 0.40 2015-06-09 23:01:54 +03:00
ayzen
efad5545de Correct behavior of numbered registers 2015-06-05 21:09:31 +03:00
ayzen
afb411dd35 Added tests for special registers 2015-06-05 21:09:16 +03:00
Andrey Vlasovskikh
85231b314f More readable test data 2015-04-24 16:29:56 +03:00
Andrey Vlasovskikh
210b2efd47 Updated changelog 2015-04-24 16:12:30 +03:00
Andrey Vlasovskikh
ae5b1385ea Merge branch 'matching-comments' 2015-04-24 16:08:54 +03:00
Andrey Vlasovskikh
011ce28251 More readable tests for '%' 2015-04-24 16:08:32 +03:00
Andrey Vlasovskikh
efb58b45df Cleanup 2015-04-24 16:02:20 +03:00
Andrey Vlasovskikh
7d033787eb Better place for cleaning global variables 2015-04-24 14:31:06 +03:00
Andrey Vlasovskikh
3a47583cf9 Clean global variables 2015-04-24 14:27:38 +03:00
Andrey Vlasovskikh
565b4b3f2f Updated changelog 2015-04-24 14:25:10 +03:00
Andrey Vlasovskikh
574f32a6dd Merge pull request #84 from JetBrains/mapleader
Mapleader support based on the prototype of a Vim script expressions evaluator
2015-04-24 13:33:38 +03:00
Andrey Vlasovskikh
0e67c8ff69 Removed unnecessary 'static' declaration 2015-04-24 13:32:26 +03:00
Andrey Vlasovskikh
b886073c11 VIM-650 Added support for 'mapleader' 2015-04-24 13:32:04 +03:00
Andrey Vlasovskikh
57c35b9a74 Merge remote-tracking branch 'origin/master' 2015-04-22 20:27:31 +03:00
Andrey Vlasovskikh
f5100694d6 VIM-930 Get editor focus after closing Ex entry box on Oracle Java 6 2015-04-22 20:26:41 +03:00
Andrey Vlasovskikh
3ff9bfcc13 Initial support for 'let' and 'echo' commands
These commands evaluate Vim script expressions. Right now they are
limited to a highly limited subset of Vim script expressions that is
however enough for settings the 'mapleader' variable for VIM-650.
2015-04-05 22:54:40 +03:00
Andrey Vlasovskikh
6c8d2bfd9e Merge pull request #83 from khromalabs/master
Added deployment instructions to README.md
2015-04-04 23:10:24 +03:00
Rubén Gómez
637f7f48ad Modified deployment instructions in README.md as suggested in pull request #83 2015-04-02 09:11:52 +02:00
Rubén Gómez
8eae80d30f Added deployment instructions to README.md 2015-03-30 23:55:04 +02:00
Andrey Vlasovskikh
9a103276e3 Merge pull request #82 from jflorian/master
Added note about where .ideavimrc is located
2015-03-30 16:39:52 +03:00
John Florian
6386f011f7 Merge remote-tracking branch 'upstream/master' 2015-03-30 09:32:09 -04:00
John Florian
742d6e63d9 Change - note regarding non-default user.home setting
Some users (e.g., me) have a non-default user.home VM option and this
affects where IdeaVim looks for its configuration file.  This note might
save some head scratching.
2015-03-30 09:26:32 -04:00
Andrey Vlasovskikh
f6141603ef Merge pull request #81 from jflorian/master
Аdd mapping example using :action
2015-03-29 02:20:19 +03:00
John Florian
7a5b4e565a Change - add mapping example using :action
This example may be helpful to regular VIM users since the :action and
:actionlist commands are specific to IdeaVIM.
2015-03-28 11:12:02 -04:00
Andrey Vlasovskikh
373e1527c1 Extracted Vim script parts into 'vimscript' package 2015-03-28 14:16:38 +03:00
Andrey Vlasovskikh
9cb05b6a7d Updated changelog 2015-03-27 21:55:45 +03:00
Andrey Vlasovskikh
74bf5ff044 Formatting and typos 2015-03-27 21:43:36 +03:00
Andrey Vlasovskikh
0f7e9d11b6 Added test for VIM-845 2015-03-27 21:43:19 +03:00
Andrey Vlasovskikh
5fadc2fb9f Removed unused imports 2015-03-27 21:30:05 +03:00
Andrey Vlasovskikh
96bbcf623f Removed unnecessary 'static' in enums 2015-03-27 21:20:17 +03:00
Andrey Vlasovskikh
89e853158c Typos 2015-03-27 21:19:56 +03:00
Andrey Vlasovskikh
5c31fcc03e Extracted CommandState.inVisualBlockMode() 2015-03-27 21:18:08 +03:00
Andrey Vlasovskikh
3fee4a803b Merge remote-tracking branch 'dezgeg/fixes/visual-block-mode-overhaul' 2015-03-27 20:56:58 +03:00
Andrey Vlasovskikh
8b61f559d7 Updated default code style settings 2015-03-24 23:52:04 +03:00
Andrey Vlasovskikh
4bd058f5dc Updated changelog 2015-03-24 23:51:34 +03:00
Andrey Vlasovskikh
999ccf87fc Merge remote-tracking branch 'dezgeg/fixes/vim-700-remap-zero' 2015-03-24 23:48:11 +03:00
Andrey Vlasovskikh
4e45e885b9 Merge remote-tracking branch 'dezgeg/feature/ant-improvements' 2015-03-24 23:25:31 +03:00
Tuomas Tynkkynen
6aee9ccaf1 build.xml: forkmode=once makes tests much faster
Since classloading of the IntelliJ platform takes a lot of time,
using forkmode=once in the Ant file makes running the unit tests from
Ant much faster (down to 16 seconds from 93 seconds) and is also more
closer to how the tests are run in the IDE.
2015-02-21 21:25:47 +02:00
Tuomas Tynkkynen
af3c6ff012 build.xml: Generate XML reports from JUnit test reports
The XML reports are useful for private CI servers like Jenkins.
2015-02-21 21:25:47 +02:00
Tuomas Tynkkynen
0c9bdf5168 Visual block mode overhaul
The current visual block mode implementation has several bugs:

- The GUI never displays the rightmost characters as selected (blue)
- Due to some off-by-one, commands can't act on each line's last character
- It's possible for newlines to get deleted/changed into something else
- If the '$' mode is entered, the GUI doesn't always indicate this
- It's impossible to move to an empty line (VIM-781)

This commit fixes all of those problems. The only remaining problem are
the visible secondary carets, which makes seeing the real cursor a bit
difficult. This could be fixed later if support for per-caret visibility
would be added to IntelliJ core.
2015-02-21 17:17:36 +02:00
Tuomas Tynkkynen
82a9587b4f Support comments in brace matching
In Vim, '%' can be used to jump between the '/*' and '*/' of block
comments. Support this functionality in a language-independent manner.
2015-02-21 15:14:38 +02:00
Tuomas Tynkkynen
850f4d7ec5 Make IdeaVIM build on latest intellij-community master
The zero-parameter overload of createStructureViewModel() has been
marked deprecated and is now removed.
2015-02-21 15:12:16 +02:00
Tuomas Tynkkynen
8d1dcc4568 VIM-700 Remapping '0' should still allow zero to be entered in count
Previously, remapping '0' in command mode would prevent a number zero
from being entered in a command count.
2015-02-21 15:09:13 +02:00
Andrey Vlasovskikh
3650ab85df Updated changelog 2015-01-21 19:50:50 +03:00
Andrey Vlasovskikh
e1e1cc2666 Code style
Use javadoc comments, added nullity annotations, extracted common
expressions.
2015-01-21 19:49:41 +03:00
Tuomas Tynkkynen
79fd32088b VIM-868 Allow count on 'gt' and 'gT'
'{count}gt' can now be used to switch to a specific tab.
'{count}gT' can now be used to switch to a n:th previous tab.
2015-01-21 18:11:48 +02:00
Andrey Vlasovskikh
458e0fc76d Updated changelog 2015-01-21 16:31:26 +03:00
Tuomas Tynkkynen
5090c81632 VIM-856 Fix regex lookbehind bugs
The regex code has the following bugs, mostly related to lookbehind:
    - Comparison of CharPointers with == is wrong, .equals should be
      used instead.

    - In the original C code, the behind_pos variable is declared as
      'static regsave_T behind_pos;', i.e. not a pointer, and the same
      for other variables of type regsave_T. So assignments to these
      types of variables need to make deep copies.
2015-01-20 17:52:08 +02:00
Andrey Vlasovskikh
dcd035353b Updated IntelliJ version to the latest one available for download 2015-01-20 18:41:00 +03:00
Andrey Vlasovskikh
8606ce21bd Added Jackson Popkin to the contributors 2015-01-20 17:47:50 +03:00
Andrey Vlasovskikh
72537c6ffb Merge remote-tracking branch 'jdpopkin/relative_range'
Conflicts:
	test/org/jetbrains/plugins/ideavim/ex/SubstituteCommandTest.java
2015-01-20 17:17:27 +03:00
Andrey Vlasovskikh
30f9888f51 Merge remote-tracking branch 'selesse/sort-fix' 2015-01-20 16:06:36 +03:00
Andrey Vlasovskikh
d5a2b92121 Updated changelog 2015-01-20 15:59:39 +03:00
Andrey Vlasovskikh
fd3eee6870 Merge remote-tracking branch 'dezgeg/fixes/vim-864-visual-substitute-incorrect-visual-marks' 2015-01-20 15:50:17 +03:00
Andrey Vlasovskikh
2d6d1003b7 Merge remote-tracking branch 'dezgeg/fixes/vim-575-split-cursor' 2015-01-20 15:44:46 +03:00
Andrey Vlasovskikh
499c590f5a Merge remote-tracking branch 'dezgeg/unit-tests' 2015-01-20 15:36:18 +03:00
Andrey Vlasovskikh
787b78ef36 Typo 2015-01-20 15:31:46 +03:00
Andrey Vlasovskikh
88a0b0fa23 Removed unused ExEntryPanel.processKey() 2015-01-20 15:31:33 +03:00
Andrey Vlasovskikh
1519f04930 Fixed potential NPEs 2015-01-20 15:30:17 +03:00
Andrey Vlasovskikh
e0a1291de0 Merge remote-tracking branch 'dezgeg/fixes/vim-210-ex-focus' 2015-01-20 15:27:55 +03:00
Andrey Vlasovskikh
8a2d881002 Cleanup
Removed commented code, renamed '\0' to '\u0000' for consistency,
fixed nullable warnings, declared some variables final.
2015-01-20 14:50:55 +03:00
Tuomas Tynkkynen
4802b6f460 VIM-864 Fix visual marks getting changed during visual substitute
Previously, running a substitute command in visual mode would
incorrectly set the visual mode end mark (>) to the location of the last
search match.
2014-12-24 18:19:53 +02:00
Jackson Popkin
8c0e116a1c Fix incorrect behavior in substitution with offset ranges
Substitution commands with offset ranges like .,+2s/a/b/g previously
did not work the way they do in Vim (replace a with b on the current
line and the next two lines). This change fixes that bug.
2014-12-23 21:14:42 -05:00
Alex Selesse
8862878011 Fix broken sorting when sorting with leading whitespace 2014-12-14 12:17:51 -05:00
Tuomas Tynkkynen
bdf3361243 VIM-575 Don't change cursor position of other splits in visual mode
If a file is opened in multiple splits, entering visual mode in one
split would change the cursor position in other splits as well.
2014-12-14 15:20:36 +02:00
Tuomas Tynkkynen
6b5216077b Add few simple mark tests. 2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
7e119f7963 Add tests for change number operations (<C-A>, <C-X>) 2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
933cbc7e51 Add unit tests for some replace commands
Adds tests for: |r|, |s|, |R|, and <Ins> in insert mode.
2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
65f30d4480 Add testcase for '>' in visual block mode 2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
1f8d3f119e Add unit tests for Ex ranges
Adds tests for ranges in Ex commands. Almost every kind of range has
basic tests, except the following are still totally untested:
    - \/, \?, \&
    - register ranges
    - syntax errors in ranges
2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
45fe858503 Add tests for case changing operations
Add tests for the following commands:
- gu, gU, g~ in normal mode
- u, U, ~ in visual mode
2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
0cc06ad186 Move ChangeActionTest.doTest() to VimTestCase.
This method is convenient in other tests as well.
2014-12-12 23:05:28 +02:00
Tuomas Tynkkynen
18cd7547ad VIM-210 Fix focus issues with the Ex panel
Previously, if the editor window had been splitted, under certain
conditions some actions related to the Ex panel would cause the editor
focus to change to a different split.

The required conditions for this bug to occur:
    - no docked windows (like the Project sidebar) are open
    - 'View -> Navigation bar' is disabled

At least these actions triggered the bug:
    - search with /
    - successfully executing an Ex command
    - dismissing the Ex window with Esc
    - Ex commands that opened the output panel (e.g. :!)

All the deleted lines of the form
    FileEditorManager.getInstance(project).openFile(vf, true);
seem to be very old, non-functional workarounds for the focus issue.
2014-12-09 13:36:03 +02:00
Tuomas Tynkkynen
7746a26062 VIM-855 Fix regexp character class bugs
Previously strchr and istrchr didn't consider NUL chars as end-of-string
terminators. This caused problems in regexps using character classes:
a regexp like "[^a]bc" would be effectively treated as "[^abc]bc" - i.e.
some literal characters from the rest of the pattern would accidentally be
included in the character class.
2014-12-09 01:01:53 +02:00
Andrey Vlasovskikh
a47fc9d3be Don't share editor data contexts
The previous code threw "cannot share data context between Swing events"
throwables from DataManagerImpl$MyDataContext.getData since we used to
share DataContext objects passed to
VimShortcutKeyAction.actionPerformed() and
VimTypedActionHandler.execute() inside AnActionEvent objects with
runnables we invoked via SwingUtilities.invokeLater().
2014-12-07 18:40:51 +03:00
Andrey Vlasovskikh
8fdf75330c Updated changelog 2014-12-07 16:43:52 +03:00
Andrey Vlasovskikh
d6ebaa26b0 Merge branch 'invoke-shortcuts-handler-later' 2014-12-07 16:42:31 +03:00
Andrey Vlasovskikh
27bd7ec836 Merge remote-tracking branch 'dezgeg/fixes/misc-issues' 2014-12-07 16:28:15 +03:00
Andrey Vlasovskikh
f2a0408801 VIM-586 Try to invoke Vim shortcuts handler later to restore input events sequence 2014-11-27 15:09:06 +03:00
Tuomas Tynkkynen
7ccb6c8411 Optimize character case changing operations
Previously, performing e.g. visual '~' on a large file would completely
lock up the IDE. The culprit seemed to be the calls to replaceText() one
character at a time, which is not a cheap operation since each
replaceText() will for example trigger a DocumentChanged event.
2014-11-22 13:15:15 +02:00
Tuomas Tynkkynen
1518831f37 Add some missing key names. 2014-11-22 13:15:15 +02:00
Tuomas Tynkkynen
3bdfaa02e1 'J' shouldn't add whitespace if there is trailing whitespace 2014-11-22 13:15:11 +02:00
Tuomas Tynkkynen
e8de9f915c Make '>' not add trailing whitespace to empty lines. 2014-11-22 13:14:23 +02:00
476 changed files with 15565 additions and 4103 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*.swp *.swp
/.gradle/
/.idea/ /.idea/
/idea/ /build/
/out/ /out/
/tmp/ /tmp/

View File

@@ -141,11 +141,8 @@
</indentOptions> </indentOptions>
</codeStyleSettings> </codeStyleSettings>
<codeStyleSettings language="Groovy"> <codeStyleSettings language="Groovy">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_LINE_BREAKS" value="false" /> <option name="KEEP_LINE_BREAKS" value="false" />
<option name="ELSE_ON_NEW_LINE" value="true" /> <option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" /> <option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" /> <option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" /> <option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
@@ -154,7 +151,6 @@
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" /> <option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" /> <option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" /> <option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" /> <option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" /> <option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" /> <option name="METHOD_PARAMETERS_WRAP" value="5" />
@@ -165,12 +161,9 @@
<option name="METHOD_CALL_CHAIN_WRAP" value="1" /> <option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" /> <option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" /> <option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" /> <option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" /> <option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" /> <option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" /> <option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" /> <option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" /> <option name="FIELD_ANNOTATION_WRAP" value="0" />
@@ -227,6 +220,10 @@
<option name="TAB_SIZE" value="8" /> <option name="TAB_SIZE" value="8" />
</indentOptions> </indentOptions>
</codeStyleSettings> </codeStyleSettings>
<codeStyleSettings language="JSON">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="JSP"> <codeStyleSettings language="JSP">
<indentOptions> <indentOptions>
<option name="INDENT_SIZE" value="2" /> <option name="INDENT_SIZE" value="2" />
@@ -259,7 +256,6 @@
</codeStyleSettings> </codeStyleSettings>
<codeStyleSettings language="Python"> <codeStyleSettings language="Python">
<option name="KEEP_LINE_BREAKS" value="false" /> <option name="KEEP_LINE_BREAKS" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" /> <option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings> </codeStyleSettings>
<codeStyleSettings language="SQL"> <codeStyleSettings language="SQL">
@@ -276,5 +272,4 @@
</option> </option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component> </component>
</project> </project>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

10
.idea/misc.xml generated
View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IntelliJ Plugin SDK" project-jdk-type="IDEA JDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

9
.idea/modules.xml generated
View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ideavim.iml" filepath="$PROJECT_DIR$/ideavim.iml" />
</modules>
</component>
</project>

View File

@@ -1,36 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" runner="idea">
<pattern>
<option name="PATTERN" value="com.maddyhome.idea.vim.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="org.jetbrains.plugins.ideavim.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="ideavim" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="PACKAGE_NAME" value="org.jetbrains.plugins.ideavim" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Cover" />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Cover" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

View File

@@ -1,10 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IdeaVim" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="ideavim" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -Didea.is.internal=true" />
<option name="PROGRAM_PARAMETERS" value="" />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

7
.idea/vcs.xml generated
View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -33,6 +33,27 @@ Contributors:
* [Thomas B Homburg](mailto:thomas@homburg.dk) * [Thomas B Homburg](mailto:thomas@homburg.dk)
* [smartbomb](mailto:smartbomb@server.fake) * [smartbomb](mailto:smartbomb@server.fake)
* [Tuomas Tynkkynen](mailto:tuomas.tynkkynen@iki.fi) * [Tuomas Tynkkynen](mailto:tuomas.tynkkynen@iki.fi)
* [Jackson Popkin](mailto:jackson@donorschoose.org)
* [Teruo Kunihiro](mailto:yuyuyu1999@gmail.com)
* [Liubov Paina](mailto:lubashka.994@mail.ru)
* [Daniel Leong](mailto:falcone88@gmail.com)
* [Aleksey Lagoshin](mailto:aleksey@pri-num.com)
* [Paulo Bu](mailto:pbu_98@yahoo.com)
* [Giorgos Gaganis](mailto:gaganis@yahoo.com)
* [Pavel Fatin](mailto:pavel.fatin@jetbrains.com)
* [tieTYT](mailto:tietyt@gmail.com)
* [Nick Gieschen](mailto:nickgieschen@gmail.com)
* [Naoto Ikeno](mailto:ikenox@gmail.com)
* [Maximilian Luz](mailto:qzed@users.noreply.github.com)
* [Vladimir Parfinenko](mailto:vparfinenko@excelsior-usa.com)
* [Florian Hassmann](mailto:hassmann@hwdev.de)
* [Jan Palus](mailto:jpalus@fastmail.com)
* [Konstantin Petrov](mailto:kpetrov@ripe.net)
* [Vasily Alferov](mailto:ya-ikmik2012@yandex.ru)
* [Vitalii Karavaev](mailto:fkve97@gmail.com)
* [John Lin](mailto:johnlinp@gmail.com)
* [Alex Plate](mailto:alexpl292@gmail.com)
* [Matt Ellis](mailto:m.t.ellis@gmail.com)
If you are a contributor and your name is not listed here, feel free to If you are a contributor and your name is not listed here, feel free to
contact the maintainer. contact the maintainer.

View File

@@ -4,6 +4,188 @@ The Changelog
History of changes in IdeaVim for the IntelliJ platform. History of changes in IdeaVim for the IntelliJ platform.
Get an Early Access
-------------------
Would you like to try new features and fixes? Join the Early Access Program and
receive EAP builds as updates! Add this URL to "Settings | Plugins |
Browse Repositories | Manage Repositories":
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim)
It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
To Be Released
--------------
...
0.51, 2019-02-12
----------------
* [VIM-1558](https://youtrack.jetbrains.com/issue/VIM-1558) Fixed scrolling for code with block inlays in Rider 2018.3
* [VIM-1187](https://youtrack.jetbrains.com/issue/VIM-1187) Improved performance of `set relativelinenumber` on large files
* [VIM-620](https://youtrack.jetbrains.com/issue/VIM-620) Fixed handling `<C-O>` and `<Esc>` in Insert and Replace modes
* [VIM-798](https://youtrack.jetbrains.com/issue/VIM-798) Allow arrow keys for window navigation commands
0.50, 2018-10-18
----------------
Moved "Vim Emulation" settings into "File | Settings | Vim Emulation". Support
for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>` (put `set
multiple-cursors` into your ~/.ideavimrc to enable it). Support for running
Vim commands for multiple cursors. Various bug fixes.
* [VIM-634](https://youtrack.jetbrains.com/issue/VIM-634) Support for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
* [VIM-780](https://youtrack.jetbrains.com/issue/VIM-780) Support for running Vim commands for multiple cursors
* [VIM-176](https://youtrack.jetbrains.com/issue/VIM-176) Fixed arrow key navigation in Run/Debug tool windows
* [VIM-339](https://youtrack.jetbrains.com/issue/VIM-339) Fixed `<Esc>` in diff windows
* [VIM-862](https://youtrack.jetbrains.com/issue/VIM-862) Allow `:action` to work in visual mode
* [VIM-1110](https://youtrack.jetbrains.com/issue/VIM-1110) Put the caret in correct place after `I` in visual block mode
* [VIM-1329](https://youtrack.jetbrains.com/issue/VIM-1329) Request focus reliably for Ex entry and output panels
* [VIM-1368](https://youtrack.jetbrains.com/issue/VIM-1368) Wait for focus reliably before running an `:action`
* [VIM-1379](https://youtrack.jetbrains.com/issue/VIM-1379) Fixed `I` for short lines in visual block mode
* [VIM-1380](https://youtrack.jetbrains.com/issue/VIM-1380) Fixed `cw` with count at the end of a word
* [VIM-1404](https://youtrack.jetbrains.com/issue/VIM-1404) Fixed the ability to use `:e#` when editor tabs are hidden
* [VIM-1431](https://youtrack.jetbrains.com/issue/VIM-1431) Fixed pasting text into the empty document
* [VIM-1427](https://youtrack.jetbrains.com/issue/VIM-1427) Added the support for count to the `it` and `at` motions
* [VIM-1287](https://youtrack.jetbrains.com/issue/VIM-1287) Fixed `i(` actions inside string literals
* [VIM-1317](https://youtrack.jetbrains.com/issue/VIM-1317) Don't run Undo/Redo inside write actions
* [VIM-1366](https://youtrack.jetbrains.com/issue/VIM-1366) Don't wrap a secondary event loop for `input()` into a write action
* [VIM-1274](https://youtrack.jetbrains.com/issue/VIM-1274) Correctly process escaping when `smartcase` is on
0.49, 2017-12-12
----------------
Enabled zero-latency typing for Vim emulation. Added support for `iskeyword` option. Various bug fixes.
* [VIM-1254](https://youtrack.jetbrains.com/issue/VIM-1254) Enable zero-latency typing for Vim emulation
* [VIM-1367](https://youtrack.jetbrains.com/issue/VIM-1367) Support `iskeyword` option
* [VIM-523](https://youtrack.jetbrains.com/issue/VIM-523) Fixed global mark remembering only the line number
0.48, 2017-01-15
----------------
A bugfix release.
Bug fixes:
* [VIM-1205](https://youtrack.jetbrains.com/issue/VIM-1205) Don't move key handling into separate event for raw handlers
* [VIM-1216](https://youtrack.jetbrains.com/issue/VIM-1216) Fixed `.` resetting the last find movement while repeating change that also uses movement
Features:
* Support for zero-latency rendering
0.47, 2016-10-19
----------------
A bugfix release.
Bug fixes:
* VIM-1098 Don't start visual selection when mouse click was actually drag over single character
* VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
0.46, 2016-07-07
----------------
Added `incsearch` option for incremental search. Added support for `it` and
`at` tag block selection. Added `vim-surround` commands `ys`, `cs`, `ds`,
`S`. Various bug fixes.
Features:
* VIM-769 Added `vim-surround` commands `ys`, `cs`, `ds`, `S`
* VIM-264 Added tag block selection
* VIM-271 Added `incsearch` option for showing search results while typing
* VIM-217 Added support for `={motion}` formatting command
Bug fixes:
* VIM-796 Fixed focus issues with `:action` command
* VIM-581 Fixed use of special registers `0`-`9` and `-` in delete commands
* VIM-965 Fixed exception in `[m` in some file types
* VIM-564 Fixed `g_` move to go to the current line
* VIM-964 Fixed marks behavior when the whole line got deleted
* VIM-259 Move caret to the line beginning after `==`
* VIM-246 Fixed `{count}==` formatting
* VIM-287 Fixed insert new line before and after folds
* VIM-139 Focus on current search and use modal confirmation for `:s///gc`
* VIM-843 Don't highlight search results after restart
* VIM-1126 Fixed warning about modifying shortcuts of global actions for 2016.2
0.44, 2015-11-02
----------------
A bugfix release.
* VIM-1040 Fixed typing keys in completion menus and typing with the
plugin disabled
0.43, 2015-11-02
----------------
A bugfix release.
* VIM-1039 Fixed running the plugin with Java 6
0.42, 2015-11-01
----------------
This release is compatible with IntelliJ 15+ and other IDEs based on the
IntelliJ platform branch 143+.
* VIM-970 Fixed move commands in read-only files
0.41, 2015-06-10
----------------
A bugfix release.
* VIM-957 Fixed plugin version 0.40 is not compatible with IDEs other than
IntelliJ
0.40, 2015-06-09
----------------
Added support for `mapleader`. Support comments in `%` brace matching. Various
bug fixes.
Features:
* VIM-650 Added support for `mapleader`
* VIM-932 Support comments in `%` brace matching
Bug fixes:
* VIM-586 Invoke Vim shortcuts handler later to restore the sequence of input
events
* VIM-838 `J` shouldn't add whitespace if there is a trailing space
* VIM-855 Fixed regexp character class problem
* VIM-210 Fix focus issues with the Ex panel and splits
* VIM-575 Don't change cursor position of other splits in visual mode
* VIM-864 Fixed visual marks getting changed during visual substitute
* VIM-856 Fixed regex look-behind problem
* VIM-868 Allow count on `gt` and `gT`
* VIM-700 Remapping `0` should still allow it to be entered in command count
* VIM-781 Fixed expanding visual block selection past empty lines
* VIM-845 Fixed `c` and `x` functionality for visual block selections
* VIM-930 Fixed editor focus issues after closing Ex entry box on Oracle Java 6
0.39, 2014-12-03 0.39, 2014-12-03
---------------- ----------------

132
README.md
View File

@@ -2,27 +2,33 @@ IdeaVim
======= =======
<div> <div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt299&guest=1"> <a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:bt299)/statusIcon"/> <img src="http://jb.gg/badges/official.svg" alt="official JetBrains project"/>
</a>
</div>
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Build&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Build)/statusIcon.svg?guest=1"/>
</a> </a>
<span>Build<span> <span>Build<span>
</div> </div>
<div> <div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt453&guest=1"> <a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20182&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:bt453)/statusIcon"/> <img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20182)/statusIcon.svg?guest=1"/>
</a> </a>
<span>Tests</span> <span>Tests</span>
</div> </div>
IdeaVim is a Vim emulation plug-in for IDEs based on the IntelliJ platform. IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ platform.
IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm, IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
AppCode, CLion and Android Studio. RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
Resources: Resources:
* [Plugin homepage](http://plugins.jetbrains.com/plugin/164) * [Plugin homepage](http://plugins.jetbrains.com/plugin/164)
* [Changelog](https://github.com/JetBrains/ideavim/blob/master/CHANGES.md) * [Changelog](CHANGES.md)
* [Bug tracker](http://youtrack.jetbrains.com/issues/VIM) * [Bug tracker](http://youtrack.jetbrains.com/issues/VIM)
* [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1) * [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
* [@IdeaVim](http://twitter.com/ideavim) in Twitter * [@IdeaVim](http://twitter.com/ideavim) in Twitter
@@ -36,12 +42,29 @@ Start the IDE normally and enable the Vim emulation using "Tools | Vim
Emulator" menu item. At this point you must use Vim keystrokes in all editors. Emulator" menu item. At this point you must use Vim keystrokes in all editors.
If you wish to disable the plugin, select the "Tools | Vim Emulator" menu so If you wish to disable the plugin, select the "Tools | Vim Emulator" menu so
it is unchecked. At this point IDE will work with its regular keyboard it is unchecked. At this point your IDE will work with its regular keyboard
shortcuts. shortcuts.
Keyboard shortcut conflicts between the Vim emulation and the IDE can be Keyboard shortcut conflicts between the Vim emulation and the IDE can be
resolved via "File | Settings | Vim Emulation", "File | Settings | Keymap" resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
and key mapping commands in your ~/.ideavimrc file. Keymap" on Linux & Windows, and by "Preferences | Editor | Vim Emulation",
"Preferences | Keymap" on macOS. They can also be resolved by key mapping
commands in your ~/.ideavimrc file.
Get an Early Access
-------------------
Would you like to try new features and fixes? Join the Early Access Program and
receive EAP builds as updates! Add this URL to "Settings | Plugins |
Browse Repositories | Manage Repositories":
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim)
See [the changelog](CHANGES.md) for the list of hot unreleased features.
It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
Summary of Supported Vim Features Summary of Supported Vim Features
@@ -57,7 +80,7 @@ Supported:
* Undo/redo * Undo/redo
* Visual mode commands * Visual mode commands
* Some Ex commands * Some Ex commands
* Some [:set options](https://github.com/JetBrains/ideavim/blob/master/doc/set-commands.md) * Some [:set options](doc/set-commands.md)
* Full Vim regexps for search and search/replace * Full Vim regexps for search and search/replace
* Key mappings * Key mappings
* Macros * Macros
@@ -66,6 +89,11 @@ Supported:
* Window commands * Window commands
* Vim web help * Vim web help
Emulated Vim plugins:
* vim-surround
* vim-multiple-cursors
Not supported (yet): Not supported (yet):
* Jump lists * Jump lists
@@ -73,7 +101,7 @@ Not supported (yet):
See also: See also:
* [List of recently added commands](https://github.com/JetBrains/ideavim/blob/master/src/com/maddyhome/idea/vim/package-info.java) * [The list of all supported commands](src/com/maddyhome/idea/vim/package-info.java)
* [Top features and bugs](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes) * [Top features and bugs](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
@@ -91,6 +119,29 @@ Note, that IdeaVim currently parses ~/.ideavimrc file via simple pattern matchin
see [VIM-669](http://youtrack.jetbrains.com/issue/VIM-669) for proper parsing see [VIM-669](http://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
of VimL files. of VimL files.
Also note that if you have overridden the `user.home` JVM option, this
will affect where IdeaVim looks for your .ideavimrc file. For example, if you
have `-Duser.home=/my/alternate/home` then IdeaVim will source
`/my/alternate/home/.ideavimrc` instead of `~/.ideavimrc`.
Emulated Vim Plugins
--------------------
IdeaVim extensions emulate some plugins of the original Vim. In order to use
IdeaVim extensions, you have to enable them via this command in your ~/.ideavimrc:
set <extension-name>
Available extensions:
* surround
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
* Commands: `ys`, `cs`, `ds`, `S`
* multiple-cursors
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
Changes to the IDE Changes to the IDE
------------------ ------------------
@@ -99,16 +150,17 @@ Changes to the IDE
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ platform, The IdeaVim plugin uses the undo/redo functionality of the IntelliJ platform,
so the behaviour of the `u` and `<C-R>` commands may differ from the original so the behaviour of the `u` and `<C-R>` commands may differ from the original
Vim. Vim compatibility of undo/redo may be improved in the future releases. Vim. Vim compatibility of undo/redo may be improved in future releases.
See also [unresolved undo issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+u). See also [unresolved undo issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+u).
### Escape ### Escape
Using `<Esc>` in dialog windows remains problematic. For most dialog windows Using `<Esc>` in dialog windows remains problematic. For most dialog windows
the Vim emulator is put into the insert mode without the possibility to switch to the Vim emulator is put into the insert mode with `<Esc>` not working. You
the normal mode. In some dialog windows the normal mode is on by default. The should use `<C-c>` or `<C-[>` instead. In some dialog windows the normal mode is
usage of the Vim emulator in dialog windows is an area for improvements. on by default. The usage of the Vim emulator in dialog windows is an area for
improvements.
See also [unresolved escape issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc). See also [unresolved escape issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
@@ -122,6 +174,10 @@ Ex commands or via `:map` command mappings:
* `:action {name}` * `:action {name}`
* Execute an action named `NAME` * Execute an action named `NAME`
For example, here `\r` is mapped to the Reformat Code action:
:map \r :action ReformatCode<CR>
Contributing Contributing
------------ ------------
@@ -144,34 +200,39 @@ in the issue tracker.
1. Fork IdeaVim on GitHub and clone the repository on your local machine. 1. Fork IdeaVim on GitHub and clone the repository on your local machine.
2. Open the project in IntelliJ IDEA 13.1+ (Community or Ultimate) using "File | 2. Import the project from existing sources in IntelliJ IDEA 2018.1 or newer (Community or
Open... | /path/to/ideavim". Ultimate) using "File | New | Project from Existing Sources..." or "Import
Project" from the start window.
3. Set up a JDK if you haven't got it yet. Use "File | Project Structure | SDKs * In the project wizard select "Import project from external model | Gradle"
| Add new JDK".
4. Set up an IntelliJ plugin SDK using "File | Project Structure | SDKs | Add * Select your Java 8+ JDK as the Gradle JVM, leave other parameters unchanged
new IntelliJ IDEA Plugin SDK". The correct path to your current installation
of IntelliJ will be suggested automatically. You will be prompted to select a
JDK for your plugin SDK. Select the JDK from the previous step. You
**should** name your plugin SDK `IntelliJ Plugin SDK` in order to match the
name in the project settings stored in the Git repository.
5. Select a project SDK for your project using "File | Project Structure | 3. Run your IdeaVim plugin within IntelliJ via a Gradle task
Project | Project SDK". Choose the plugin SDK you have created at the
previous step.
6. Build IdeaVim and run IntelliJ with IdeaVim enabled using the "IdeaVim" run * Select "View | Tool Windows | Gradle" tool window
configuration (use "Run | Run... | IdeaVim").
* Launch "ideavim | intellij | runIde" from the tool window
7. In order to be able to run tests in your IntelliJ edition uncomment the 4. Run IdeaVim tests via a Gradle task
appropriate lines in the constructor of the `VimTestCase` class.
* Select "View | Tool Windows | Gradle" tool window
* Launch "ideavim | verification | test" from the tool window
5. Build the plugin distribution by running `./gradlew clean buildPlugin` in the
terminal in your project root.
* The resulting distribution file is build/distributions/IdeaVim-VERSION.zip
* You can install this file using "Settings | Plugins | Install plugin
from disk"
Authors Authors
------- -------
See [AUTHORS.md](https://github.com/JetBrains/ideavim/blob/master/AUTHORS.md) See [AUTHORS.md](AUTHORS.md)
for a list of authors and contributors. for a list of authors and contributors.
@@ -179,4 +240,3 @@ License
------- -------
IdeaVim is licensed under the terms of the GNU Public license version 2. IdeaVim is licensed under the terms of the GNU Public license version 2.

54
build.gradle Normal file
View File

@@ -0,0 +1,54 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id 'org.jetbrains.intellij' version '0.3.12'
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
sourceSets {
main {
java.srcDir 'src'
resources.srcDir 'resources'
}
test {
java.srcDir 'test'
}
}
intellij {
version ideaVersion
pluginName 'IdeaVim'
updateSinceUntilBuild false
downloadSources Boolean.valueOf(downloadIdeaSources)
instrumentCode Boolean.valueOf(instrumentPluginCode)
intellijRepo = "https://www.jetbrains.com/intellij-repository"
publishPlugin {
channels publishChannels.split(',')
username publishUsername
password publishPassword
}
}
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}

View File

@@ -1,4 +0,0 @@
version-id:0.39
platform-version:135.0
idea.download.url=http://download.jetbrains.com/idea/ideaIU-14.0.1.zip
build.number=dev

180
build.xml
View File

@@ -1,180 +0,0 @@
<project name="IdeaVim">
<!--
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
* Copyright (C) 2003-2009 Rick Maddy, Oleg Shpynov
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-->
<property file="build.properties"/>
<property name="idea" value="${basedir}/idea"/>
<property name="src" value="${basedir}/src"/>
<property name="resources" value="${basedir}/resources"/>
<property name="test" value="${basedir}/test"/>
<property name="idea.home" value="${idea}/unzip"/>
<property environment="env"/>
<property name="tools.jar" value="${env.JAVA_HOME}/lib/tools.jar"/>
<property name="version" value="${version-id}"/>
<property name="filename" value="ideavim-${version}"/>
<!--Output-->
<property name="out" value="${basedir}/out"/>
<property name="classes" value="${out}/classes"/>
<property name="build" value="${out}/build"/>
<property name="dist" value="${out}/dist"/>
<property name="test-reports" value="${out}/test-reports"/>
<path id="build.classpath">
<fileset dir="${idea.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${java.home}/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${classes}"/>
</path>
<path id="test.classpath">
<path refid="build.classpath"/>
<pathelement path="${tools.jar}"/>
</path>
<!-- Clean all the generated stuff -->
<target name="clean" description="Removes all generated files">
<delete dir="${out}"/>
</target>
<!-- Compile all the sources to the ${classes} folder -->
<target name="compile">
<mkdir dir="${classes}"/>
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath refid="build.classpath"/>
</taskdef>
<!-- The task requires the following libraries from IntelliJ IDEA distribution: -->
<!-- javac2.jar; jdom.jar; asm.jar; asm-commons.jar -->
<javac2 destdir="${classes}" debug="on" fork="true" encoding="UTF-8" includeantruntime="false">
<classpath refid="build.classpath"/>
<src path="${src}"/>
<include name="com/maddyhome/idea/**"/>
</javac2>
</target>
<!-- Create ideavim.jar for packing inside zip plugin package -->
<target name="jar">
<mkdir dir="${classes}"/>
<mkdir dir="${classes}/META-INF"/>
<copy file="resources/META-INF/plugin.xml" todir="${classes}/META-INF">
<filterset>
<filter token="VERSION" value="${version}"/>
<filter token="SINCE-VERSION" value="${platform-version}"/>
<filter token="BUILD-NUMBER" value="${build.number}"/>
</filterset>
</copy>
<copy todir="${classes}">
<fileset dir="${src}" excludes="**/*.java"/>
</copy>
<copy todir="${classes}">
<fileset dir="${resources}"/>
</copy>
<mkdir dir="${build}"/>
<jar basedir="${classes}" jarfile="${build}/IdeaVim.jar" compress="yes"/>
</target>
<target name="build" depends="unzip, clean, compile, jar" description="Compiles all source code and created plugin jar file"/>
<!-- Download IntelliJ IDEA distribution -->
<target name="download" description="Downloads IntelliJ IDEA artifacts">
<mkdir dir="${idea}"/>
<get src="${idea.download.url}" dest="${idea}" skipexisting="true"/>
</target>
<!-- Unpack idea-*.zip file for ideavim compilation -->
<target name="unzip" depends="download" description="Unzip downloaded artifacts and set up idea.home">
<delete dir="${idea}/unzip"/>
<mkdir dir="${idea}/unzip"/>
<basename property="idea.filename" file="${idea.download.url}"/>
<unzip dest="${idea}/unzip">
<fileset dir="${idea}" includes="${idea.filename}"/>
</unzip>
</target>
<target name="dist" depends="dist-src, dist-bin" description="Creates the src and bin distribution files"/>
<!-- Prepare layout for plugin distribution and creates zip file which can be published -->
<target name="dist-bin" depends="clean, build" description="Creates a zip file containing the plugin sources">
<delete dir="${build}/IdeaVim"/>
<mkdir dir="${build}/IdeaVim"/>
<copy file="${basedir}/LICENSE.txt" tofile="${build}/IdeaVim/LICENSE"/>
<copy todir="${build}/IdeaVim/lib">
<fileset dir="${build}" includes="*.jar"/>
</copy>
<copy file="${basedir}/README.md" tofile="${build}/IdeaVim/README"/>
<copy file="${basedir}/CHANGES.md" tofile="${build}/IdeaVim/CHANGES"/>
<zip basedir="${build}" zipfile="${dist}/${filename}-${build.number}.zip" compress="true" includes="IdeaVim/**"/>
</target>
<!-- Packs all the sources -->
<target name="dist-src" depends="clean" description="Creates the source tar file">
<mkdir dir="${dist}"/>
<tar basedir="." destfile="${dist}/${filename}-src.tar.gz" excludes=".git/**,.idea/**,idea/**,out/**,*.iws,*.iml" compression="gzip"/>
</target>
<target name="compile-tests" depends="compile">
<mkdir dir="${classes}"/>
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath refid="build.classpath"/>
</taskdef>
<javac2 destdir="${classes}" debug="on" fork="true" encoding="UTF-8" includeantruntime="false">
<classpath refid="build.classpath"/>
<src path="${test}"/>
<include name="org/jetbrains/plugins/ideavim/**"/>
</javac2>
</target>
<target name="prepare-tests" depends="compile-tests">
<mkdir dir="${classes}/META-INF"/>
<copy file="resources/META-INF/plugin.xml" todir="${classes}/META-INF">
<filterset>
<filter token="VERSION" value="${version}"/>
<filter token="SINCE-VERSION" value="${platform-version}"/>
</filterset>
</copy>
<copy todir="${classes}">
<fileset dir="${resources}"/>
</copy>
<mkdir dir="${out}/IdeaVim"/>
</target>
<target name="test" depends="unzip, clean, prepare-tests">
<mkdir dir="${test-reports}"/>
<junit fork="true" logfailedtests="false" printsummary="true">
<classpath refid="test.classpath"/>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg value="-Didea.plugins.path=${out}"/>
<jvmarg value="-Didea.load.plugins.id=IdeaVIM"/>
<formatter type="plain"/>
<batchtest todir="${test-reports}">
<fileset dir="${test}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>

View File

@@ -9,6 +9,8 @@ The following `:set` commands can appear in `~/.ideavimrc` or set manually in th
'history' 'hi' number of command-lines that are remembered 'history' 'hi' number of command-lines that are remembered
'hlsearch' 'hls' highlight matches with last search pattern 'hlsearch' 'hls' highlight matches with last search pattern
'ignorecase' 'ic' ignore case in search patterns 'ignorecase' 'ic' ignore case in search patterns
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
'incsearch' 'is' show where search pattern typed so far matches
'matchpairs' 'mps' pairs of characters that "%" can match 'matchpairs' 'mps' pairs of characters that "%" can match
'nrformats' 'nf' number formats recognized for CTRL-A command 'nrformats' 'nf' number formats recognized for CTRL-A command
'number' 'nu' print the line number in front of each line 'number' 'nu' print the line number in front of each line
@@ -22,7 +24,9 @@ The following `:set` commands can appear in `~/.ideavimrc` or set manually in th
'sidescroll' 'ss' minimum number of columns to scroll horizontal 'sidescroll' 'ss' minimum number of columns to scroll horizontal
'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor 'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor
'smartcase' 'scs' no ignore case when pattern has uppercase 'smartcase' 'scs' no ignore case when pattern has uppercase
'timeout' 'to' use timeout for mapped key sequences
'timeoutlen' 'tm' time that is waited for a mapped key sequence 'timeoutlen' 'tm' time that is waited for a mapped key sequence
'undolevels' 'ul' maximum number of changes that can be undone 'undolevels' 'ul' maximum number of changes that can be undone
'viminfo' 'vi' information to remember after restart
'visualbell' 'vb' use visual bell instead of beeping 'visualbell' 'vb' use visual bell instead of beeping
'wrapscan' 'ws' searches wrap around the end of the file 'wrapscan' 'ws' searches wrap around the end of the file

9
gradle.properties Normal file
View File

@@ -0,0 +1,9 @@
ideaVersion IC-2018.3
downloadIdeaSources true
instrumentPluginCode true
version SNAPSHOT
javaVersion 1.8
kotlinVersion 1.3.11
publishUsername username
publishPassword password
publishChannels eap

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Fri Dec 29 11:00:46 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip

172
gradlew vendored Executable file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PLUGIN_MODULE" version="4">
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,58 +1,56 @@
<idea-plugin url="http://plugins.jetbrains.com/plugin/164"> <idea-plugin url="http://plugins.jetbrains.com/plugin/164">
<name>IdeaVim</name> <name>IdeaVim</name>
<id>IdeaVIM</id> <id>IdeaVIM</id>
<change-notes> <change-notes><![CDATA[
<![CDATA[ <p>0.51:</p>
<p>0.39:</p>
<ul> <ul>
<li>Various bug fixes</li> <li>Various bug fixes</li>
</ul> </ul>
<p>0.38:</p> <p>0.50:</p>
<ul> <ul>
<li>Support for <code>:action</code> and <code>:actionlist</code> for executing arbitrary IDE actions</li> <li>Moved "Vim Emulation" settings into "File | Settings | Editor"</li>
<li>Support for <code>number</code> and <code>relativenumber</code> options</li> <li>Support for vim-multiple-cursors commands <code>&lt;A-n&gt;</code>, <code>&lt;A-x&gt;</code>, <code>&lt;A-p&gt;</code>, <code>g&lt;A-n&gt;</code> (put <code>set multiple-cursors</code> into your ~/.ideavimrc to enable it)</li>
<li>Support for <code>clipboard=unnamed</code> option</li> <li>Support for running Vim commands for multiple cursors</li>
<li>The <a href="https://github.com/JetBrains/ideavim/blob/master/src/com/maddyhome/idea/vim/package-info.java">index of supported commands</a> on the GitHub page</li>
<li>Various bug fixes</li> <li>Various bug fixes</li>
</ul> </ul>
<p>0.37:</p> <p>0.49:</p>
<ul>
<li>Enabled zero-latency typing for Vim emulation</li>
<li>Support for <code>iskeyword</code> option</li>
<li>Various bug fixes</li>
</ul>
<p>0.48:</p>
<ul> <ul>
<li>Various bug fixes</li> <li>Various bug fixes</li>
</ul> </ul>
<p>0.36:</p> <p>0.47:</p>
<ul> <ul>
<li>Window commands from the <code>&lt;C-W&gt;</code> family</li>
<li>Support for <code>:split</code>/<code>:vsplit</code> commands</li>
<li>Fixed visual block selection mode</li>
<li>Various bug fixes</li> <li>Various bug fixes</li>
</ul> </ul>
<p>0.35:</p> <p>0.46:</p>
<ul>
<li><code>~/.vimrc</code> is no longer read by default, use <code>~/.ideavimrc</code> instead</li>
<li>Various bug fixes</li>
</ul>
<p>0.34:</p>
<ul> <ul>
<li>Support for <code>incsearch</code> option for showing search results while typing</li>
<li>Support for <code>it</code> and <code>at</code> tag block selection</li>
<li>Support for vim-surround commands <code>ys</code>, <code>cs</code>, <code>ds</code>, <code>S</code>, enable it with <code>set surround</code> in your ~/.ideavimrc</li>
<li>Support for <code>={motion}</code> formatting command</li>
<li>Various bug fixes</li> <li>Various bug fixes</li>
</ul> </ul>
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p> <p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
]]> ]]></change-notes>
</change-notes> <description><![CDATA[
<description>
<![CDATA[
<p>Build @VERSION@-@BUILD-NUMBER@</p>
<p>Vim emulation plug-in for IDEs based on the IntelliJ platform.</p> <p>Vim emulation plug-in for IDEs based on the IntelliJ platform.</p>
<p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing, marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, window commands, etc.</p> <p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing, marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, window commands, etc.</p>
<p>See also:</p> <p>See also:</p>
<ul> <ul>
<li><a href="https://github.com/JetBrains/ideavim">GitHub repository</a> for documentation and contributing</li> <li><a href="https://github.com/JetBrains/ideavim">GitHub repository</a>: documentation and contributing</li>
<li><a href="http://youtrack.jetbrains.com/issues/VIM">Issue tracker</a> for feature requests and bug reports</li> <li><a href="http://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
</ul> </ul>
]]> ]]></description>
</description> <version>SNAPSHOT</version>
<version>@VERSION@</version>
<vendor>JetBrains</vendor> <vendor>JetBrains</vendor>
<idea-version since-build="@SINCE-VERSION@"/> <idea-version since-build="183.2940.10"/>
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform --> <!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
<depends>com.intellij.modules.lang</depends> <depends>com.intellij.modules.lang</depends>
@@ -64,9 +62,17 @@
</component> </component>
</application-components> </application-components>
<extensionPoints>
<extensionPoint qualifiedName="IdeaVIM.vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij"> <extensions defaultExtensionNs="com.intellij">
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/> <applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
<applicationConfigurable instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/> </extensions>
<extensions defaultExtensionNs="IdeaVIM">
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
</extensions> </extensions>
<actions> <actions>
@@ -152,6 +158,7 @@
<action id="VimMotionInnerBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockDoubleQuoteAction" text="Select inner double quote block"/> <action id="VimMotionInnerBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockDoubleQuoteAction" text="Select inner double quote block"/>
<action id="VimMotionInnerBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockSingleQuoteAction" text="Select inner single quote block"/> <action id="VimMotionInnerBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockSingleQuoteAction" text="Select inner single quote block"/>
<action id="VimMotionInnerBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBackQuoteAction" text="Select inner back quote block"/> <action id="VimMotionInnerBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockBackQuoteAction" text="Select inner back quote block"/>
<action id="VimMotionInnerBlockTag" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerBlockTagAction" text="Select inner &gt;&lt; block &gt;/&lt;"/>
<action id="VimMotionOuterBlockAngle" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockAngleAction" text="Select outer &lt; block"/> <action id="VimMotionOuterBlockAngle" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockAngleAction" text="Select outer &lt; block"/>
<action id="VimMotionOuterBlockBrace" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBraceAction" text="Select outer { block"/> <action id="VimMotionOuterBlockBrace" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBraceAction" text="Select outer { block"/>
<action id="VimMotionOuterBlockBracket" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBracketAction" text="Select outer [ block"/> <action id="VimMotionOuterBlockBracket" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBracketAction" text="Select outer [ block"/>
@@ -159,6 +166,7 @@
<action id="VimMotionOuterBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockDoubleQuoteAction" text="Select outer double quote block"/> <action id="VimMotionOuterBlockDoubleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockDoubleQuoteAction" text="Select outer double quote block"/>
<action id="VimMotionOuterBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockSingleQuoteAction" text="Select outer single quote block"/> <action id="VimMotionOuterBlockSingleQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockSingleQuoteAction" text="Select outer single quote block"/>
<action id="VimMotionOuterBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBackQuoteAction" text="Select outer back quote block"/> <action id="VimMotionOuterBlockBackQuote" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockBackQuoteAction" text="Select outer back quote block"/>
<action id="VimMotionOuterBlockTag" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterBlockTagAction" text="Select outer &gt;&lt; block &gt;/&lt;"/>
<action id="VimMotionInnerParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerParagraphAction" text="Select Inner Paragraph"/> <action id="VimMotionInnerParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerParagraphAction" text="Select Inner Paragraph"/>
<action id="VimMotionOuterParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterParagraphAction" text="Select Outer Paragraph"/> <action id="VimMotionOuterParagraph" class="com.maddyhome.idea.vim.action.motion.object.MotionOuterParagraphAction" text="Select Outer Paragraph"/>
<action id="VimMotionInnerSentence" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerSentenceAction" text="Select Inner Sentence"/> <action id="VimMotionInnerSentence" class="com.maddyhome.idea.vim.action.motion.object.MotionInnerSentenceAction" text="Select Inner Sentence"/>
@@ -272,6 +280,7 @@
<!-- Shift --> <!-- Shift -->
<action id="VimAutoIndentLines" class="com.maddyhome.idea.vim.action.change.shift.AutoIndentLinesAction" text="Auto Indent Lines"/> <action id="VimAutoIndentLines" class="com.maddyhome.idea.vim.action.change.shift.AutoIndentLinesAction" text="Auto Indent Lines"/>
<action id="VimAutoIndentMotion" class="com.maddyhome.idea.vim.action.change.shift.AutoIndentMotionAction" text="Auto Indent Lines"/>
<action id="VimShiftLeftLines" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction" text="Shift Lines Left"/> <action id="VimShiftLeftLines" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesAction" text="Shift Lines Left"/>
<action id="VimShiftLeftMotion" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction" text="Shift Motion Left"/> <action id="VimShiftLeftMotion" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftMotionAction" text="Shift Motion Left"/>
<action id="VimShiftLeftVisual" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction" text="Shift Visual Left"/> <action id="VimShiftLeftVisual" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftVisualAction" text="Shift Visual Left"/>
@@ -347,7 +356,11 @@
<action id="VimRedo" class="com.maddyhome.idea.vim.action.change.RedoAction" text="Redo"/> <action id="VimRedo" class="com.maddyhome.idea.vim.action.change.RedoAction" text="Redo"/>
<action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/> <action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/>
<!-- Internal -->
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Vim (internal) add test inlays" internal="true"/>
<!-- Keys --> <!-- Keys -->
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Vim Shortcuts"/> <action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
<action id="VimOperatorAction" class="com.maddyhome.idea.vim.action.change.OperatorAction" text="Operator"/>
</actions> </actions>
</idea-plugin> </idea-plugin>

View File

@@ -48,3 +48,4 @@ E385=E385: search hit BOTTOM without match for: {0}
e_patnotf2=Pattern not found: {0} e_patnotf2=Pattern not found: {0}
unkopt=Unknown option: {0} unkopt=Unknown option: {0}
e_invarg=Invalid argument: {0} e_invarg=Invalid argument: {0}
E774=E774: 'operatorfunc' is empty

View File

@@ -1,3 +1,21 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim; package com.maddyhome.idea.vim;
import com.intellij.openapi.Disposable; import com.intellij.openapi.Disposable;
@@ -42,13 +60,13 @@ public class EventFacade {
public void setupTypedActionHandler(@NotNull TypedActionHandler handler) { public void setupTypedActionHandler(@NotNull TypedActionHandler handler) {
final TypedAction typedAction = getTypedAction(); final TypedAction typedAction = getTypedAction();
myOriginalTypedActionHandler = typedAction.getHandler(); myOriginalTypedActionHandler = typedAction.getRawHandler();
typedAction.setupHandler(handler); typedAction.setupRawHandler(handler);
} }
public void restoreTypedActionHandler() { public void restoreTypedActionHandler() {
if (myOriginalTypedActionHandler != null) { if (myOriginalTypedActionHandler != null) {
getTypedAction().setupHandler(myOriginalTypedActionHandler); getTypedAction().setupRawHandler(myOriginalTypedActionHandler);
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -24,8 +24,10 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.Application; import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler; import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
@@ -33,16 +35,18 @@ import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState; import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.extension.VimExtensionHandler;
import com.maddyhome.idea.vim.group.RegisterGroup; import com.maddyhome.idea.vim.group.RegisterGroup;
import com.maddyhome.idea.vim.helper.*; import com.maddyhome.idea.vim.helper.DigraphSequence;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.helper.RunnableHelper;
import com.maddyhome.idea.vim.helper.StringHelper;
import com.maddyhome.idea.vim.key.*; import com.maddyhome.idea.vim.key.*;
import com.maddyhome.idea.vim.option.Options; import com.maddyhome.idea.vim.option.Options;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -91,6 +95,26 @@ public class KeyHandler {
return origHandler; return origHandler;
} }
/**
* Invoked before acquiring a write lock and actually handling the keystroke.
*
* Drafts an optional {@link ActionPlan} that will be used as a base for zero-latency rendering in editor.
*
* @param editor The editor the key was typed into
* @param key The keystroke typed by the user
* @param context The data context
* @param plan The current action plan
*/
public void beforeHandleKey(@NotNull Editor editor, @NotNull KeyStroke key,
@NotNull DataContext context, @NotNull ActionPlan plan) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
if (mode == CommandState.Mode.INSERT || mode == CommandState.Mode.REPLACE) {
VimPlugin.getChange().beforeProcessKey(editor, context, key, plan);
}
}
/** /**
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for * This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
* processing. * processing.
@@ -111,29 +135,29 @@ public class KeyHandler {
editor = InjectedLanguageUtil.getTopLevelEditor(editor); editor = InjectedLanguageUtil.getTopLevelEditor(editor);
final CommandState editorState = CommandState.getInstance(editor); final CommandState editorState = CommandState.getInstance(editor);
if (allowKeyMappings && handleKeyMapping(editor, key, context)) {
return;
}
final boolean isRecording = editorState.isRecording();
boolean shouldRecord = true;
// If this is a "regular" character keystroke, get the character // If this is a "regular" character keystroke, get the character
char chKey = key.getKeyChar() == KeyEvent.CHAR_UNDEFINED ? 0 : key.getKeyChar(); char chKey = key.getKeyChar() == KeyEvent.CHAR_UNDEFINED ? 0 : key.getKeyChar();
if (isEditorReset(key, editorState)) { final boolean isRecording = editorState.isRecording();
handleEditorReset(editor, key, context); boolean shouldRecord = true;
}
// At this point the user must be typing in a command. Most commands can be preceded by a number. Let's // Check for command count before key mappings - otherwise e.g. ':map 0 ^' breaks command counts that contain a zero
// check if a number can be entered at this point, and if so, did the user send us a digit. if (isCommandCount(editorState, chKey)) {
else if (isCommandCount(editorState, chKey)) {
// Update the count // Update the count
count = count * 10 + (chKey - '0'); count = count * 10 + (chKey - '0');
} }
else if (allowKeyMappings && handleKeyMapping(editor, key, context)) {
return;
}
// Pressing delete while entering a count "removes" the last digit entered // Pressing delete while entering a count "removes" the last digit entered
// Unlike the digits, this must be checked *after* checking for key mappings
else if (isDeleteCommandCount(key, editorState)) { else if (isDeleteCommandCount(key, editorState)) {
// "Remove" the last digit sent to us // "Remove" the last digit sent to us
count /= 10; count /= 10;
} }
else if (isEditorReset(key, editorState)) {
handleEditorReset(editor, key, context);
}
// If we got this far the user is entering a command or supplying an argument to an entered command. // If we got this far the user is entering a command or supplying an argument to an entered command.
// First let's check to see if we are at the point of expecting a single character argument to a command. // First let's check to see if we are at the point of expecting a single character argument to a command.
else if (currentArg == Argument.Type.CHARACTER) { else if (currentArg == Argument.Type.CHARACTER) {
@@ -216,7 +240,7 @@ public class KeyHandler {
} }
} }
private boolean handleKeyMapping(@NotNull final Editor editor, @NotNull KeyStroke key, private boolean handleKeyMapping(@NotNull final Editor editor, @NotNull final KeyStroke key,
@NotNull final DataContext context) { @NotNull final DataContext context) {
final CommandState commandState = CommandState.getInstance(editor); final CommandState commandState = CommandState.getInstance(editor);
commandState.stopMappingTimer(); commandState.stopMappingTimer();
@@ -231,33 +255,56 @@ public class KeyHandler {
} }
final KeyMapping mapping = VimPlugin.getKey().getKeyMapping(mappingMode); final KeyMapping mapping = VimPlugin.getKey().getKeyMapping(mappingMode);
final MappingInfo mappingInfo = mapping.get(fromKeys); final MappingInfo currentMappingInfo = mapping.get(fromKeys);
final MappingInfo prevMappingInfo = mapping.get(mappingKeys);
final MappingInfo mappingInfo = currentMappingInfo != null ? currentMappingInfo : prevMappingInfo;
final Application application = ApplicationManager.getApplication();
if (mapping.isPrefix(fromKeys)) { if (mapping.isPrefix(fromKeys)) {
mappingKeys.add(key); mappingKeys.add(key);
commandState.startMappingTimer(new ActionListener() { if (!application.isUnitTestMode() && Options.getInstance().isSet(Options.TIMEOUT)) {
@Override commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
public void actionPerformed(ActionEvent actionEvent) {
mappingKeys.clear(); mappingKeys.clear();
if (editor.isDisposed()) {
return;
}
for (KeyStroke keyStroke : fromKeys) { for (KeyStroke keyStroke : fromKeys) {
handleKey(editor, keyStroke, new EditorDataContext(editor), false); handleKey(editor, keyStroke, new EditorDataContext(editor), false);
} }
} }, ModalityState.stateForComponent(editor.getComponent())));
}); }
return true; return true;
} }
else if (mappingInfo != null) { else if (mappingInfo != null) {
mappingKeys.clear(); mappingKeys.clear();
final Application application = ApplicationManager.getApplication();
final Runnable handleMappedKeys = new Runnable() { final Runnable handleMappedKeys = new Runnable() {
@Override @Override
public void run() { public void run() {
final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), mappingInfo.getToKeys()); if (editor.isDisposed()) {
boolean first = true; return;
for (KeyStroke keyStroke : mappingInfo.getToKeys()) { }
final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix); final List<KeyStroke> toKeys = mappingInfo.getToKeys();
handleKey(editor, keyStroke, new EditorDataContext(editor), recursive); final VimExtensionHandler extensionHandler = mappingInfo.getExtensionHandler();
first = false; final EditorDataContext currentContext = new EditorDataContext(editor);
if (toKeys != null) {
final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), toKeys);
boolean first = true;
for (KeyStroke keyStroke : toKeys) {
final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix);
handleKey(editor, keyStroke, currentContext, recursive);
first = false;
}
}
else if (extensionHandler != null) {
final CommandProcessor processor = CommandProcessor.getInstance();
processor.executeCommand(editor.getProject(),
() -> extensionHandler.execute(editor, context),
"Vim " + extensionHandler.getClass().getSimpleName(),
null);
}
if (prevMappingInfo != null) {
handleKey(editor, key, currentContext);
} }
} }
}; };
@@ -324,9 +371,7 @@ public class KeyHandler {
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) { private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
return (editorState.getMode() == CommandState.Mode.COMMAND || state == State.COMMAND) && return (editorState.getMode() == CommandState.Mode.COMMAND || state == State.COMMAND) &&
(key.getKeyCode() == KeyEvent.VK_ESCAPE || StringHelper.isCloseKeyStroke(key);
(key.getKeyCode() == KeyEvent.VK_C && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0) ||
(key.getKeyCode() == '[' && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0));
} }
private void handleCharArgument(@NotNull KeyStroke key, char chKey) { private void handleCharArgument(@NotNull KeyStroke key, char chKey) {
@@ -424,23 +469,25 @@ public class KeyHandler {
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0); lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
Project project = editor.getProject(); Project project = editor.getProject();
if (cmd.getType().isRead() || project == null || EditorHelper.canEdit(project, editor)) { final Command.Type type = cmd.getType();
if (ApplicationManager.getApplication().isDispatchThread()) { if (type.isWrite() && !editor.getDocument().isWritable()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
String name = cmd.getAction().getTemplatePresentation().getText();
name = name != null ? "Vim " + name : "";
if (cmd.getType().isWrite()) {
RunnableHelper.runWriteCommand(project, action, name, action);
}
else {
RunnableHelper.runReadCommand(project, action, name, action);
}
}
}
else {
VimPlugin.indicateError(); VimPlugin.indicateError();
reset(editor); reset(editor);
} }
if (ApplicationManager.getApplication().isDispatchThread()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
String name = cmd.getAction().getTemplatePresentation().getText();
name = name != null ? "Vim " + name : "";
if (type.isWrite()) {
RunnableHelper.runWriteCommand(project, action, name, action);
}
else if (type.isRead()) {
RunnableHelper.runReadCommand(project, action, name, action);
}
else {
CommandProcessor.getInstance().executeCommand(project, action, name, action);
}
}
} }
private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context, private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -73,12 +73,12 @@ public class RegisterActions {
new KeyStroke[]{KeyStroke.getKeyStroke('g'), new KeyStroke[]{KeyStroke.getKeyStroke('g'),
KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK)}) KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK)})
); );
// TODO - add zC
// TODO - add zO
parser.registerAction(MappingMode.NV, "CollapseAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zM")); parser.registerAction(MappingMode.NV, "CollapseAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zM"));
parser.registerAction(MappingMode.NV, "CollapseRegion", Command.Type.OTHER_READONLY, new Shortcut("zc")); parser.registerAction(MappingMode.NV, "CollapseRegion", Command.Type.OTHER_READONLY, new Shortcut("zc"));
parser.registerAction(MappingMode.NV, "CollapseRegionRecursively", Command.Type.OTHER_READONLY, new Shortcut("zC"));
parser.registerAction(MappingMode.NV, "ExpandAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zR")); parser.registerAction(MappingMode.NV, "ExpandAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zR"));
parser.registerAction(MappingMode.NV, "ExpandRegion", Command.Type.OTHER_READONLY, new Shortcut("zo")); parser.registerAction(MappingMode.NV, "ExpandRegion", Command.Type.OTHER_READONLY, new Shortcut("zo"));
parser.registerAction(MappingMode.NV, "ExpandRegionRecursively", Command.Type.OTHER_READONLY, new Shortcut("zO"));
parser.registerAction(MappingMode.NV, "VimToggleRecording", parser.registerAction(MappingMode.NV, "VimToggleRecording",
Command.Type.OTHER_READONLY, Command.Type.OTHER_READONLY,
Command.FLAG_NO_ARG_RECORDING, Command.FLAG_NO_ARG_RECORDING,
@@ -147,6 +147,10 @@ public class RegisterActions {
new Shortcut("a<"), new Shortcut("a<"),
new Shortcut("a>") new Shortcut("a>")
}); });
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockTag", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("it")}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBrace", Command.Type.MOTION, parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBrace", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("aB"), new Shortcut("a{"), new Shortcut("a}")} new Shortcut[]{new Shortcut("aB"), new Shortcut("a{"), new Shortcut("a}")}
@@ -171,6 +175,10 @@ public class RegisterActions {
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut[]{ Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut[]{
new Shortcut("a`"), new Shortcut("a`"),
}); });
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockTag", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("at")}
);
parser.registerAction(MappingMode.NO, "VimResetMode", Command.Type.RESET, new Shortcut(new KeyStroke[]{ parser.registerAction(MappingMode.NO, "VimResetMode", Command.Type.RESET, new Shortcut(new KeyStroke[]{
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, KeyEvent.CTRL_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, KeyEvent.CTRL_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK) KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)
@@ -507,10 +515,10 @@ public class RegisterActions {
new Shortcut("gp")); new Shortcut("gp"));
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{ parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
new Shortcut("[P"), new Shortcut("[P"),
new Shortcut("]P") new Shortcut("]P"),
new Shortcut("[p")
}); });
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{ parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
new Shortcut("[p"),
new Shortcut("]p") new Shortcut("]p")
}); });
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY, parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY,
@@ -606,9 +614,9 @@ public class RegisterActions {
new Shortcut("@:")); new Shortcut("@:"));
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY, parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY,
new Shortcut('K')); new Shortcut('K'));
parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_WRITABLE, parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_SELF_SYNCHRONIZED,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK))); new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_WRITABLE, new Shortcut[]{ parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_SELF_SYNCHRONIZED, new Shortcut[]{
new Shortcut('u'), new Shortcut('u'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0)) new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
}); });
@@ -624,10 +632,10 @@ public class RegisterActions {
}); });
// Shift Actions // Shift Actions
// TODO - add =
// TODO - == will ignore count and only auto-indent 1 lines
parser.registerAction(MappingMode.N, "VimAutoIndentLines", Command.Type.CHANGE, parser.registerAction(MappingMode.N, "VimAutoIndentLines", Command.Type.CHANGE,
new Shortcut("==")); new Shortcut("=="));
parser.registerAction(MappingMode.N, "VimAutoIndentMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut('='), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimShiftLeftLines", Command.Type.CHANGE, parser.registerAction(MappingMode.N, "VimShiftLeftLines", Command.Type.CHANGE,
new Shortcut("<<")); new Shortcut("<<"));
parser.registerAction(MappingMode.N, "VimShiftLeftMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND, parser.registerAction(MappingMode.N, "VimShiftLeftMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -17,10 +17,13 @@
*/ */
package com.maddyhome.idea.vim; package com.maddyhome.idea.vim;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.*; import com.intellij.notification.*;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.components.ApplicationComponent; import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State; import com.intellij.openapi.components.State;
@@ -28,6 +31,8 @@ import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.actionSystem.TypedAction; import com.intellij.openapi.editor.actionSystem.TypedAction;
import com.intellij.openapi.editor.event.EditorFactoryAdapter;
import com.intellij.openapi.editor.event.EditorFactoryEvent;
import com.intellij.openapi.extensions.PluginId; import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.keymap.Keymap; import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.keymap.ex.KeymapManagerEx; import com.intellij.openapi.keymap.ex.KeymapManagerEx;
@@ -37,23 +42,31 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter; import com.intellij.openapi.project.ProjectManagerAdapter;
import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager; import com.intellij.openapi.wm.WindowManager;
import com.intellij.util.io.HttpRequests;
import com.maddyhome.idea.vim.ex.CommandParser; import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.VimScriptParser; import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser;
import com.maddyhome.idea.vim.group.*; import com.maddyhome.idea.vim.group.*;
import com.maddyhome.idea.vim.helper.DocumentManager; import com.maddyhome.idea.vim.helper.DocumentManager;
import com.maddyhome.idea.vim.helper.MacKeyRepeat; import com.maddyhome.idea.vim.helper.MacKeyRepeat;
import com.maddyhome.idea.vim.option.Options; import com.maddyhome.idea.vim.option.Options;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable; import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import org.jdom.Element; import org.jdom.Element;
import org.jdom.JDOMException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkEvent;
import java.awt.*; import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.concurrent.TimeUnit;
/** /**
* This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied * This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied
@@ -67,12 +80,11 @@ import java.io.File;
*/ */
@State( @State(
name = "VimSettings", name = "VimSettings",
storages = {@Storage( storages = {@Storage(file = "$APP_CONFIG$/vim_settings.xml")})
id = "main",
file = "$APP_CONFIG$/vim_settings.xml")})
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> { public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin"; private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM"; private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
private static final String IDEAVIM_STATISTICS_TIMESTAMP_KEY = "ideavim.statistics.timestamp";
public static final String IDEAVIM_NOTIFICATION_ID = "ideavim"; public static final String IDEAVIM_NOTIFICATION_ID = "ideavim";
public static final String IDEAVIM_STICKY_NOTIFICATION_ID = "ideavim-sticky"; public static final String IDEAVIM_STICKY_NOTIFICATION_ID = "ideavim-sticky";
public static final String IDEAVIM_NOTIFICATION_TITLE = "IdeaVim"; public static final String IDEAVIM_NOTIFICATION_TITLE = "IdeaVim";
@@ -141,7 +153,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
}); });
final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction(); final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getHandler())); EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getRawHandler()));
// Register vim actions in command mode // Register vim actions in command mode
RegisterActions.registerActions(); RegisterActions.registerActions();
@@ -290,6 +302,17 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
return PluginId.getId(IDEAVIM_PLUGIN_ID); return PluginId.getId(IDEAVIM_PLUGIN_ID);
} }
@NotNull
public static String getVersion() {
if (!ApplicationManager.getApplication().isInternal()) {
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
}
else {
return "INTERNAL";
}
}
public static boolean isEnabled() { public static boolean isEnabled() {
return getInstance().enabled; return getInstance().enabled;
} }
@@ -369,20 +392,17 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
private void updateState() { private void updateState() {
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) { if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
boolean requiresRestart = false;
if (SystemInfo.isMac) { if (SystemInfo.isMac) {
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance(); final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
final Boolean enabled = keyRepeat.isEnabled(); final Boolean enabled = keyRepeat.isEnabled();
final Boolean isKeyRepeat = editor.isKeyRepeat(); final Boolean isKeyRepeat = editor.isKeyRepeat();
if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) { if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) {
if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold " + if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold?\n\n" +
"(requires restart)?\n\n" +
"(You can do it manually by running 'defaults write -g " + "(You can do it manually by running 'defaults write -g " +
"ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE, "ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE,
Messages.getQuestionIcon()) == Messages.YES) { Messages.getQuestionIcon()) == Messages.YES) {
editor.setKeyRepeat(true); editor.setKeyRepeat(true);
keyRepeat.setEnabled(true); keyRepeat.setEnabled(true);
requiresRestart = true;
} }
else { else {
editor.setKeyRepeat(false); editor.setKeyRepeat(false);
@@ -428,10 +448,6 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
"<code>source ~/.vimrc</code>", "<code>source ~/.vimrc</code>",
NotificationType.INFORMATION).notify(null); NotificationType.INFORMATION).notify(null);
} }
if (requiresRestart) {
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
app.restart();
}
} }
} }
@@ -441,6 +457,8 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
private void setupListeners() { private void setupListeners() {
final EventFacade eventFacade = EventFacade.getInstance(); final EventFacade eventFacade = EventFacade.getInstance();
setupStatisticsReporter(eventFacade);
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater()); DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener()); DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
@@ -453,4 +471,63 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
} }
}); });
} }
/**
* Reports statistics about installed IdeaVim and enabled Vim emulation.
*
* See https://github.com/go-lang-plugin-org/go-lang-idea-plugin/commit/5182ab4a1d01ad37f6786268a2fe5e908575a217
*/
private void setupStatisticsReporter(@NotNull EventFacade eventFacade) {
final Application application = ApplicationManager.getApplication();
eventFacade.addEditorFactoryListener(new EditorFactoryAdapter() {
@Override
public void editorCreated(@NotNull EditorFactoryEvent event) {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
final long lastUpdate = propertiesComponent.getOrInitLong(IDEAVIM_STATISTICS_TIMESTAMP_KEY, 0);
final boolean outOfDate = lastUpdate == 0 ||
System.currentTimeMillis() - lastUpdate > TimeUnit.DAYS.toMillis(1);
if (outOfDate && isEnabled()) {
application.executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
final String buildNumber = ApplicationInfo.getInstance().getBuild().asString();
final String pluginId = IDEAVIM_PLUGIN_ID;
final String version = URLEncoder.encode(getVersion(), CharsetToolkit.UTF8);
final String os = URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION,
CharsetToolkit.UTF8);
final String uid = UpdateChecker.getInstallationUID(PropertiesComponent.getInstance());
final String url =
"https://plugins.jetbrains.com/plugins/list" +
"?pluginId=" + pluginId +
"&build=" + buildNumber +
"&pluginVersion=" + version +
"&os=" + os +
"&uuid=" + uid;
PropertiesComponent.getInstance().setValue(IDEAVIM_STATISTICS_TIMESTAMP_KEY,
String.valueOf(System.currentTimeMillis()));
HttpRequests.request(url).connect(new HttpRequests.RequestProcessor<Object>() {
@Override
public Object process(@NotNull HttpRequests.Request request) throws IOException {
LOG.info("Sending statistics: " + url);
try {
JDOMUtil.load(request.getInputStream());
}
catch (JDOMException e) {
LOG.warn(e);
}
return null;
}
}
);
}
catch (IOException e) {
LOG.warn(e);
}
}
});
}
}
}, application);
}
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,11 @@ import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupManager; import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler; import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@@ -33,7 +36,7 @@ import javax.swing.*;
* *
* IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}. * IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}.
*/ */
public class VimTypedActionHandler implements TypedActionHandler { public class VimTypedActionHandler implements TypedActionHandlerEx {
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName()); private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
private final TypedActionHandler origHandler; private final TypedActionHandler origHandler;
@@ -45,21 +48,28 @@ public class VimTypedActionHandler implements TypedActionHandler {
handler.setOriginalHandler(origHandler); handler.setOriginalHandler(origHandler);
} }
@Override
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
if (isEnabled(editor)) {
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
}
else {
TypedActionHandler originalHandler = KeyHandler.getInstance().getOriginalHandler();
if (originalHandler instanceof TypedActionHandlerEx) {
((TypedActionHandlerEx)originalHandler).beforeExecute(editor, charTyped, context, plan);
}
}
}
@Override @Override
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) { public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
if (isEnabled(editor)) { if (isEnabled(editor)) {
// Run key handler outside of the key typed command for creating our own undoable commands try {
SwingUtilities.invokeLater(new Runnable() { handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
@Override }
public void run() { catch (Throwable e) {
try { logger.error(e);
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), context); }
}
catch (Throwable e) {
logger.error(e);
}
}
});
} }
else { else {
origHandler.execute(editor, charTyped, context); origHandler.execute(editor, charTyped, context);

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* *
*/ */
// TODO: Cannot find the corresponding Vim command. Remove it?
public class ResetModeAction extends EditorAction { public class ResetModeAction extends EditorAction {
public ResetModeAction() { public ResetModeAction() {
super(new EditorActionHandler() { super(new EditorActionHandler() {

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@ public abstract class VimCommandAction extends EditorAction {
* *
* These legacy flags will be refactored in future releases. * These legacy flags will be refactored in future releases.
* *
* @see {@link Command}. * @see com.maddyhome.idea.vim.command.Command
*/ */
public int getFlags() { public int getFlags() {
return 0; return 0;

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,10 @@ import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType; import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.DumbAware;
@@ -34,8 +37,10 @@ import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction; import com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction;
import com.maddyhome.idea.vim.command.CommandState; import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.helper.EditorData; import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.key.ShortcutOwner; import com.maddyhome.idea.vim.key.ShortcutOwner;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable; import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -83,6 +88,9 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
.addAll(getKeyStrokes(VK_DOWN, 0)) .addAll(getKeyStrokes(VK_DOWN, 0))
.build(); .build();
private static final Logger ourLogger = Logger.getInstance(VimShortcutKeyAction.class.getName());
private static AnAction ourInstance = null;
@Override @Override
public void actionPerformed(@NotNull AnActionEvent e) { public void actionPerformed(@NotNull AnActionEvent e) {
final Editor editor = getEditor(e); final Editor editor = getEditor(e);
@@ -93,7 +101,12 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
notifyAboutShortcutConflict(keyStroke); notifyAboutShortcutConflict(keyStroke);
} }
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler? // Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
KeyHandler.getInstance().handleKey(editor, keyStroke, e.getDataContext()); try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
} }
} }
@@ -104,7 +117,11 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
@NotNull @NotNull
public static AnAction getInstance() { public static AnAction getInstance() {
return ActionManager.getInstance().getAction(ACTION_ID); if (ourInstance == null) {
final AnAction originalAction = ActionManager.getInstance().getAction(ACTION_ID);
ourInstance = EmptyAction.wrap(originalAction);
}
return ourInstance;
} }
private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) { private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) {
@@ -144,6 +161,9 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
if (LookupManager.getActiveLookup(editor) != null) { if (LookupManager.getActiveLookup(editor) != null) {
return isExitInsertMode(keyStroke); return isExitInsertMode(keyStroke);
} }
if (keyCode == VK_ESCAPE) {
return isEnabledForEscape(editor);
}
if (CommandState.inInsertMode(editor)) { if (CommandState.inInsertMode(editor)) {
// XXX: <Tab> won't be recorded in macros // XXX: <Tab> won't be recorded in macros
if (keyCode == VK_TAB) { if (keyCode == VK_TAB) {
@@ -176,6 +196,22 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
return false; return false;
} }
private boolean isEnabledForEscape(@NotNull Editor editor) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
return isPrimaryEditor(editor) || (EditorData.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
}
/**
* Checks if the editor is a primary editor in the main editing area.
*/
private boolean isPrimaryEditor(@NotNull Editor editor) {
final Project project = editor.getProject();
if (project == null) return false;
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
return StreamEx.of(fileEditorManager.getAllEditors())
.anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor)));
}
private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) { private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) {
for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) { for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) {
// XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux // XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux

View File

@@ -0,0 +1,99 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.*;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.MotionGroup;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.helper.MessageHelper;
import com.maddyhome.idea.vim.key.OperatorFunction;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class OperatorAction extends VimCommandAction {
protected OperatorAction() {
super(new EditorActionHandlerBase() {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final OperatorFunction operatorFunction = VimPlugin.getKey().getOperatorFunction();
if (operatorFunction != null) {
final Argument argument = cmd.getArgument();
if (argument != null) {
final Command motion = argument.getMotion();
if (motion != null) {
final TextRange range = MotionGroup
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(),
cmd.getRawCount(), argument, true);
if (range != null) {
VimPlugin.getMark().setChangeMarks(editor, range);
final SelectionType selectionType = SelectionType.fromCommandFlags(motion.getFlags());
KeyHandler.getInstance().reset(editor);
return operatorFunction.apply(editor, context, selectionType);
}
}
}
return false;
}
VimPlugin.showMessage(MessageHelper.message("E774"));
return false;
}
});
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("g@");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@Override
public int getFlags() {
return Command.FLAG_OP_PEND;
}
}

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -41,6 +41,7 @@ public class RepeatChangeAction extends EditorAction {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
CommandState state = CommandState.getInstance(editor); CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand(); Command cmd = state.getLastChangeCommand();
if (cmd != null) { if (cmd != null) {
if (command.getRawCount() > 0) { if (command.getRawCount() > 0) {
cmd.setCount(command.getCount()); cmd.setCount(command.getCount());
@@ -53,6 +54,9 @@ public class RepeatChangeAction extends EditorAction {
} }
} }
Command save = state.getCommand(); Command save = state.getCommand();
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
state.setCommand(cmd); state.setCommand(cmd);
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL); state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
char reg = VimPlugin.getRegister().getCurrentRegister(); char reg = VimPlugin.getRegister().getCurrentRegister();
@@ -67,6 +71,7 @@ public class RepeatChangeAction extends EditorAction {
if (save != null) { if (save != null) {
state.setCommand(save); state.setCommand(save);
} }
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
state.saveLastChangeCommand(cmd); state.saveLastChangeCommand(cmd);
VimPlugin.getRegister().selectRegister(reg); VimPlugin.getRegister().selectRegister(reg);

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -37,13 +39,11 @@ import java.util.Set;
*/ */
public class AutoIndentLinesVisualAction extends VimCommandAction { public class AutoIndentLinesVisualAction extends VimCommandAction {
public AutoIndentLinesVisualAction() { public AutoIndentLinesVisualAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override @Override
protected boolean execute(@NotNull Editor editor, protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull DataContext context, @NotNull Command cmd, @NotNull TextRange range) {
@NotNull Command cmd, VimPlugin.getChange().autoIndentRange(editor, caret, context, range);
@NotNull TextRange range) {
VimPlugin.getChange().autoIndentLines(context);
return true; return true;
} }
}); });

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper; import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -36,10 +38,16 @@ public class ChangeCaseLowerMotionAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && return argument != null &&
VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount, CharacterHelper.CASE_LOWER, VimPlugin.getChange()
argument); .changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
@@ -26,6 +27,7 @@ import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper; import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -39,11 +41,12 @@ import java.util.Set;
*/ */
public class ChangeCaseLowerVisualAction extends VimCommandAction { public class ChangeCaseLowerVisualAction extends VimCommandAction {
public ChangeCaseLowerVisualAction() { public ChangeCaseLowerVisualAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor); final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
return VimPlugin.getChange().changeCaseRange(topLevelEditor, range, CharacterHelper.CASE_LOWER); return VimPlugin.getChange().changeCaseRange(topLevelEditor, caret, range, CharacterHelper.CASE_LOWER);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeCaseToggleCharacterAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().changeCaseToggleCharacter(editor, count); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper; import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -36,9 +38,16 @@ public class ChangeCaseToggleMotionAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount, super(true, CaretOrder.DECREASING_OFFSET);
CharacterHelper.CASE_TOGGLE, argument); }
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper; import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -38,10 +40,11 @@ import java.util.Set;
*/ */
public class ChangeCaseToggleVisualAction extends VimCommandAction { public class ChangeCaseToggleVisualAction extends VimCommandAction {
public ChangeCaseToggleVisualAction() { public ChangeCaseToggleVisualAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_TOGGLE); @NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_TOGGLE);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper; import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -36,9 +38,15 @@ public class ChangeCaseUpperMotionAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount, super(true, CaretOrder.DECREASING_OFFSET);
CharacterHelper.CASE_UPPER, argument); }
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_UPPER, argument);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper; import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -38,10 +40,10 @@ import java.util.Set;
*/ */
public class ChangeCaseUpperVisualAction extends VimCommandAction { public class ChangeCaseUpperVisualAction extends VimCommandAction {
public ChangeCaseUpperVisualAction() { public ChangeCaseUpperVisualAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull TextRange range) { @NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_UPPER); return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_UPPER);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeCharacterAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return argument != null && VimPlugin.getChange().changeCharacter(editor, count, argument.getCharacter()); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.getCharacter());
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeCharactersAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().changeCharacters(editor, context, count); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCharacters(editor, caret, count);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeEndOfLineAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().changeEndOfLine(editor, context, count); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeEndOfLine(editor, caret, count);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -38,8 +38,8 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1); final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/&"); return VimPlugin.getSearch().searchAndReplace(editor, editor.getCaretModel().getPrimaryCaret(), range, "s", "//~/&");
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
@@ -36,10 +37,17 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
int line = editor.getCaretModel().getLogicalPosition().line; @Nullable Argument argument) {
LineRange range = new LineRange(line, line); boolean result = true;
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/"); for (Caret caret : editor.getCaretModel().getAllCarets()) {
final int line = caret.getLogicalPosition().line;
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, new LineRange(line, line), "s", "//~/")) {
result = false;
}
}
return result;
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class ChangeLineAction extends EditorAction { public class ChangeLineAction extends EditorAction {
public ChangeLineAction() { public ChangeLineAction() {
super(new Handler()); super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull Caret caret,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { @NotNull DataContext context,
return VimPlugin.getChange().changeLine(editor, context, count); int count,
} int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().changeLine(editor, caret, count);
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeMotionAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return argument != null && VimPlugin.getChange().changeMotion(editor, context, count, rawCount, argument); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeNumberDecAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().changeNumber(editor, -count); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, -count);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeNumberIncAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().changeNumber(editor, count); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, count);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -31,12 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class ChangeReplaceAction extends EditorAction { public class ChangeReplaceAction extends EditorAction {
public ChangeReplaceAction() { public ChangeReplaceAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull DataContext context,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { int count,
return VimPlugin.getChange().changeReplace(editor, context); int rawCount,
} @Nullable Argument argument) {
VimPlugin.getChange().changeReplace(editor, context);
return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -26,7 +27,9 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType; import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@@ -38,11 +41,14 @@ import java.util.Set;
*/ */
public class ChangeVisualAction extends VimCommandAction { public class ChangeVisualAction extends VimCommandAction {
public ChangeVisualAction() { public ChangeVisualAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
final SelectionType type = range.isMultiple() ? SelectionType.BLOCK_WISE : SelectionType.CHARACTER_WISE; @NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeRange(editor, context, range, type); final SelectionType type = EditorData.wasVisualBlockMode(editor) && range.isMultiple()
? SelectionType.BLOCK_WISE
: SelectionType.CHARACTER_WISE;
return VimPlugin.getChange().changeRange(editor, caret, range, type);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -26,6 +27,7 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType; import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper; import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -39,12 +41,13 @@ import java.util.Set;
*/ */
public class ChangeVisualLinesAction extends VimCommandAction { public class ChangeVisualLinesAction extends VimCommandAction {
public ChangeVisualLinesAction() { public ChangeVisualLinesAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()), final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1); EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, context, lineRange, SelectionType.LINE_WISE); return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change; package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -26,7 +27,9 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType; import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.EditorHelper; import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -39,10 +42,10 @@ import java.util.Set;
*/ */
public class ChangeVisualLinesEndAction extends VimCommandAction { public class ChangeVisualLinesEndAction extends VimCommandAction {
public ChangeVisualLinesEndAction() { public ChangeVisualLinesEndAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull TextRange range) { @NotNull Command cmd, @NotNull TextRange range) {
if (range.isMultiple()) { if (EditorData.wasVisualBlockMode(editor) && range.isMultiple()) {
final int[] starts = range.getStartOffsets(); final int[] starts = range.getStartOffsets();
final int[] ends = range.getEndOffsets(); final int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) { for (int i = 0; i < starts.length; i++) {
@@ -51,12 +54,12 @@ public class ChangeVisualLinesEndAction extends VimCommandAction {
} }
} }
final TextRange blockRange = new TextRange(starts, ends); final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange().changeRange(editor, context, blockRange, SelectionType.BLOCK_WISE); return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE);
} }
else { else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()), final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1); EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, context, lineRange, SelectionType.LINE_WISE); return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
} }
} }
}); });

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -43,7 +43,9 @@ public class FilterMotionAction extends EditorAction {
if (argument == null) { if (argument == null) {
return false; return false;
} }
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(), argument, false); TextRange range = MotionGroup
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(), cmd.getRawCount(),
argument, false);
if (range == null) { if (range == null) {
return false; return false;
} }
@@ -52,7 +54,7 @@ public class FilterMotionAction extends EditorAction {
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset()); LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset()); LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
if (current.line != start.line) { if (current.line != start.line) {
MotionGroup.moveCaret(editor, range.getStartOffset()); MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), range.getStartOffset());
} }
int count; int count;

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteCharacterAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().deleteCharacter(editor, 1, false); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, 1, false);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteCharacterLeftAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().deleteCharacter(editor, -count, false); super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteCharacterRightAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().deleteCharacter(editor, count, false); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, count, false);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteEndOfLineAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return VimPlugin.getChange().deleteEndOfLine(editor, count); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteEndOfLine(editor, caret, count);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,12 +37,18 @@ public class DeleteJoinLinesAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) { if (editor.isOneLineMode()) {
return false; return false;
} }
return VimPlugin.getChange().deleteJoinLines(editor, count, false); return VimPlugin.getChange().deleteJoinLines(editor, caret, count, false);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,12 +37,18 @@ public class DeleteJoinLinesSpacesAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) { if (editor.isOneLineMode()) {
return false; return false;
} }
return VimPlugin.getChange().deleteJoinLines(editor, count, true); return VimPlugin.getChange().deleteJoinLines(editor, caret, count, true);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@@ -37,10 +40,11 @@ import java.util.Set;
*/ */
public class DeleteJoinVisualLinesAction extends VimCommandAction { public class DeleteJoinVisualLinesAction extends VimCommandAction {
public DeleteJoinVisualLinesAction() { public DeleteJoinVisualLinesAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, false); @NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, false);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@@ -37,10 +40,11 @@ import java.util.Set;
*/ */
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction { public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
public DeleteJoinVisualLinesSpacesAction() { public DeleteJoinVisualLinesSpacesAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, true); @NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, true);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class DeleteLineAction extends EditorAction { public class DeleteLineAction extends EditorAction {
public DeleteLineAction() { public DeleteLineAction() {
super(new Handler()); super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull Caret caret,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { @NotNull DataContext context,
return VimPlugin.getChange().deleteLine(editor, count); int count,
} int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().deleteLine(editor, caret, count);
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,15 @@ public class DeleteMotionAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public Handler() {
return argument != null && VimPlugin.getChange().deleteMotion(editor, context, count, rawCount, argument, false); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange().deleteMotion(editor, caret, context, count, rawCount, argument, false);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -27,6 +28,7 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType; import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper; import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -40,17 +42,18 @@ import java.util.Set;
*/ */
public class DeleteVisualAction extends VimCommandAction { public class DeleteVisualAction extends VimCommandAction {
public DeleteVisualAction() { public DeleteVisualAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode(); final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_LINE) { if (mode == CommandState.SubMode.VISUAL_LINE) {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()), final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1); EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.fromSubMode(mode), false); return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.fromSubMode(mode), false);
} }
else { else {
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false); return VimPlugin.getChange().deleteRange(editor, caret, range, SelectionType.fromSubMode(mode), false);
} }
} }
}); });

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -27,6 +28,7 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType; import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper; import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -40,17 +42,20 @@ import java.util.Set;
*/ */
public class DeleteVisualLinesAction extends VimCommandAction { public class DeleteVisualLinesAction extends VimCommandAction {
public DeleteVisualLinesAction() { public DeleteVisualLinesAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode(); final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_BLOCK) { if (mode == CommandState.SubMode.VISUAL_BLOCK) {
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false); return VimPlugin.getChange()
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), range, SelectionType.fromSubMode(mode),
false);
} }
else { else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()), final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1); EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.LINE_WISE, false); return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
} }
} }
}); });

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.delete; package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode; import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType; import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange; import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler; import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper; import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -39,10 +42,11 @@ import java.util.Set;
*/ */
public class DeleteVisualLinesEndAction extends VimCommandAction { public class DeleteVisualLinesEndAction extends VimCommandAction {
public DeleteVisualLinesEndAction() { public DeleteVisualLinesEndAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
@NotNull TextRange range) { protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
if (range.isMultiple()) { @NotNull Command cmd, @NotNull TextRange range) {
if (CommandState.inVisualBlockMode(editor)) {
final int[] starts = range.getStartOffsets(); final int[] starts = range.getStartOffsets();
final int[] ends = range.getEndOffsets(); final int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) { for (int i = 0; i < starts.length; i++) {
@@ -51,12 +55,13 @@ public class DeleteVisualLinesEndAction extends VimCommandAction {
} }
} }
final TextRange blockRange = new TextRange(starts, ends); final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange().deleteRange(editor, blockRange, SelectionType.BLOCK_WISE, false); return VimPlugin.getChange()
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), blockRange, SelectionType.BLOCK_WISE, false);
} }
else { else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()), final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1); EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.LINE_WISE, false); return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
} }
} }
}); });

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class InsertAfterCursorAction extends EditorAction { public class InsertAfterCursorAction extends EditorAction {
public InsertAfterCursorAction() { public InsertAfterCursorAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull DataContext context,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { int count,
VimPlugin.getChange().insertAfterCursor(editor, context); int rawCount,
@Nullable Argument argument) {
return true; VimPlugin.getChange().insertAfterCursor(editor, context);
} return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class InsertAfterLineEndAction extends EditorAction { public class InsertAfterLineEndAction extends EditorAction {
public InsertAfterLineEndAction() { public InsertAfterLineEndAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull DataContext context,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { int count,
VimPlugin.getChange().insertAfterLineEnd(editor, context); int rawCount,
@Nullable Argument argument) {
return true; VimPlugin.getChange().insertAfterLineEnd(editor, context);
} return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class InsertAtPreviousInsertAction extends EditorAction { public class InsertAtPreviousInsertAction extends EditorAction {
public InsertAtPreviousInsertAction() { public InsertAtPreviousInsertAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull DataContext context,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { int count,
VimPlugin.getChange().insertAtPreviousInsert(editor, context); int rawCount,
@Nullable Argument argument) {
return true; VimPlugin.getChange().insertAtPreviousInsert(editor, context);
} return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class InsertBeforeFirstNonBlankAction extends EditorAction { public class InsertBeforeFirstNonBlankAction extends EditorAction {
public InsertBeforeFirstNonBlankAction() { public InsertBeforeFirstNonBlankAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull DataContext context,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { int count,
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context); int rawCount,
@Nullable Argument argument) {
return true; VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
} return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.insert; package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase; import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** /**
*/ */
@@ -33,13 +36,19 @@ public class InsertCharacterAboveCursorAction extends EditorAction {
super(new Handler()); super(new Handler());
} }
private static class Handler extends EditorActionHandlerBase { private static class Handler extends ChangeEditorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) { if (editor.isOneLineMode()) {
return false; return false;
} }
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, -1); return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, -1);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.insert; package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase; import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** /**
*/ */
@@ -33,13 +36,19 @@ public class InsertCharacterBelowCursorAction extends EditorAction {
super(new Handler()); super(new Handler());
} }
private static class Handler extends EditorActionHandlerBase { private static class Handler extends ChangeEditorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) { if (editor.isOneLineMode()) {
return false; return false;
} }
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, 1); return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, 1);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,17 @@
package com.maddyhome.idea.vim.action.change.insert; package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase; import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** /**
*/ */
@@ -33,9 +38,15 @@ public class InsertDeleteInsertedTextAction extends EditorAction {
super(new Handler()); super(new Handler());
} }
private static class Handler extends EditorActionHandlerBase { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public Handler() {
return VimPlugin.getChange().insertDeleteInsertedText(editor); super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().insertDeleteInsertedText(editor, caret);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,12 +19,17 @@
package com.maddyhome.idea.vim.action.change.insert; package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase; import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** /**
*/ */
@@ -33,9 +38,15 @@ public class InsertDeletePreviousWordAction extends EditorAction {
super(new Handler()); super(new Handler());
} }
private static class Handler extends EditorActionHandlerBase { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { public Handler() {
return VimPlugin.getChange().insertDeletePreviousWord(editor); super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().insertDeletePreviousWord(editor, caret);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction; import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command; import com.maddyhome.idea.vim.command.Command;
@@ -36,15 +35,16 @@ import java.util.Set;
public class InsertExitModeAction extends VimCommandAction { public class InsertExitModeAction extends VimCommandAction {
private static final String ACTION_ID = "VimInsertExitMode"; private static final String ACTION_ID = "VimInsertExitMode";
public InsertExitModeAction() { protected InsertExitModeAction() {
super(new EditorActionHandlerBase() { super(new EditorActionHandlerBase() {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) { @Override
VimPlugin.getChange().processEscape(InjectedLanguageUtil.getTopLevelEditor(editor), context); protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEscape(editor, context);
return true; return true;
} }
}); });
} }
@NotNull @NotNull
@Override @Override
public Set<MappingMode> getMappingModes() { public Set<MappingMode> getMappingModes() {

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ public class InsertInsertAction extends EditorAction {
private static class Handler extends EditorActionHandler { private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) { public void execute(@NotNull Editor editor, @NotNull DataContext context) {
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context); VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor));
} }
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/ */
public class InsertLineStartAction extends EditorAction { public class InsertLineStartAction extends EditorAction {
public InsertLineStartAction() { public InsertLineStartAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends ChangeEditorActionHandler { @NotNull DataContext context,
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { int count,
VimPlugin.getChange().insertLineStart(editor, context); int rawCount,
@Nullable Argument argument) {
return true; VimPlugin.getChange().insertLineStart(editor, context);
} return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ public class InsertNewLineBelowAction extends EditorAction {
} }
private static class Handler extends ChangeEditorActionHandler { private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) { if (editor.isOneLineMode()) {
return false; return false;
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** /**
*/ */
public class InsertPreviousInsertAction extends EditorAction { public class InsertPreviousInsertAction extends EditorAction {
public InsertPreviousInsertAction() { public InsertPreviousInsertAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends EditorActionHandler { @NotNull DataContext context,
public void execute(@NotNull Editor editor, @NotNull DataContext context) { int count,
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, false); int rawCount,
} @Nullable Argument argument) {
VimPlugin.getChange().insertPreviousInsert(editor, context, false);
return true;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** /**
*/ */
public class InsertPreviousInsertExitAction extends EditorAction { public class InsertPreviousInsertExitAction extends EditorAction {
public InsertPreviousInsertExitAction() { public InsertPreviousInsertExitAction() {
super(new Handler()); super(new ChangeEditorActionHandler() {
} @Override
public boolean execute(@NotNull Editor editor,
private static class Handler extends EditorActionHandler { @NotNull DataContext context,
public void execute(@NotNull Editor editor, @NotNull DataContext context) { int count,
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, true); int rawCount,
} @Nullable Argument argument) {
VimPlugin.getChange().insertPreviousInsert(editor, context, true);
return false;
}
});
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -38,9 +38,12 @@ import java.util.Set;
public class VisualBlockAppendAction extends VimCommandAction { public class VisualBlockAppendAction extends VimCommandAction {
public VisualBlockAppendAction() { public VisualBlockAppendAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) { @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, true); if (editor.isOneLineMode()) return false;
return VimPlugin.getChange().blockInsert(editor, context, range, true);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -38,9 +38,13 @@ import java.util.Set;
public class VisualBlockInsertAction extends VimCommandAction { public class VisualBlockInsertAction extends VimCommandAction {
public VisualBlockInsertAction() { public VisualBlockInsertAction() {
super(new VisualOperatorActionHandler() { super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @Override
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) { @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, false); if (editor.isOneLineMode()) return false;
return VimPlugin.getChange().blockInsert(editor, context, range, false);
} }
}); });
} }

View File

@@ -1,6 +1,6 @@
/* /*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors * Copyright (C) 2003-2016 The IdeaVim authors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift; package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler; import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -30,14 +32,14 @@ import org.jetbrains.annotations.Nullable;
/** /**
*/ */
public class AutoIndentLinesAction extends EditorAction { public class AutoIndentLinesAction extends EditorAction {
public AutoIndentLinesAction() { protected AutoIndentLinesAction() {
super(new Handler()); super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
} @Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
private static class Handler extends ChangeEditorActionHandler { int rawCount, @Nullable Argument argument) {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { VimPlugin.getChange().autoIndentLines(editor, caret, context, count);
VimPlugin.getChange().autoIndentLines(context); return true;
return true; }
} });
} }
} }

View File

@@ -0,0 +1,50 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2014 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Aleksey Lagoshin
*/
public class AutoIndentMotionAction extends EditorAction {
protected AutoIndentMotionAction() {
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (argument == null) {
return false;
}
VimPlugin.getChange().autoIndentMotion(editor, caret, context, count, rawCount, argument);
return true;
}
});
}
}

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