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

Compare commits

...

920 Commits
0.32 ... 0.50

Author SHA1 Message Date
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
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
6752058922 Version 0.39 2014-12-03 16:07:30 +03:00
Andrey Vlasovskikh
b965108dad Updated changelog 2014-12-03 16:06:20 +03:00
Andrey Vlasovskikh
6bf0f36567 Merge remote-tracking branch 'dezgeg/fixes/vim-702-fix-substitute-infinite-loop' 2014-12-03 15:59:43 +03:00
Andrey Vlasovskikh
69f1a70968 VIM-848 Show line numbers if they are enabled in the settings and there is no 'set number' 2014-12-03 15:42:59 +03:00
Tuomas Tynkkynen
47edfcac5e VIM-702 Fix infinite loop on s/$/\r/g
If the replacement contains newlines, the line number of the current
search position needs to be adjusted. Without this, e.g. s/$/\r/g would
get into an infinite loop.
2014-12-03 14:00:31 +02:00
Andrey Vlasovskikh
c34599b954 Updated the changelog 2014-12-01 16:03:12 +03:00
Andrey Vlasovskikh
48b371c985 Don't show line numbers in non-file editors 2014-12-01 15:54:48 +03:00
Andrey Vlasovskikh
47165e7b9d EA-63002 Don't update line numbers in the caret movement event listener
This update may require moving the caret.
2014-12-01 15:54:31 +03:00
Andrey Vlasovskikh
69f4611552 Version 0.38 2014-12-01 14:01:25 +03:00
Andrey Vlasovskikh
31a25449a8 Updated the changelist 2014-12-01 13:59:34 +03:00
Andrey Vlasovskikh
26a247c0bf Revert "Unified tests initialization for IntelliJ 13+ Community and Ultimate"
This reverts commit 296ef1bdf9.
2014-11-28 22:29:15 +03:00
Andrey Vlasovskikh
1c7cd23475 Updated IntelliJ version 2014-11-28 21:44:37 +03:00
Andrey Vlasovskikh
296ef1bdf9 Unified tests initialization for IntelliJ 13+ Community and Ultimate 2014-11-28 20:22:43 +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
Andrey Vlasovskikh
642659bc9b VIM-410 Use the standard editor line numbers for supporting 'nu'
Annotations-based line numbers reset all other annotations on caret
move, so the results of VCS annotate are reset all the time. It is
necessary for 'rnu', but for 'nu' we can use standard editor line
numbers and preserve the ability to show VCS annotations during caret
movement operations.
2014-11-26 19:49:09 +03:00
Andrey Vlasovskikh
f0e8d065b7 Merge remote-tracking branch 'dezgeg/fixes/vim-723-paste-wrong-line' 2014-11-26 18:18:54 +03:00
Andrey Vlasovskikh
520d852c04 Merge remote-tracking branch 'dezgeg/fixes/vim-771-repeated-semicolon' 2014-11-26 18:12:14 +03:00
Andrey Vlasovskikh
8d4d7a421a Merge remote-tracking branch 'dezgeg/fixes/crashes' 2014-11-26 17:58:27 +03:00
Andrey Vlasovskikh
802b83b0fe VIM-818 Enable key repeat on Mac OS X every time it gets reset by the OS 2014-11-26 17:21:18 +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
Tuomas Tynkkynen
31f598d1e1 VIM-723 Fix pasting to an empty line
When pasting on an empty line, the pasted text would go to the start of
next line instead.
2014-11-17 03:47:50 +02:00
Tuomas Tynkkynen
46e6fd0847 VIM-771 Fix semicolon repeat for 'till char' motion
Based on empirical testing with Vim, ';' should work like this:
assuming "<caret>1:a 2:b 3:c" with ':' as the last f/t character:

- "t:" does nothing
- ";"  cursor goes to '2'
- "2;" cursor goes to '2', same as the previous
- "3;" cursor goes to '3'
2014-11-16 18:58:56 +02:00
Tuomas Tynkkynen
1441a60f4b Fix AIOOBE when '(' motion goes past start of file
If first character of the file is a newline, then findSentenceEnd()
could return -2 when the 'previous sentence' motion is performed,
leading to an eventual crash. Found by fuzzing.
2014-11-16 17:08:47 +02:00
Tuomas Tynkkynen
ebdf107946 Fix AIOOBE crash when using 'b' on first line
If 'b' were used on the first word of the file, and the word was
preceded by whitespace, ArrayIndexOutOfBoundsException would occur.
Found by fuzzing.
2014-11-16 17:08:47 +02:00
Tuomas Tynkkynen
38d672c9f9 Fix KeyHandler crash when using '<' or '>'
The '<' and '>' commands weren't marked with FLAG_OP_PEND even though
they should, which sometimes caused EmptyStackException in KeyHandler
(when typing <I<><I<> for example). Found by fuzzing.
2014-11-16 17:08:46 +02:00
Tuomas Tynkkynen
75d34abd45 Fix IOOBE when 'i)' motion doesn't find other delimiter
Found by fuzzing.
2014-11-16 17:08:43 +02:00
Andrey Vlasovskikh
1d98738e4d Updated the changelog 2014-11-15 00:11:35 +03:00
Andrey Vlasovskikh
3cfa0e1844 Merge remote-tracking branch 'dezgeg/fixes/vim-515-cW-command' 2014-11-15 00:09:00 +03:00
Andrey Vlasovskikh
82211a4373 Updated the changelog 2014-11-15 00:08:32 +03:00
Andrey Vlasovskikh
e324b04a94 Added Tuomas Tynkkynen to the list of contributors 2014-11-15 00:02:09 +03:00
Andrey Vlasovskikh
49d0c51d97 Merge branch 'vim-536-cc-second-to-last-line' 2014-11-15 00:00:43 +03:00
Andrey Vlasovskikh
fe4bc3b4a9 Moved line line position calculation before deletion 2014-11-15 00:00:13 +03:00
Tuomas Tynkkynen
58d964063c VIM-515 Fix cW command detecting end-of-word incorrectly
A cW command on text like 'x$$$$' or '$xxxx' would incorrectly delete
just the first character, and not the rest.
2014-11-14 22:51:46 +02:00
Andrey Vlasovskikh
17d3e37e1d Merge branch 'vim-567-run-external-command-in-window' 2014-11-14 23:43:42 +03:00
Andrey Vlasovskikh
54f6a16bd6 Nullity checks 2014-11-14 23:41:17 +03:00
Andrey Vlasovskikh
f4ffc5d198 Get rid of Reader and Writer classes in executeCommand() 2014-11-14 23:35:27 +03:00
Andrey Vlasovskikh
3d8010bf88 Removed debug output 2014-11-14 23:18:53 +03:00
Andrey Vlasovskikh
ec2cc3a7f9 Code style 2014-11-14 23:17:50 +03:00
Andrey Vlasovskikh
52b7b9bcd8 Merge branch 'vim-705-multi-line-indent-broken' 2014-11-14 23:05:03 +03:00
Andrey Vlasovskikh
8ad0fcf42d Default value for @NotNull field mode 2014-11-14 23:04:33 +03:00
Andrey Vlasovskikh
aa6cc45988 Made moveCaret(Editor, int, boolean) private 2014-11-14 23:02:32 +03:00
Tuomas Tynkkynen
da22b8297b VIM-536 Fix 'cc' on second-to-last line in file
Previously, 'cc' on the second-to-last line of a file would instead open
a new line after the last line of the file.
2014-11-14 16:56:05 +02:00
Tuomas Tynkkynen
798d82e941 VIM-567 Extend :! to allow running non-filter commands
This commit allows the Ex command '!' to be ran without a range, with
the results displayed in a window.

For example, run ':! ls' in normal mode for a quick directory listing.
2014-11-11 20:32:24 +02:00
Tuomas Tynkkynen
ac8ac302ca VIM-705 Fix repeated multiline indent
When a visual mode command is repeated, code calls into
MotionGroup#toggleVisual() to setup a 'fake' visual mode selection. But
when MotionGroup.moveCaret() is called, it notices that the indent
command has the FLAG_EXIT_VISUAL flag, and leaves visual mode right
away.
2014-11-10 23:32:09 +02:00
Tuomas Tynkkynen
22c3a73102 VIM-613 Fix repeat after 'd$'
Previously, repeating a 'd$' command would incorrectly delete the
newline from the line.
2014-11-10 16:36:40 +02:00
Andrey Vlasovskikh
1222fdb043 Merge pull request #47 from TylerNHansen/master
Update README.md - typo fix
2014-10-29 22:43:24 +03:00
Tyler Hansen
78a50c2f53 Update README.md 2014-10-29 12:19:13 -07:00
Andrey Vlasovskikh
6d261a7afa Merge pull request #46 from Baldrs/patch-1
Typo
2014-10-24 18:41:40 +04:00
Baldrs
2e37292478 Typo 2014-10-24 17:40:34 +03:00
Andrey Vlasovskikh
a4907ec9c8 Links to GitHub and YouTrack in the plugin info 2014-10-24 16:41:00 +04:00
Andrey Vlasovskikh
992bfe73b6 Updated changes in plugin.xml 2014-10-24 16:37:29 +04:00
Andrey Vlasovskikh
c186254a7e Updated dev version 2014-10-24 16:36:21 +04:00
Andrey Vlasovskikh
1dc739f32c Added :action and :actionlist to the docs 2014-10-24 16:35:56 +04:00
Andrey Vlasovskikh
9804cd83a6 VIM-652 Added a test for :action 2014-10-24 16:13:40 +04:00
Andrey Vlasovskikh
aa5b99c47a Added smartbomb to the list of contributors 2014-10-24 16:04:57 +04:00
Andrey Vlasovskikh
f95f5e8901 Merge branch 'action-command' 2014-10-24 16:02:21 +04:00
Andrey Vlasovskikh
206b303407 Renamed ExecuteActionByNameHandler to ActionHandler
The name of an Ex command handler should correspond to the Ex command
name.
2014-10-24 16:01:38 +04:00
Andrey Vlasovskikh
751bff53ee Removed checks for action execution problems not reproducible at the moment
We need to collect more data from the beta testers about these problems.
2014-10-24 16:00:23 +04:00
Andrey Vlasovskikh
b6ef0c509d We don't need two Alexeys at the moment 2014-10-23 22:47:41 +04:00
Andrey Vlasovskikh
30304d6836 VIM-794 Fixed NCDFE related to 'number' in IDEs other than IntelliJ 2014-10-23 22:45:19 +04:00
Andrey Vlasovskikh
f5df49b139 Don't allow short names for IdeaVim-specific :action and :actionlist 2014-10-23 19:01:58 +04:00
Andrey Vlasovskikh
bf8ba1a49b Prettier output of :actionlist 2014-10-23 18:58:50 +04:00
Andrey Vlasovskikh
9f2697658b Fixed code style 2014-10-23 18:25:01 +04:00
smartbomb
36fd59b92c ExecuteActionByName use the content context on actions with the EnabledInModalContext flag set
(cherry picked from commit d375740)
2014-10-23 18:02:12 +04:00
Andrey Vlasovskikh
88d946546a Added Alexey Shmalko to the list of contributors 2014-10-23 17:30:06 +04:00
Andrey Vlasovskikh
6036c0c262 Updated CHANGES 2014-10-23 16:59:41 +04:00
Andrey Vlasovskikh
20e831b56a Updated tests after fixing VIM-501 2014-10-23 16:58:43 +04:00
Andrey Vlasovskikh
72b74e075c Merge branch 'visual_block_delete' 2014-10-23 16:55:17 +04:00
Andrey Vlasovskikh
3c6ede2f8f Normalize offsets in order to prevent selecting newlines 2014-10-23 16:53:31 +04:00
Andrey Vlasovskikh
5434edbd54 VIM-792 Fixed line-wise and block-wise paste commands for * and + registers 2014-10-23 16:09:56 +04:00
Andrey Vlasovskikh
6a8c7e4b17 VIM-511 Record caret adjustment changes to the document during <Enter> processing
We have to handle Enter by our VimShortcutKeyAction in order to be
able to record it as an action for repeating it via '.'. Since original
Enter handlers are not run in this case we invoke them manually by
collecting a list of actions that can be run for the editor component
on Enter and then running the first action ready to run.

Caret adjustments are detected on changes to the document caused by
Enter. This allows to position the caret properly (e.g. between {})
before recording Enter.
2014-10-23 15:26:22 +04:00
Alexey Shmalko
0ac659f2d1 Fix visual block deleting
Currently deleting visual block leaves last char in line untouched. This
patch fixes that as well as tests.
2014-10-21 21:40:43 +03:00
Tony Kay
7eae40ca9a added a failing test 2014-10-21 11:05:43 -07:00
Andrey Vlasovskikh
b3d12c8b58 VIM-511 Fixed removing a paren just after inserting it with auto-inserting matching parens on 2014-10-21 21:47:06 +04:00
Andrey Vlasovskikh
3f92dba1b7 VIM-511 Updated test data 2014-10-21 21:16:11 +04:00
Andrey Vlasovskikh
0aedc08cfa More tests for VIM-511 2014-10-21 20:42:04 +04:00
Andrey Vlasovskikh
8312f5cffd VIM-511 Added a test for repeating a change that includes auto-inserted parens and quotes 2014-10-21 19:41:11 +04:00
Andrey Vlasovskikh
9f6338441e Updated CHANGES 2014-10-21 19:09:56 +04:00
Andrey Vlasovskikh
27efe0c9d6 Handle left and right motions during key repeat only as document (caret) changes
Previously they have been recorded twice: implicitly by a document
change listener as changes to the caret position and by a command
processor.
2014-10-21 18:24:36 +04:00
Andrey Vlasovskikh
b5bf6c08d8 Repeat typing commands by inserting text instead of handling a typed key
It will prevent auto-completion and other auto-inserting typed key
handlers from messing up with the repeated text.
2014-10-21 18:22:19 +04:00
Andrey Vlasovskikh
e3fce51ea1 VIM-511 Fixed editing offset after <BS> for '.' command 2014-10-21 16:56:54 +04:00
Andrey Vlasovskikh
13b4e93bf4 Run the test only if the system clipboard is available 2014-10-20 16:53:25 +04:00
Andrey Vlasovskikh
4ec0ab281f Removed the list of compatible IDEs
The same list is shown on the plugin's page and duplicated in the
README.
2014-10-20 16:09:32 +04:00
Andrey Vlasovskikh
39c96019b6 Typo 2014-10-20 16:08:29 +04:00
Andrey Vlasovskikh
21f2f60355 Updated CHANGES 2014-10-20 16:07:50 +04:00
Andrey Vlasovskikh
0de654dcaf Added Thomas B Homburg to the list of contributors 2014-10-20 16:02:11 +04:00
Andrey Vlasovskikh
d59e472814 Added 'clipboard' to the list of :set commands 2014-10-20 16:01:09 +04:00
Andrey Vlasovskikh
cc2ed452f0 Merge branch 'clipboard-unnamed'
Conflicts:
	src/com/maddyhome/idea/vim/option/Options.java
	test/org/jetbrains/plugins/ideavim/action/CopyActionTest.java
2014-10-20 15:59:15 +04:00
Andrey Vlasovskikh
d4d3843725 VIM-476 Added default register reset on 'clipboard' change
Added a test for :set clipboard=unnamed.
2014-10-20 15:53:33 +04:00
Andrey Vlasovskikh
dee16da1c2 Coding style 2014-10-20 14:52:22 +04:00
Andrey Vlasovskikh
e09b85870f Added Jaime Sanchez to the list of contributors 2014-10-20 13:27:31 +04:00
Andrey Vlasovskikh
8596911a0e VIM-483 VIM-410 Added support for 'number' and 'relativenumber' commands
These commands override the line numbers setting in the IDE when the
Vim emulation is enabled.
2014-10-20 13:27:09 +04:00
Andrey Vlasovskikh
6c2de9f151 Extracted EditorGroup 2014-10-17 17:07:39 +04:00
Andrey Vlasovskikh
d3a6b1e39e Use '\n' as universal line separator for sorting lines
The Document class takes care of detecting and using the correct
platform-specific line separators.
2014-10-17 14:54:48 +04:00
Andrey Vlasovskikh
3cb9b19aea Added Chang Wang to the list of contributors 2014-10-16 23:32:42 +04:00
Andrey Vlasovskikh
86aa59bb29 Merge branch 'vim-624' 2014-10-16 23:29:33 +04:00
smartbomb
c6eeaed7da :actionlist added support for wildcards 2014-10-15 22:49:08 +02:00
smartbomb
edba90f188 Renamed :findaction => :actionlist + added statusbar error message when calling invalid action names 2014-10-15 21:17:26 +02:00
Andrey Vlasovskikh
26b49b1a0c Made the description shorter 2014-10-15 15:22:40 +04:00
Andrey Vlasovskikh
ef32648ddc Bumped version to 0.37 2014-10-15 15:17:42 +04:00
Andrey Vlasovskikh
c873524cb1 VIM-784 Fixed visual line selection where start > end of the selection range
It was a regression introduced by the fix of VIM-632.
2014-10-15 15:10:22 +04:00
smartbomb
7943e34bde Fix action execution contexts, use a delay on popup actions to allow the command handler to unwind 2014-10-15 08:31:44 +02:00
smartbomb
74970c74b4 Implemented :findaction 2014-10-14 22:47:03 +02:00
Andrey Vlasovskikh
2d11561041 Added Andrew Brookins to the list of contributors 2014-10-14 15:28:23 +04:00
Andrey Vlasovskikh
f7643b6bb3 Updated changelist 2014-10-14 15:28:07 +04:00
Andrey Vlasovskikh
d3afd83e8e Merge branch 'VIM-407' 2014-10-14 15:25:43 +04:00
Andrey Vlasovskikh
969ca0119a Bumped version to 0.36 2014-10-14 14:22:38 +04:00
smartbomb
722431f5b2 VIM-652 Add support for executing and mapping arbitrary IDEA actions
* no tests performed..! *

Example usage:
:nnoremap gi :action GotoImplementation<CR>
:nnoremap gu :action FindUsages<CR>
:nnoremap gcw :action RenameElement<CR>

Action overview:
6c6cb47c5a/platform/platform-resources-en/src/messages/ActionsBundle.properties
2014-10-13 21:58:38 +02:00
Andrey Vlasovskikh
6a1c792cda VIM-171 Added support for window navigation commands: left/right/up/down 2014-10-13 23:08:56 +04:00
Andrey Vlasovskikh
c0ba39ab40 Use multi-caret API available from branches 135+ 2014-10-09 18:33:07 +04:00
Andrey Vlasovskikh
3e0e08c5e1 VIM-632 Restored visual block mode that was broken due to multiple carets support
Vim actions with multiple carets in modes other than visual block are
not supported yet. It will be a separate feature. The idea behind this
commit is to fix the regression in visual block mode.

Bounds of visual selection are no longer reversed if they are
overlapped, this fixes expanding the block selection in all directions.

IdeaVim no longer uses SelectionModel.hasBlockSelection() since it
always returns 'true' now.

There are a couple of places where we remove secondary carets when
moving the primary caret or re-setting visual mode. It may be
incompatible with the forthcoming support for multi-caret Vim actions.
2014-10-09 18:01:47 +04:00
Andrey Vlasovskikh
3d64373c22 Updated the changelog 2014-10-07 15:24:45 +04:00
Andrey Vlasovskikh
2557688657 Added Alexey Shmalko to the list of contributors 2014-10-07 15:11:55 +04:00
Andrey Vlasovskikh
fcc564df25 Cleanup 2014-10-07 14:29:30 +04:00
Andrey Vlasovskikh
4ecbb93d01 Converted window actions into subclasses of VimCommandAction 2014-10-07 13:52:46 +04:00
Alexey Shmalko
9bdc9b3634 VIM-171 Add checks for that window is not null 2014-10-04 01:29:41 +03:00
Alexey Shmalko
f46c3b0aa9 VIM-171 Add support for window cycling
Adds following keystrokes:
<C-W>w <C-W><C-W> next window
<C-W>W            previous window

With number both commands go to window with specified index.
2014-10-04 00:52:24 +03:00
Alexey Shmalko
095fdf07c5 VIM-171 Add support for closing all windows except current
Adds <C-W>o, <C-W><C-O> keystrokes.
2014-10-04 00:02:15 +03:00
Alexey Shmalko
648e988b64 VIM-171 Add support for closing window
Adds <C-W>c keystroke.
2014-10-03 23:41:53 +03:00
Alexey Shmalko
b1add735d6 Add split action
This patch adds following keystrokes:
<C-W>s <C-W>S <C-W><C-S> horizontal split
<C-W>v <C-W><C-V>        vertical split
2014-10-02 20:52:13 +03:00
Andrey Vlasovskikh
3f5882118e Compatibility with builds 133+ / IntelliJ 13+ 2014-09-10 15:03:01 +04:00
Andrey Vlasovskikh
4e83f56696 Merge branch 'vim-265'
Conflicts:
	AUTHORS.md
2014-09-10 13:58:29 +04:00
Andrey Vlasovskikh
ab250f1d9c Added salaam to the list of contributors 2014-09-10 13:57:40 +04:00
Andrey Vlasovskikh
4672dece51 VIM-770 Close the current tab on :quit instead of all tabs with the current file 2014-09-10 13:52:00 +04:00
Andrey Vlasovskikh
a632de9214 Cleanup 2014-09-09 18:30:21 +04:00
Andrey Vlasovskikh
e8ebba8b3d Removed unused declarations 2014-09-09 18:25:45 +04:00
Andrey Vlasovskikh
5cf8181474 Added Dathan Bennett to the list of contributors 2014-09-09 00:38:42 +04:00
Andrey Vlasovskikh
a717e4785d VIM-569 Fixed <C-W> when the caret is at the end of a line 2014-09-09 00:36:39 +04:00
Dathan Bennett
16ce16c632 Add test for VIM-569 fix 2014-09-06 02:59:49 -07:00
Dathan Bennett
8d7bf2661a Set isChange to true when calling deleteRange from ctrl-w handler 2014-09-06 01:07:03 -07:00
salaam
9e1b026a88 VIM-265 Add window split commands
Conflicts:
	src/com/maddyhome/idea/vim/VimPlugin.java
	src/com/maddyhome/idea/vim/ex/CommandParser.java
2014-08-31 23:57:22 -05:00
Thomas B Homburg
df8e455a6d Get default register from clipboard=unnamed setting 2014-08-26 22:51:17 +02:00
Chang Wang
b35bec2839 deselect visual selection range '<,'> when poping up ex entry field. 2014-08-13 16:40:50 -07:00
Andrew Brookins
19365effa9 VIM-407 Add tests. Only skip the ending line if it is empty.
Conflicts:
	src/com/maddyhome/idea/vim/group/ChangeGroup.java
	test/org/jetbrains/plugins/ideavim/action/ShiftRightLinesActionTest.java
2014-05-22 22:04:14 -07:00
Andrey Vlasovskikh
3750417323 Bumped version to 0.35 2014-05-15 15:09:02 +04:00
Andrey Vlasovskikh
d7bfb1ff10 Updated CHANGES 2014-05-15 15:04:12 +04:00
Andrey Vlasovskikh
1797771527 Added configuration via ~/.ideavimrc to the list of plugin features 2014-05-15 14:58:40 +04:00
Andrey Vlasovskikh
e564eb5878 VIM-213 Use '< and '> marks for saving and restoring last visual selection 2014-05-15 02:49:50 +04:00
Andrey Vlasovskikh
9cd620af58 VIM-646 Don't update visual selection if command moves caret and exits visual mode 2014-05-12 21:50:50 +04:00
Andrey Vlasovskikh
1414ef8a4f Removed check for unused FLAG_KEEP_VISUAL flag 2014-05-12 20:06:46 +04:00
Andrey Vlasovskikh
110623f6ef Moved StringHelper.parseKeysSet() to VimCommandAction 2014-05-12 20:04:32 +04:00
Andrey Vlasovskikh
0887c72486 Updated index docs for all the visual mode commands 2014-05-12 20:00:17 +04:00
Andrey Vlasovskikh
a516fd880e Made visual-only mode actions VimCommandActions 2014-05-12 19:28:24 +04:00
Andrey Vlasovskikh
50e15112d6 Use SelectionType in VisualRange instead of SubMode 2014-05-08 17:40:04 +04:00
Andrey Vlasovskikh
8b6f99385a Code style 2014-05-08 17:31:38 +04:00
Andrey Vlasovskikh
2d1b40f00c Added tests for 'gv' and 'o' in visual mode 2014-05-08 16:59:11 +04:00
Andrey Vlasovskikh
2fc2f30055 Removed debug output 2014-05-08 15:49:21 +04:00
Andrey Vlasovskikh
2094a19723 Extracted MarkGroup.setVisualSelectionMarks() 2014-05-08 02:02:38 +04:00
Andrey Vlasovskikh
5b1416424d VisualSelectPreviousAction is a VimCommandAction 2014-05-08 00:43:40 +04:00
Andrey Vlasovskikh
8b9e737c05 Fixed potential NPEs 2014-05-07 22:36:37 +04:00
Andrey Vlasovskikh
cc0f4acec6 Replaced StringBuilder with string concatenation 2014-05-07 22:36:26 +04:00
Andrey Vlasovskikh
30884162a0 Nullity annotations 2014-05-07 22:28:42 +04:00
Andrey Vlasovskikh
f1e7a8c444 Removed unused code 2014-05-07 22:22:24 +04:00
Andrey Vlasovskikh
3271939c87 Simplified conditions 2014-05-07 22:20:00 +04:00
Andrey Vlasovskikh
c9cb487cbc Replaced StringBuilder with string concatenation where possible 2014-05-07 22:17:37 +04:00
Andrey Vlasovskikh
56f6b69adf Use Collections.addAll() 2014-05-07 22:16:42 +04:00
Andrey Vlasovskikh
77dcee1269 Use foreach loop 2014-05-07 22:15:50 +04:00
Andrey Vlasovskikh
c9068ee4d1 Replaced StringBuffer with StringBuilder 2014-05-07 22:15:25 +04:00
Andrey Vlasovskikh
e7addf7fa8 Added 'final' modifiers for fields where possible 2014-05-07 22:12:47 +04:00
Andrey Vlasovskikh
7cc0a8db92 Inlined constant arguments 2014-05-07 22:05:40 +04:00
Andrey Vlasovskikh
bccb62a84f Inlined redundant local variables 2014-05-07 21:55:13 +04:00
Andrey Vlasovskikh
d47570664b Simplified conditions 2014-05-07 21:53:55 +04:00
Andrey Vlasovskikh
a7137558cc Removed unnecessary semicolons 2014-05-07 21:52:38 +04:00
Andrey Vlasovskikh
0251c5a33d Made constants final 2014-05-07 21:52:11 +04:00
Andrey Vlasovskikh
365722ef7e Removed redundant casts 2014-05-07 21:50:17 +04:00
Andrey Vlasovskikh
77e0c30e57 Removed unused assignments and empty conditions 2014-05-07 21:49:29 +04:00
Andrey Vlasovskikh
8a0cad765a Fixed potential NPEs 2014-05-07 21:38:21 +04:00
Andrey Vlasovskikh
272378b800 Fixed typos and dropped commented code 2014-05-07 21:00:16 +04:00
Andrey Vlasovskikh
a34d17ff95 Fixed potential NPEs 2014-05-07 20:46:40 +04:00
Andrey Vlasovskikh
82c782e9f0 Cleanup 2014-05-07 19:40:55 +04:00
Andrey Vlasovskikh
b7b46d2fee Removed unused code 2014-05-07 19:25:30 +04:00
Andrey Vlasovskikh
8916f0f314 Extracted more EventFacade methods 2014-05-06 20:32:42 +04:00
Andrey Vlasovskikh
8d727ef508 Extracted EventFacade.(un)registerCustomShortcutSet() 2014-05-06 19:44:35 +04:00
Andrey Vlasovskikh
fd0be10492 Extracted EventFacade.addEditorFactoryListener() 2014-05-06 19:33:35 +04:00
Andrey Vlasovskikh
a810f95101 Extracted EventFacade.*DocumentListener() 2014-05-06 19:26:36 +04:00
Andrey Vlasovskikh
8857545cf0 Introduced EventFacade for subscribing to IDE events 2014-05-06 19:18:47 +04:00
Andrey Vlasovskikh
2300c0005f Inferred nullity annotations 2014-05-06 18:32:55 +04:00
Andrey Vlasovskikh
827b91286f Removed unused DelegateCommandListener
There are no more actions marked with Command.FLAG_DELEGATE.
2014-05-06 18:04:38 +04:00
Andrey Vlasovskikh
4d8e35655d Extracted and inlined some variables 2014-05-06 17:34:53 +04:00
Andrey Vlasovskikh
f7e6ae9f3c Removed unused code 2014-05-06 17:15:34 +04:00
Andrey Vlasovskikh
67679843b4 Moved getShortcutKeyAction() to VimShortcutKeyAction.getInstance() 2014-05-06 17:09:12 +04:00
Andrey Vlasovskikh
b67b072be2 Updated CHANGES 2014-05-06 15:35:03 +04:00
Andrey Vlasovskikh
d6896e4e76 VIM-690 Read initialization commands only from ~/.ideavimrc 2014-05-06 15:20:40 +04:00
Andrey Vlasovskikh
f86c24a695 VIM-683 Allow Ctrl+PgUp/PgDown to be used outside of Vim emulation 2014-05-06 14:56:10 +04:00
Andrey Vlasovskikh
b200c842b4 VIM-679 Allow \u000D\u000C as <CR> in mappings 2014-05-05 21:26:35 +04:00
Andrey Vlasovskikh
c8df52a86c VIM-679 Allow \u0016 as an escape character for '|' in mappings 2014-05-05 20:51:39 +04:00
Andrey Vlasovskikh
b17a592c95 VIM-679 Parse characters less than \u0020 as <C-$CHAR> 2014-05-05 20:40:14 +04:00
Andrey Vlasovskikh
f71d6c7fab VIM-679 Don't trim whitespace-like characters from command arguments
Characters like '\u0018' may appear in mapping commands.
2014-04-30 21:08:16 +04:00
Andrey Vlasovskikh
30cfae91c0 Removed StringHelper.escape() in favor of updated toKeyNotation() 2014-04-30 20:10:33 +04:00
Andrey Vlasovskikh
5332128852 Extracted toEscapeNotation() 2014-04-30 19:39:04 +04:00
Andrey Vlasovskikh
b593d90dff VIM-676 Handle control characters in .vimrc as pressed, not typed keystrokes 2014-04-30 18:46:45 +04:00
Andrey Vlasovskikh
02fac3b931 Extracted executeText() 2014-04-30 17:36:18 +04:00
Andrey Vlasovskikh
446ffc3602 Bumped version to 0.34 2014-04-29 21:54:49 +04:00
Andrey Vlasovskikh
44c1a2e139 Mentioned .ideavimrc in keymap update message 2014-04-29 21:53:49 +04:00
Andrey Vlasovskikh
f6cb04c7ef VIM-674 Don't handle <Tab> in Insert mode in Vim emulation
It breaks several IDE actions that provide their own <Tab> handlers
like Emmet or parameters completion in RubyMine and AppCode.
2014-04-29 21:13:35 +04:00
Andrey Vlasovskikh
276755ae9d Typo 2014-04-29 20:33:25 +04:00
Andrey Vlasovskikh
6ee0b821cc VIM-672 Ignore mappings that contain <Plug> and <SID>
These mappings don't make sense to Vim emulation in IdeaVim.
2014-04-29 19:39:58 +04:00
Andrey Vlasovskikh
72dc121fcd VIM-670 First character of a recursive mapping shouldn't be mapped again
The mapping's "from" keys should be a prefix of "to" keys.
2014-04-29 17:22:25 +04:00
Andrey Vlasovskikh
786c4dc817 VIM-666 Support <Bar> in Vim key notation 2014-04-29 16:47:47 +04:00
Andrey Vlasovskikh
c7cfbaed0a Extracted Vim typed special keys map 2014-04-29 16:46:59 +04:00
Andrey Vlasovskikh
4351d5c366 VIM-666 Ignore characters after '|' in :map commands
Perhaps it should become a part of command parsing, since it is
possible to put several command on one line.
2014-04-29 16:40:28 +04:00
Andrey Vlasovskikh
ff3795798f Added notes about keyboard shortcut conflicts and .vimrc files 2014-04-29 14:37:16 +04:00
Andrey Vlasovskikh
45281adfd9 VIM-667 Ignore potentially nested lines of .vimrc based on leading whitespace 2014-04-29 14:28:35 +04:00
Andrey Vlasovskikh
0d813afc67 Don't show message about not using "Vim" keymap any longer in new installations 2014-04-29 14:09:18 +04:00
Andrey Vlasovskikh
e9e5c77cd3 VIM-661 Apply Operator pending and Visual mode mappings only at command start 2014-04-28 17:23:45 +04:00
Andrey Vlasovskikh
4d4bcbb365 Updated CHANGES 2014-04-28 16:05:02 +04:00
Andrey Vlasovskikh
bd5a2976fd Bumped version to 0.33 2014-04-28 16:02:34 +04:00
Andrey Vlasovskikh
cc6488ee2d Added a hyperlink for setting the IDE as a shortcut handler in case of conflicts 2014-04-28 15:57:57 +04:00
Andrey Vlasovskikh
52068198a5 VIM-665 Allow <C-C> in Insert mode when completion pop-up is active 2014-04-28 15:27:04 +04:00
Andrey Vlasovskikh
5cdcd9d4d4 Set up the vertical scroll bar on More panel in order to handle keys correctly 2014-04-25 18:06:43 +04:00
Andrey Vlasovskikh
fbeaa35d10 Use original Up/Down actions for non file-based editors 2014-04-25 17:18:08 +04:00
Andrey Vlasovskikh
1ac4bb38be Updated CHANGES 2014-04-25 16:45:27 +04:00
Andrey Vlasovskikh
69c2a096ab Updated CHANGES 2014-04-24 18:14:10 +04:00
Andrey Vlasovskikh
3dccf1b215 Nullity and immutability 2014-04-24 18:09:53 +04:00
Andrey Vlasovskikh
035cb02362 Local class name conventions 2014-04-24 18:03:46 +04:00
Andrey Vlasovskikh
43d33a4502 Immutable local variables where possible 2014-04-24 18:01:59 +04:00
Andrey Vlasovskikh
2b6e8dc566 Fixed nullity warnings 2014-04-24 17:47:59 +04:00
Andrey Vlasovskikh
6388cc0639 Added Alex Selesse to the list of contributors 2014-04-24 17:45:06 +04:00
Andrey Vlasovskikh
00bd6d2e3a Added |:sort| to index 2014-04-24 17:39:43 +04:00
Andrey Vlasovskikh
1f842b6d31 New IdeaVim API compatibility 2014-04-24 17:38:37 +04:00
Andrey Vlasovskikh
954d7bd14c Merge remote-tracking branch 'selesse/vim-439'
Conflicts:
	src/com/maddyhome/idea/vim/ex/CommandParser.java
2014-04-24 17:35:10 +04:00
Andrey Vlasovskikh
d358893579 Vim shortcuts handler is enabled for keys associated with IDE if there are no shortcut conflicts 2014-04-24 16:54:35 +04:00
Andrey Vlasovskikh
3cb40cb09d VIM-661 Apply Normal mode mappings only at command start 2014-04-23 20:44:06 +04:00
Andrey Vlasovskikh
a4a8faedbb Removed unused method 2014-04-22 19:47:48 +04:00
Andrey Vlasovskikh
c32fa2b53f VIM-648 Use default keymap if there is no previous keymap in config
Keymap upgrade message has been improved.
2014-04-22 19:40:07 +04:00
Andrey Vlasovskikh
1d0b1791c4 VIM-651 Parse <BS> as backspace 2014-04-22 17:59:49 +04:00
Andrey Vlasovskikh
7251c8976d Removed obsolete Vim help action for <F1> 2014-04-22 17:22:46 +04:00
Andrey Vlasovskikh
684531aaae VIM-665 Handle Shift-char as typed uppercase keystroke, not as pressed one 2014-04-22 17:16:09 +04:00
Andrey Vlasovskikh
4a1504f9e0 VIM-660 Handle <C-Space> as pressed keystroke, not typed one 2014-04-22 16:50:46 +04:00
Andrey Vlasovskikh
ee1a6bbbd9 Updated copyright headers 2014-04-08 00:43:51 +04:00
Andrey Vlasovskikh
52c86d8c27 VIM-645 Handle '<Space>' in key mappings as a typed key, not as a pressed shortcut 2014-04-08 00:25:14 +04:00
Andrey Vlasovskikh
07e59536f3 Updated link names 2014-04-07 20:15:50 +04:00
Andrey Vlasovskikh
63f31b9b01 Links to issues and docs, removed menu changes 2014-04-07 20:12:22 +04:00
Andrey Vlasovskikh
4b6bf1bb9f Markup for badges 2014-04-07 20:01:29 +04:00
Andrey Vlasovskikh
f03c202b46 TeamCity badges for builds and tests 2014-04-07 19:59:28 +04:00
Andrey Vlasovskikh
eb8a4a0e6a Use guest link for TeamCity builds 2014-04-07 19:53:07 +04:00
Andrey Vlasovskikh
c04b04f701 Mentioned key mappings support in README and CHANGES 2014-04-07 19:42:04 +04:00
Andrey Vlasovskikh
2a0833e3b5 Don't try to interpret '<script>' and '<expr>' key mappings 2014-04-06 03:52:39 +04:00
Andrey Vlasovskikh
6acc89331d Ignore special arguments of 'map' 2014-04-06 03:45:36 +04:00
Andrey Vlasovskikh
35afd9b92f Show all '<Enter>' equivalents as '<CR>' 2014-04-06 03:45:17 +04:00
Andrey Vlasovskikh
c16d83ceab Handle '<nop>' in mappings 2014-04-05 00:25:54 +04:00
Andrey Vlasovskikh
a7820f4fd0 More special keys of Vim '<>' notation 2014-04-05 00:15:11 +04:00
Andrey Vlasovskikh
12dd338914 Fixed parsing lowercase characters in keystrokes with modifiers 2014-04-04 23:51:58 +04:00
Andrey Vlasovskikh
720d552a21 Renamed VimrcParser and VimrcCommandHandler to VimScript* 2014-04-04 22:22:25 +04:00
Andrey Vlasovskikh
a0477f499b Added new ':source' command handler 2014-04-04 22:21:22 +04:00
Andrey Vlasovskikh
20a4639995 Show error messages after Ex exceptions where possible 2014-04-04 22:20:18 +04:00
Andrey Vlasovskikh
3d7a0e7917 Modify and re-register shortcut set required by Vim emulation after ':map' 2014-04-04 21:09:29 +04:00
Andrey Vlasovskikh
c9c1295001 Cleanup 2014-04-04 17:49:45 +04:00
Andrey Vlasovskikh
c93daf78f6 Unify ':map' and ':noremap' handlers 2014-04-04 17:35:59 +04:00
Andrey Vlasovskikh
c77812d2a8 Refactored MapHandler to be more declarative 2014-04-04 17:31:16 +04:00
Andrey Vlasovskikh
c7107b7ad7 Reuse MappingInfo for rows of key mapping table 2014-04-04 16:54:41 +04:00
Andrey Vlasovskikh
a9a28b259f Made MappingInfo comparable 2014-04-04 16:48:15 +04:00
Andrey Vlasovskikh
5f1a1d0aa0 Show non-recursive mapping status in the output of 'map' 2014-04-04 16:46:40 +04:00
Andrey Vlasovskikh
2f5dd3f2b1 'map!' is not supported yet 2014-04-04 16:36:06 +04:00
Andrey Vlasovskikh
779909bdeb Added support for 'noremap' commands 2014-04-04 16:35:11 +04:00
Andrey Vlasovskikh
e76bee2afa Add 'recursive' flag to key mapping info 2014-04-04 16:30:41 +04:00
Andrey Vlasovskikh
bb9d551dad Extracted logic from MapHandler to KeyGroup 2014-04-04 16:21:56 +04:00
Andrey Vlasovskikh
db6399f1c5 Added test for recursive key mapping 2014-04-04 15:39:20 +04:00
Andrey Vlasovskikh
32ee6be7f9 Fixed displaying 'map' NVO mapping code 2014-04-04 00:29:52 +04:00
Andrey Vlasovskikh
33a5dd9e1c Allow commands that start with ':' in .vimrc 2014-04-04 00:21:05 +04:00
Andrey Vlasovskikh
0c59182eb8 Show modes code for mappings 2014-04-04 00:15:57 +04:00
Andrey Vlasovskikh
391e14a05b Output sorted map results 2014-04-04 00:09:52 +04:00
Andrey Vlasovskikh
c3259faf42 Don't read .vimrc during unit testing 2014-04-03 23:45:31 +04:00
Andrey Vlasovskikh
f588e473a1 Use unit test friendly ExOutputModel instead of ExOutputPanel 2014-04-03 23:19:14 +04:00
Andrey Vlasovskikh
a076b4d71c Renamed MorePanel to ExOutputPanel 2014-04-03 22:58:45 +04:00
Andrey Vlasovskikh
4540c75498 Made MorePanel.activate() private 2014-04-03 22:52:42 +04:00
Andrey Vlasovskikh
239199462f Removed unnecessary MorePanel.isActive() check 2014-04-03 22:52:00 +04:00
Andrey Vlasovskikh
b703a7eabb Show MorePanel on every MorePanel.setText() instead of showing it explicitly after Ex commands 2014-04-03 22:49:54 +04:00
Andrey Vlasovskikh
3cafe72f8f Removed unused code 2014-04-03 22:29:57 +04:00
Andrey Vlasovskikh
48375c37de Removed unnecessary logging 2014-04-03 19:05:19 +04:00
Andrey Vlasovskikh
f9ceb506d7 Don't store editor's content component 2014-04-03 19:03:47 +04:00
Andrey Vlasovskikh
a7a054f4e4 Use EditorHelper.getScreenWidth() instead of MorePanel.getDisplayWidth() 2014-04-03 18:57:43 +04:00
Andrey Vlasovskikh
f8781353a2 Made MorePanel per-editor based 2014-04-03 17:41:22 +04:00
Andrey Vlasovskikh
b0760222f0 Cleanup 2014-04-03 17:12:09 +04:00
Andrey Vlasovskikh
66bcacc2c4 Show mappings in Ex output panel 2014-04-02 17:40:22 +04:00
Andrey Vlasovskikh
5868f8a2a5 Renamed pad() to rightJustify() 2014-04-02 13:41:06 +04:00
Andrey Vlasovskikh
8e54e24e03 Show not implemented message for show mappings command instead of an exception 2014-04-02 13:28:29 +04:00
Andrey Vlasovskikh
f511e6ea34 Set default editor font for Ex and More panels on every activation 2014-04-02 13:17:17 +04:00
Andrey Vlasovskikh
6c9608a9ee Prettier border for Ex entry panel 2014-04-02 13:07:20 +04:00
Andrey Vlasovskikh
4a0f95f0f0 Removed aliases 2014-04-02 12:55:01 +04:00
Andrey Vlasovskikh
e3e7bcffa0 Added more mapping commands for various modes 2014-04-02 12:54:15 +04:00
Andrey Vlasovskikh
9340208c2c Handle unknown special keys as simple key sequences 2014-04-02 02:12:08 +04:00
Andrey Vlasovskikh
a658b8d8bd Handle unfinished special keys as simple key sequences 2014-04-02 02:05:57 +04:00
Andrey Vlasovskikh
0b9946eaf9 Handle '\' at the end of the mapping as regular '\' 2014-04-02 01:55:35 +04:00
Andrey Vlasovskikh
6ea255f125 Reset key mappings for each test 2014-04-02 01:54:26 +04:00
Andrey Vlasovskikh
0225975e20 Backslash is an escape character only for '\' and '<' 2014-04-02 01:43:20 +04:00
Andrey Vlasovskikh
af406c7d14 Execute key mapping commands from .vimrc 2014-04-02 00:40:46 +04:00
Andrey Vlasovskikh
a146e2c303 Prevented sharing DataContext between Swing events 2014-04-02 00:40:02 +04:00
Andrey Vlasovskikh
f285051a9a Merge remote-tracking branch 'origin/map-commands' into map-commands 2014-04-02 00:29:20 +04:00
Andrey Vlasovskikh
936f7e5d7c Modularized .vimrc parsing a bit 2014-04-02 00:23:35 +04:00
Andrey Vlasovskikh
463c8defa4 Added 'timeoutlen' option 2014-04-01 17:15:50 +04:00
Andrey Vlasovskikh
19f0399f28 Added 'imap' to mapping commands table
It's now possible to try ':imap jj <Esc>' at runtime. Reading mappings
from .vimrc is not supported yet.
2014-04-01 00:42:43 +04:00
Andrey Vlasovskikh
05436427ee Very initial key mapping support 2014-04-01 00:20:13 +04:00
Andrey Vlasovskikh
2f6d4c9ff2 Spelling and naming conventions 2014-03-31 22:50:46 +04:00
Andrey Vlasovskikh
64790c531e Removed unused logging and debug info 2014-03-31 22:44:07 +04:00
Andrey Vlasovskikh
9c209d2fb2 Sorted methods and attributes 2014-03-31 22:42:25 +04:00
Andrey Vlasovskikh
8420ca355b Nullity annotations 2014-03-31 15:44:15 +04:00
Andrey Vlasovskikh
0aebcbd71e Nullity annotations for CommandHandler.execute() 2014-03-31 15:27:40 +04:00
Andrey Vlasovskikh
13528667c8 Moved command index to the root of the package 2014-03-31 14:27:02 +04:00
Andrey Vlasovskikh
3b3fa3a455 Split configureByText() and typeText() 2014-03-28 16:38:41 +04:00
Andrey Vlasovskikh
13d3d4e990 Unified running Ex commands in tests with the usual key handling 2014-03-28 16:30:06 +04:00
Andrey Vlasovskikh
b69d475e15 Removed legacy CDATA-based XML serializer 2014-03-26 18:48:08 +04:00
Andrey Vlasovskikh
b6f840aacb Use StringBuilder instead of StringBuffer 2014-03-26 18:45:56 +04:00
Andrey Vlasovskikh
ea454d3c07 Use parseKeys() instead of stringToKeys() in tests 2014-03-26 18:44:57 +04:00
Andrey Vlasovskikh
fb72d5d782 Parse <C-x> and some special keys 2014-03-26 18:44:33 +04:00
Andrey Vlasovskikh
d4b8c09b02 Fixed broken <Enter> in inplace editors, e.g. refactorings and live templates 2014-03-26 16:48:29 +04:00
Andrey Vlasovskikh
254339037b Merged KeyParser into KeyGroup 2014-03-26 14:36:04 +04:00
Andrey Vlasovskikh
800e3a3012 Moved shortcut conflicts state to new KeyGroup 2014-03-26 14:16:34 +04:00
Andrey Vlasovskikh
44a5021786 Updated changelist 2014-03-26 13:33:25 +04:00
Andrey Vlasovskikh
db80629cbb Add build number string to plugin description 2014-03-26 13:20:46 +04:00
Andrey Vlasovskikh
1c3a1c132b Don't include logo into plugin.xml 2014-03-26 13:17:10 +04:00
Andrey Vlasovskikh
751831f3b7 Include build number in archive name 2014-03-26 13:14:32 +04:00
Andrey Vlasovskikh
d226d58e38 Changed build number for developer builds to 'dev' 2014-03-26 13:14:11 +04:00
Andrey Vlasovskikh
230364ac87 Removed unused code 2014-03-26 01:49:01 +04:00
Andrey Vlasovskikh
9df61bba7e Mentioned the active keymap in the shortcut conflicts title 2014-03-26 01:43:48 +04:00
Andrey Vlasovskikh
9ee1910a01 Set up Vim handler by default and show notifications on the first use 2014-03-26 01:18:35 +04:00
Andrey Vlasovskikh
46e10e1599 Changed table column sizes 2014-03-26 01:17:52 +04:00
Andrey Vlasovskikh
ed29f7c1db Don't use sticky balloons 2014-03-26 00:57:38 +04:00
Andrey Vlasovskikh
60f4c7b02e Configurable shortcut conflicts in Vim Emulation settings 2014-03-25 22:58:36 +04:00
Andrey Vlasovskikh
5616723fa4 Read-only table of shortcut conflicts 2014-03-25 20:06:05 +04:00
Andrey Vlasovskikh
724698df08 Moved getKeymapConflicts() to KeyParser 2014-03-25 19:58:01 +04:00
Andrey Vlasovskikh
9bdb99d948 Initial Vim Emulation configurable with empty Shortcut Conflicts table 2014-03-25 18:16:37 +04:00
Andrey Vlasovskikh
efc340a37a Reordered methods 2014-03-23 19:52:00 +04:00
Andrey Vlasovskikh
58548a39d3 Removed obsolete TODO item 2014-03-23 19:49:31 +04:00
Andrey Vlasovskikh
638a205b6c Fixed loading of saved shortcut conflicts settings 2014-03-23 19:49:01 +04:00
Andrey Vlasovskikh
3031dbc600 Detect shortcut conflicts between Vim emulation and IDE keymap 2014-03-23 19:48:20 +04:00
Andrey Vlasovskikh
36dcb53e14 Cleanup 2014-03-23 15:35:16 +04:00
Andrey Vlasovskikh
1a94f4f12f Deprecated old action registration 2014-03-22 16:32:45 +04:00
Andrey Vlasovskikh
d87a241e34 Typo 2014-03-22 16:05:30 +04:00
Andrey Vlasovskikh
ddd28c9a44 Cleanup and minor refactorings 2014-03-22 15:49:50 +04:00
Andrey Vlasovskikh
9637edf30e Some docs 2014-03-22 15:44:24 +04:00
Andrey Vlasovskikh
b0a5e6d375 Don't reserve any shortcuts before implementing actual actions that use them 2014-03-22 15:33:33 +04:00
Andrey Vlasovskikh
6bec99b631 Moved and renamed KeyAction to VimShortcutKeyAction 2014-03-22 15:32:12 +04:00
Andrey Vlasovskikh
a95b65067d Switched from EditorActionHandler substitution to registering custom shortcut sets for Vim-enabled editors 2014-03-22 15:29:04 +04:00
Andrey Vlasovskikh
ac5c176deb Nullity annotations for ChangeEditorActionHandler 2014-03-20 23:30:46 +04:00
Andrey Vlasovskikh
5d385eb26d Added parseKeysSet() helper 2014-03-20 22:43:29 +04:00
Andrey Vlasovskikh
611620555f Initial version of shortcut conflicts settings 2014-03-20 19:38:38 +04:00
Andrey Vlasovskikh
d44412c712 Don't require a custom "Vim" keymap any longer
Keyboard shortcut conflicts aren't handled yet.
2014-03-20 18:18:43 +04:00
Andrey Vlasovskikh
761719fffd Made VisualToggleCharacterModeAction a VimCommandAction 2014-03-20 16:46:53 +04:00
Andrey Vlasovskikh
3015a4a8a2 Initial version of Vim notation typed characters parsing 2014-03-20 15:58:04 +04:00
Andrey Vlasovskikh
e8f579bf74 Added Vim actions index with Javadoc links 2014-03-20 14:39:42 +04:00
Andrey Vlasovskikh
f8da48f61d Added VimCommandAction base class for simplifying action registration 2014-03-20 14:17:14 +04:00
Andrey Vlasovskikh
5b21015f5b Inlined action handler 2014-03-20 13:27:34 +04:00
Andrey Vlasovskikh
326d62d815 Renamed Mapping to MappingMode 2014-03-20 13:24:03 +04:00
Andrey Vlasovskikh
f5f6c92e59 Removed unused class 2014-03-19 19:56:57 +04:00
Andrey Vlasovskikh
b56654c217 Removed unused actionId field 2014-03-19 19:37:02 +04:00
Andrey Vlasovskikh
f5e8572a73 Replaced mapping int codes with Mapping enum 2014-03-19 19:34:32 +04:00
Andrey Vlasovskikh
95a395ed70 Moved Vim operation groups accessors to VimPlugin
VimPlugin now acts as a facade to Vim operations.
2014-03-19 18:29:42 +04:00
Andrey Vlasovskikh
c08c122ea6 Reordered methods 2014-03-19 17:55:25 +04:00
Andrey Vlasovskikh
95460df473 Reformat 2014-03-19 17:37:29 +04:00
Andrey Vlasovskikh
ab489faa56 Some overrides and deprecations 2014-03-19 17:35:39 +04:00
Andrey Vlasovskikh
48e49fe92d Renamed AbstractEditorActionHandler to EditorActionHandlerBase 2014-03-19 16:46:48 +04:00
Andrey Vlasovskikh
441a296bde No abstract classes for no reason 2014-03-19 16:42:23 +04:00
Andrey Vlasovskikh
7359ed74ad Moved some actions to com.maddyhome.vim.action package 2014-03-19 16:35:22 +04:00
Andrey Vlasovskikh
dd56ec6b4c Removed unused MakeTags CLI utility 2014-03-19 16:33:44 +04:00
Andrey Vlasovskikh
2d271008f3 Flattened com.intellij.idea.vim.handler.* package 2014-03-19 16:32:38 +04:00
Andrey Vlasovskikh
d06340ac3c Inlined ResetModeHandler 2014-03-19 16:30:41 +04:00
Andrey Vlasovskikh
f9a67c5180 Removed unused classes 2014-03-19 16:29:35 +04:00
Andrey Vlasovskikh
b4cce0980a Removed practically unused ActionGroup and AbstractActionGroup interfaces 2014-03-19 16:26:12 +04:00
Andrey Vlasovskikh
4a7557c5ba Don't reset visual mode after some IntelliJ actions that operate on selections
These actions are: comment by block/line comment, surround with /
surround with template, move statement up/down.

The reason is simplification of action handling as a step towards
keymap-less IdeaVim configuration.
2014-03-19 14:55:08 +04:00
Andrey Vlasovskikh
4e84f056aa Renamed KeyParser.registerAction() to KeyParser.registerIdeaAction() 2014-03-17 16:17:38 +04:00
Andrey Vlasovskikh
68f938d476 Don't override completion and live templates actions
This requires reconfiguring the Vim keymap.
2014-03-17 14:06:02 +04:00
Alex Selesse
6a7135d2bc VIM-439: Implement :sort command.
- Supports "n", "i" and "!" arguments.
2014-02-06 08:43:55 -05:00
Andrey Vlasovskikh
58ab3ab1bb Added Ira Klotzko to the contributors list 2013-12-06 17:09:41 +04:00
ik
78beef71ce Merge remote-tracking branch 'upstream/master' 2013-12-04 13:41:41 -05:00
ik
b05892e97d VIM-528
Change annotations to reflect that pp (CharPointer) is Nullable
Create check that if pp (CharPointer) is Nullable, code that could result in an NPE (NullPointerException) is not executed
Update the added tests' comments to reflect that they are for VIM-528
2013-12-02 10:42:27 -05:00
ik
f71e24d17e VIM-528 and VIM-459
These 2 cases (duplicates) are fixed with this commit
Additionally, there are a couple of new test cases for search groups and substitutions.
2013-11-18 14:33:06 -05:00
Andrey Vlasovskikh
3968e7741f Added 'Where to start' for contributors 2013-11-18 20:42:41 +04:00
521 changed files with 24023 additions and 10882 deletions

3
.gitignore vendored
View File

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

View File

@@ -141,11 +141,8 @@
</indentOptions>
</codeStyleSettings>
<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="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" 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_THROWS_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="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
@@ -165,12 +161,9 @@
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_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="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" 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="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
@@ -227,6 +220,10 @@
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="JSP">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
@@ -259,7 +256,6 @@
</codeStyleSettings>
<codeStyleSettings language="Python">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="SQL">
@@ -277,4 +273,3 @@
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</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

@@ -22,6 +22,36 @@ Contributors:
* [poxu](mailto:poxvuibr@gmail.com)
* [Alexander Zolotov](mailto:alexander.zolotov@jetbrains.com)
* [John Lindquist](mailto:johnlindquist@gmail.com)
* [Ira Klotzko](mailto:iklotzko@ltech.com)
* [Alex Selesse](mailto:alex@selesse.com)
* [Dathan Bennett](mailto:dbennett@palantir.com)
* [salaam](mailto:kphayen@gmail.com)
* [Alexey Shmalko](mailto:rasen.dubi@gmail.com)
* [Andrew Brookins](mailto:a.m.brookins@gmail.com)
* [Chang Wang](mailto:changwang83@gmail.com)
* [Jaime Sanchez](mailto:josejaime.sanchez@gmail.com)
* [Thomas B Homburg](mailto:thomas@homburg.dk)
* [smartbomb](mailto:smartbomb@server.fake)
* [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)
If you are a contributor and your name is not listed here, feel free to
contact the maintainer.

View File

@@ -4,6 +4,315 @@ The Changelog
History of changes in IdeaVim for the IntelliJ platform.
Get an Early Access
-------------------
Would you like to try new features and fixes? Join the Early Access Program and
receive EAP builds as updates! Add this URL to "Settings | Plugins |
Browse Repositories | Manage Repositories":
[https://plugins.jetbrains.com/plugins/eap/ideavim](https://plugins.jetbrains.com/plugins/eap/ideavim)
It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
To Be Released
--------------
...
0.50, 2018-10-18
----------------
Moved "Vim Emulation" settings into "File | Settings | Vim Emulation". Support
for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>` (put `set
multiple-cursors` into your ~/.ideavimrc to enable it). Support for running
Vim commands for multiple cursors. Various bug fixes.
* [VIM-634](https://youtrack.jetbrains.com/issue/VIM-634) Support for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
* [VIM-780](https://youtrack.jetbrains.com/issue/VIM-780) Support for running Vim commands for multiple cursors
* [VIM-176](https://youtrack.jetbrains.com/issue/VIM-176) Fixed arrow key navigation in Run/Debug tool windows
* [VIM-339](https://youtrack.jetbrains.com/issue/VIM-339) Fixed `<Esc>` in diff windows
* [VIM-862](https://youtrack.jetbrains.com/issue/VIM-862) Allow `:action` to work in visual mode
* [VIM-1110](https://youtrack.jetbrains.com/issue/VIM-1110) Put the caret in correct place after `I` in visual block mode
* [VIM-1329](https://youtrack.jetbrains.com/issue/VIM-1329) Request focus reliably for Ex entry and output panels
* [VIM-1368](https://youtrack.jetbrains.com/issue/VIM-1368) Wait for focus reliably before running an `:action`
* [VIM-1379](https://youtrack.jetbrains.com/issue/VIM-1379) Fixed `I` for short lines in visual block mode
* [VIM-1380](https://youtrack.jetbrains.com/issue/VIM-1380) Fixed `cw` with count at the end of a word
* [VIM-1404](https://youtrack.jetbrains.com/issue/VIM-1404) Fixed the ability to use `:e#` when editor tabs are hidden
* [VIM-1431](https://youtrack.jetbrains.com/issue/VIM-1431) Fixed pasting text into the empty document
* [VIM-1427](https://youtrack.jetbrains.com/issue/VIM-1427) Added the support for count to the `it` and `at` motions
* [VIM-1287](https://youtrack.jetbrains.com/issue/VIM-1287) Fixed `i(` actions inside string literals
* [VIM-1317](https://youtrack.jetbrains.com/issue/VIM-1317) Don't run Undo/Redo inside write actions
* [VIM-1366](https://youtrack.jetbrains.com/issue/VIM-1366) Don't wrap a secondary event loop for `input()` into a write action
* [VIM-1274](https://youtrack.jetbrains.com/issue/VIM-1274) Correctly process escaping when `smartcase` is on
0.49, 2017-12-12
----------------
Enabled zero-latency typing for Vim emulation. Added support for `iskeyword` option. Various bug fixes.
* [VIM-1254](https://youtrack.jetbrains.com/issue/VIM-1254) Enable zero-latency typing for Vim emulation
* [VIM-1367](https://youtrack.jetbrains.com/issue/VIM-1367) Support `iskeyword` option
* [VIM-523](https://youtrack.jetbrains.com/issue/VIM-523) Fixed global mark remembering only the line number
0.48, 2017-01-15
----------------
A bugfix release.
Bug fixes:
* [VIM-1205](https://youtrack.jetbrains.com/issue/VIM-1205) Don't move key handling into separate event for raw handlers
* [VIM-1216](https://youtrack.jetbrains.com/issue/VIM-1216) Fixed `.` resetting the last find movement while repeating change that also uses movement
Features:
* Support for zero-latency rendering
0.47, 2016-10-19
----------------
A bugfix release.
Bug fixes:
* VIM-1098 Don't start visual selection when mouse click was actually drag over single character
* VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
0.46, 2016-07-07
----------------
Added `incsearch` option for incremental search. Added support for `it` and
`at` tag block selection. Added `vim-surround` commands `ys`, `cs`, `ds`,
`S`. Various bug fixes.
Features:
* VIM-769 Added `vim-surround` commands `ys`, `cs`, `ds`, `S`
* VIM-264 Added tag block selection
* VIM-271 Added `incsearch` option for showing search results while typing
* VIM-217 Added support for `={motion}` formatting command
Bug fixes:
* VIM-796 Fixed focus issues with `:action` command
* VIM-581 Fixed use of special registers `0`-`9` and `-` in delete commands
* VIM-965 Fixed exception in `[m` in some file types
* VIM-564 Fixed `g_` move to go to the current line
* VIM-964 Fixed marks behavior when the whole line got deleted
* VIM-259 Move caret to the line beginning after `==`
* VIM-246 Fixed `{count}==` formatting
* VIM-287 Fixed insert new line before and after folds
* VIM-139 Focus on current search and use modal confirmation for `:s///gc`
* VIM-843 Don't highlight search results after restart
* VIM-1126 Fixed warning about modifying shortcuts of global actions for 2016.2
0.44, 2015-11-02
----------------
A bugfix release.
* VIM-1040 Fixed typing keys in completion menus and typing with the
plugin disabled
0.43, 2015-11-02
----------------
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
----------------
A bugfix release.
Bug fixes:
* VIM-848 Show line numbers if they are enabled in the settings and there is
no `set number`
* VIM-702 Fix infinite loop on `s/$/\r/g`
* EA-63022 Don't update line numbers in the caret movement event listener
0.38, 2014-12-01
----------------
Added support for `number` and `relativenumber` options, `clipboard=unnamed`
option. Added `:action` and `:actionlist` commands for executing arbitrary
IDE actions. Various bug fixes.
Features:
* VIM-476 Added support for `clipboard=unnamed` option
* VIM-410 Added support for `relativenumber` option
* VIM-483 Added support for `number` option
* VIM-652 Added `:action` and `:actionlist` commands for executing arbitrary
IDE actions
Bug fixes:
* VIM-818 Enable key repeat on Mac OS X every time it gets reset by the OS
* VIM-624 Deselect visual selection range on opening the Ex entry field
* VIM-511 Fixed editing offset after `<BS>` for `.` command
* VIM-792 Fixed line-wise and block-wise paste commands for `*` and `+`
registers
* VIM-501 Fixed off-by-1 error in visual block-wise selection
* VIM-613 Fixed repeat after `d$`
* VIM-705 Fixed repeated multiline indent
* VIM-567 Fixed `:!` to allow running non-filter commands
* VIM-536 Fixed `cc` on the second-to-last line
* VIM-515 Fixed `cW` command detecting end-of-word incorrectly
* VIM-794 Fixed NCDFE related to 'number' in IDEs other than IntelliJ
* VIM-771 Fix semicolon repeat for 'till char' motion
* VIM-723 Fix pasting to an empty line
0.37, 2014-10-15
----------------
A bugfix release.
Bug fixes:
* VIM-784 Fixed visual line selection where the start of the selection range
was greater than its end
* VIM-407 Fixed `>>` to work if a line contains only one character
0.36, 2014-10-14
----------------
Added support for common window splitting and navigation commands. Various bug
fixes.
Features:
* VIM-171 Window `<C-W>` commands: split, close, next/previous windows,
left/right/up/down windows
* VIM-265 Window `:split` and `:vsplit` commands
Bug fixes:
* VIM-632 Restored visual block mode that was broken due to multiple carets support
* VIM-770 Close the current tab on `:quit` instead of all tabs with the current
file
* VIM-569 Fixed `<C-W>` when the caret is at the end of a line
0.35, 2014-05-15
----------------
The `~/.vimrc` initialization file is no longer read by default, use
`~/.ideavimrc` instead.
Features:
* VIM-690 Read initialization commands only from `~/.ideavimrc`
Bug fixes:
* VIM-676 Handle control characters in `.ideavimrc` as pressed, not typed
keystrokes
* VIM-679 Parse characters less than U+0020 as `<C-$CHAR>`
* VIM-683 Allow `<C-PageUp>`/`<C-PagDown>` to be used outside of Vim emulation
* VIM-646 Don't update the visual selection if a command moves the caret and exits
the visual mode
* VIM-213 Use `'<` and `'>` marks for saving and restoring the last visual
selection
0.34, 2014-04-29
----------------
A bugfix release.
Bug fixes:
* VIM-674 Don't handle `<Tab>` in Insert mode in Vim emulation
* VIM-672 Ignore mappings that contain `<Plug>` and `<SID>`
* VIM-670 First character of a recursive mapping shouldn't be mapped again
* VIM-666 Support `<Bar>` in Vim key notation
* VIM-666 Ignore characters after `|` in `:map` commands
* VIM-667 Ignore potentially nested lines of .vimrc based on leading whitespace
0.33, 2014-04-28
----------------
Added support for `:map` key mapping commands. New keyboard shortcuts handler
that doesn't require a separate keymap for Vim emulation. Added support for
`:source` and `:sort` commands.
Features:
* VIM-288 Support for `:map` key mapping commands
* VIM-543 Allow granular enable/disable of Vim shortcut keys
* VIM-643 Support for `:source` command
* VIM-439 Support for `:sort` command
Bug fixes:
* VIM-528 Search and replace with grouping no longer works
* VIM-281 Don't disable global reformat code action for Vim emulation
0.32, 2013-11-15
----------------

232
README.md
View File

@@ -1,16 +1,36 @@
IdeaVim
=======
IdeaVim is a Vim emulation plug-in for IDEs based on the IntelliJ platform.
IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm,
AppCode and Android Studio.
<div>
<a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
<img src="http://jb.gg/badges/official.svg" alt="official JetBrains project"/>
</a>
</div>
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Build&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Build)/statusIcon.svg?guest=1"/>
</a>
<span>Build<span>
</div>
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20182&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20182)/statusIcon.svg?guest=1"/>
</a>
<span>Tests</span>
</div>
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ platform.
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
RubyMine, AppCode, DataGrip, GoLand, Cursive, and Android Studio.
Resources:
* [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)
* [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=IdeaVim)
* [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=IdeaVim&guest=1)
* [@IdeaVim](http://twitter.com/ideavim) in Twitter
@@ -22,9 +42,30 @@ 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.
If you wish to disable the plugin, select the "Tools | Vim Emulator" menu so
it is unchecked. At this point IDE will work with it's regular keyboard
it is unchecked. At this point your IDE will work with its regular keyboard
shortcuts.
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
Keymap" on Linux & Windows, and by "Preferences | Editor | Vim Emulation",
"Preferences | Keymap" on macOS. They can also be resolved by key mapping
commands in your ~/.ideavimrc file.
Get an Early Access
-------------------
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
---------------------------------
@@ -39,22 +80,67 @@ Supported:
* Undo/redo
* Visual mode 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
* Key mappings
* Macros
* Digraphs
* Command line and search history
* Window commands
* Vim web help
Emulated Vim plugins:
* vim-surround
* vim-multiple-cursors
Not supported (yet):
* Key mappings
* Window commands
* Jump lists
* Various less used commands
Please see the file [index.txt](https://github.com/JetBrains/ideavim/blob/master/index.txt)
for a list of commands covered with tests.
See also:
* [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)
Files
-----
* ~/.ideavimrc
* Your IdeaVim-specific Vim initialization commands
You can read your ~/.vimrc file from ~/.ideavimrc using this command:
source ~/.vimrc
Note, that IdeaVim currently parses ~/.ideavimrc file via simple pattern matching,
see [VIM-669](http://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
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
@@ -64,100 +150,89 @@ Changes to the IDE
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
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).
### Escape
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 normal mode. In some dialog windows the normal mode is on by default. The
usage of the Vim emulator in dialog windows is an area for improvements.
the Vim emulator is put into the insert mode with `<Esc>` not working. You
should use `<C-c>` or `<C-[>` instead. In some dialog windows the normal mode is
on by default. The usage of the Vim emulator in dialog windows is an area for
improvements.
### Menu Changes
See also [unresolved escape issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
In order to emulate the keystrokes used by Vim, several of the default hotkeys
used by the IDE had to be changed. Below is a list of IDE menus, their default
keyboard shortcuts, and their new VIM keystrokes.
### Executing IDE Actions
File
Save All Ctrl-S :w
IdeaVim adds two commands for listing and executing arbitrary IDE actions as
Ex commands or via `:map` command mappings:
Edit
Undo Ctrl-Z u
Redo Ctrl-Shift-Z Ctrl-R
Cut Ctrl-X "+x
Copy Ctrl-C "+y
Paste Ctrl-V "+P
Select All Ctrl-A ggVG
* `:actionlist [pattern]`
* Find IDE actions by name pattern
* `:action {name}`
* Execute an action named `NAME`
Search
Find Ctrl-F /
Replace Ctrl-R :s
Find Next F3 n
Find Previous Shift-F3 N
For example, here `\r` is mapped to the Reformat Code action:
View
Quick JavaDoc Ctrl-Q K
Parameter Info Ctrl-P Ctrl-Shift-P
Swap Panels Ctrl-U <None>
Recent Files... Ctrl-E <None>
Type Hierarchy Ctrl-H Ctrl-Alt-Shift-H
Goto
Class... Ctrl-N Alt-Shift-N
Line... Ctrl-G G
Declaration Ctrl-B gd
Super Method Ctrl-U Ctrl-Shift-U
Code
Override Methods... Ctrl-O Ctrl-Shift-O
Implement Methods... Ctrl-I Ctrl-Shift-I
Complete Code (Only in Insert mode)
Basic Ctrl-Space Ctrl-Space or Ctrl-N or Ctrl-P
Smart Type Ctrl-Shift-Space Ctrl-Shift-Space
Class Name Ctrl-Alt-Space Ctrl-Alt-Space
Insert Live Template Ctrl-J Ctrl-]
Tools
Version Control
Check In Project Ctrl-K <None>
:map \r :action ReformatCode<CR>
Development
-----------
Contributing
------------
### Where to Start
In order to contribute to IdeaVim you should have some understanding of Java.
See also these docs on the IntelliJ API:
* [IntelliJ architectural overview](http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Architectural+Overview)
* [IntelliJ plugin development resources](http://confluence.jetbrains.com/display/IDEADEV/PluginDevelopment)
You can start by picking relatively simple tasks that are tagged with
[#patch_welcome](http://youtrack.jetbrains.com/issues/VIM?q=%23patch_welcome)
in the issue tracker.
### Development Environment
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
2. Open the project in IntelliJ IDEA 12+ (Community or Ultimate) using "File |
Open... | /path/to/ideavim".
2. Import the project from existing sources in IntelliJ IDEA 2018.1 or newer (Community or
Ultimate) using "File | New | Project from Existing Sources..." or "Import
Project" from the start window.
3. Set up a JDK if you haven't got it yet. Use "File | Project Structure | SDKs
| Add new JDK".
* In the project wizard select "Import project from external model | Gradle"
4. Set up an IntelliJ plugin SDK using "File | Project Structure | SDKs | Add
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.
* Select your Java 8+ JDK as the Gradle JVM, leave other parameters unchanged
5. Select a project SDK for your project using "File | Project Structure |
Project | Project SDK". Choose the plugin SDK you have created at the
previous step.
3. Run your IdeaVim plugin within IntelliJ via a Gradle task
6. Build IdeaVim and run IntelliJ with IdeaVim enabled using the "IdeaVim" run
configuration (use "Run | Run... | IdeaVim").
* Select "View | Tool Windows | Gradle" tool window
7. In order to be able to run tests in your IntelliJ edition uncomment the
appropriate lines in the constructor of the `VimTestCase` class.
* Launch "ideavim | intellij | runIde" from the tool window
4. Run IdeaVim tests via a Gradle task
* 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
-------
See [AUTHORS.md](https://github.com/JetBrains/ideavim/blob/master/AUTHORS.md)
See [AUTHORS.md](AUTHORS.md)
for a list of authors and contributors.
@@ -165,4 +240,3 @@ License
-------
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)
publishPlugin {
channels publishChannels.split(',')
username publishUsername
password publishPassword
}
}
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlinVersion"
}

View File

@@ -1,4 +0,0 @@
version-id:0.32
platform-version:120.0
idea.download.url=http://download.jetbrains.com/idea/ideaIU-12.1.zip
build.number=x

182
build.xml
View File

@@ -1,182 +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="keymap" value="${basedir}/resources/Vim.xml"/>
<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}"/>
</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 file="${keymap}" todir="${build}/IdeaVim"/>
<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}.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"/>
<copy file="${keymap}" todir="${build}/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

@@ -1,15 +1,21 @@
List of Supported Set Commands
==============================
The following `:set` commands can appear in `~/.vimrc` or set manually in the command mode:
The following `:set` commands can appear in `~/.ideavimrc` or set manually in the command mode:
'clipboard' 'cb' clipboard options
'digraph' 'dg' enable the entering of digraphs in Insert mode
'gdefault' 'gd' the ":substitute" flag 'g' is default on
'history' 'hi' number of command-lines that are remembered
'hlsearch' 'hls' highlight matches with last search pattern
'ignorecase' 'ic' ignore case in search patterns
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
'incsearch' 'is' show where search pattern typed so far matches
'matchpairs' 'mps' pairs of characters that "%" can match
'nrformats' 'nf' number formats recognized for CTRL-A command
'number' 'nu' print the line number in front of each line
'relativenumber' 'rnu' show the line number relative to the line with
the cursor
'scroll' 'scr' lines to scroll with CTRL-U and CTRL-D
'scrolljump' 'sj' minimum number of lines to scroll
'scrolloff' 'so' minimum nr. of lines above and below cursor
@@ -18,6 +24,9 @@ The following `:set` commands can appear in `~/.vimrc` or set manually in the co
'sidescroll' 'ss' minimum number of columns to scroll horizontal
'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor
'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
'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
'wrapscan' 'ws' searches wrap around the end of the file

9
gradle.properties Normal file
View File

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

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

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,61 +1,52 @@
<idea-plugin url="http://plugins.jetbrains.com/plugin/164">
<name>IdeaVim</name>
<id>IdeaVIM</id>
<change-notes>
<![CDATA[
<p>0.32:</p>
<change-notes><![CDATA[
<p>0.50:</p>
<ul>
<li>Fixed API compatibility with IntelliJ platform builds 132.1052+</li>
<li>Moved "Vim Emulation" settings into "File | Settings | Editor"</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 running Vim commands for multiple cursors</li>
<li>The <a href="https://github.com/JetBrains/ideavim/blob/master/src/com/maddyhome/idea/vim/package-info.java">index of supported commands</a> on the GitHub page</li>
<li>Various bug fixes</li>
</ul>
<p>0.31:</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>
<li>Various bug fixes</li>
</ul>
<p>0.30:</p>
<p>0.47:</p>
<ul>
<li>Support for a separate <code>.ideavimrc</code> config file</li>
<li>Fixed long-standing issues with merged undo/redo commands and <code>&lt;Esc&gt;</code> during completion</li>
<li>Various bug fixes</li>
</ul>
<p>0.29:</p>
<p>0.46:</p>
<ul>
<li>Fixed repeat buffer limits</li>
<li>Enable normal <code>&lt;Enter&gt;</code> handling for one-line editors</li>
<li>Don't move cursor while scrolling</li>
</ul>
<p>0.28:</p>
<ul>
<li>Fixed reconfigure Vim keymap for user-defined base keymaps</li>
<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>
</ul>
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
]]>
</change-notes>
<description>
<![CDATA[
<p>Vim emulation plug-in for IDEs based on the IntelliJ platform. IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm, AppCode and Android Studio.</p>
<p>Supported functionality:</p>
]]></change-notes>
<description><![CDATA[
<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>See also:</p>
<ul>
<li>Motion keys</li>
<li>Deletion/Changing</li>
<li>Insert mode commands</li>
<li>Marks</li>
<li>Registers</li>
<li>Undo/redo</li>
<li>Visual mode commands</li>
<li>Some Ex commands</li>
<li>Some :set options</li>
<li>Full Vim regexps for search and search/replace</li>
<li>Macros</li>
<li>Digraphs</li>
<li>Command line and search history</li>
<li>Vim web help</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>: feature requests and bug reports</li>
</ul>
]]>
</description>
<version>@VERSION@</version>
<vendor logo="/icons/vim16x16.png">JetBrains</vendor>
]]></description>
<version>SNAPSHOT</version>
<vendor>JetBrains</vendor>
<idea-version since-build="@SINCE-VERSION@"/>
<idea-version since-build="181.0"/>
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
<depends>com.intellij.modules.lang</depends>
@@ -67,18 +58,24 @@
</component>
</application-components>
<extensionPoints>
<extensionPoint qualifiedName="IdeaVIM.vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
</extensions>
<extensions defaultExtensionNs="IdeaVIM">
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
</extensions>
<actions>
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.VimPluginToggleAction" text="Vim Emulator" description="Toggle the Vim Plugin On/Off">
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.action.VimPluginToggleAction" text="Vim Emulator" description="Toggle the Vim Plugin On/Off">
<keyboard-shortcut first-keystroke="control alt V" keymap="$default"/>
<add-to-group group-id="ToolsMenu" anchor="last"/>
</action>
<action id="VimReconfigureKeymap" class="com.maddyhome.idea.vim.VimReconfigureKeymapAction" text="Reconfigure Vim Keymap" description="Reconfigure Vim keymap">
<add-to-group group-id="ToolsMenu" relative-to-action="after VimPluginToggle"/>
</action>
<!-- Motions -->
<action id="VimMotionPreviousTab" class="com.maddyhome.idea.vim.action.motion.tabs.MotionPreviousTabAction" text="Move to Previous Tab"/>
@@ -157,6 +154,7 @@
<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="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="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"/>
@@ -164,6 +162,7 @@
<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="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="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"/>
@@ -181,7 +180,6 @@
<!-- Screen -->
<action id="VimMotionFirstScreenLine" class="com.maddyhome.idea.vim.action.motion.screen.MotionFirstScreenLineAction" text="First Screen Line"/>
<action id="VimMotionLastScreenLine" class="com.maddyhome.idea.vim.action.motion.screen.MotionLastScreenLineAction" text="Last Screen Line"/>
<action id="VimMotionLastScreenLineEnd" class="com.maddyhome.idea.vim.action.motion.screen.MotionLastScreenLineEndAction" text="Last Screen Line End"/>
<action id="VimMotionMiddleScreenLine" class="com.maddyhome.idea.vim.action.motion.screen.MotionMiddleScreenLineAction" text="Middle Screen Line"/>
<!-- Scroll -->
<action id="VimMotionScrollFirstScreenLinePageStart" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenLinePageStartAction" text="Scroll Line to Top"/>
@@ -209,7 +207,7 @@
<action id="VimVisualToggleBlockMode" class="com.maddyhome.idea.vim.action.motion.visual.VisualToggleBlockModeAction" text="Toggle Block Selection"/>
<action id="VimVisualSwapEnds" class="com.maddyhome.idea.vim.action.motion.visual.VisualSwapEndsAction" text="Swap Visual Selection Ends"/>
<action id="VimVisualSwapEndsBlock" class="com.maddyhome.idea.vim.action.motion.visual.VisualSwapEndsBlockAction" text="Swap Visual Selection Ends"/>
<action id="VimVisualSelectPrevious" class="com.maddyhome.idea.vim.action.motion.visual.VisualSelectPreviousAction" text="Swap Visual Selection Ends"/>
<action id="VimVisualSelectPrevious" class="com.maddyhome.idea.vim.action.motion.visual.VisualSelectPreviousAction" text="Visual Select Previous"/>
<action id="VimVisualSwapSelections" class="com.maddyhome.idea.vim.action.motion.visual.VisualSwapSelectionsAction" text="Swap Visual Selection Ends"/>
<!-- Insert -->
@@ -224,7 +222,6 @@
<action id="VimInsertDeletePreviousWord" class="com.maddyhome.idea.vim.action.change.insert.InsertDeletePreviousWordAction" text="Delete Previous Word"/>
<action id="VimInsertEnter" class="com.maddyhome.idea.vim.action.change.insert.InsertEnterAction" text="Enter"/>
<action id="VimInsertExitMode" class="com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction" text="Exit Insert Mode"/>
<action id="VimInsertHelp" class="com.maddyhome.idea.vim.action.change.insert.InsertHelpAction" text="Help"/>
<action id="VimInsertLineStart" class="com.maddyhome.idea.vim.action.change.insert.InsertLineStartAction" text="Insert at Line Start"/>
<action id="VimInsertNewLineAbove" class="com.maddyhome.idea.vim.action.change.insert.InsertNewLineAboveAction" text="Insert New Line Above"/>
<action id="VimInsertNewLineBelow" class="com.maddyhome.idea.vim.action.change.insert.InsertNewLineBelowAction" text="Insert New Line Below"/>
@@ -274,17 +271,12 @@
<action id="VimFilterMotion" class="com.maddyhome.idea.vim.action.change.change.FilterMotionAction" text="Filter Lines"/>
<action id="VimFilterCountLines" class="com.maddyhome.idea.vim.action.change.change.FilterCountLinesAction" text="Filter Lines"/>
<action id="VimFilterVisualLines" class="com.maddyhome.idea.vim.action.change.change.FilterVisualLinesAction" text="Filter Visual Lines"/>
<action id="VimAutoIndentVisual" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Auto Indent Selection"/>
<action id="VimReformatVisual" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Reformat Selection"/>
<action id="VimCommentByBlockComment" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Block Comment"/>
<action id="VimCommentByLineComment" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Line Comment"/>
<action id="VimSurroundWith" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Surround With"/>
<action id="VimSurroundWithLiveTemplate" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Surround With Live Template"/>
<action id="VimMoveStatementDown" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Move Statement Down"/>
<action id="VimMoveStatementUp" class="com.maddyhome.idea.vim.action.visual.VisualOperatorDelegateAction" text="Move Statement Up"/>
<action id="VimAutoIndentVisual" class="com.maddyhome.idea.vim.action.change.change.AutoIndentLinesVisualAction" text="Auto Indent Selection"/>
<action id="VimReformatVisual" class="com.maddyhome.idea.vim.action.change.change.ReformatCodeVisualAction" text="Reformat Selection"/>
<!-- Shift -->
<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="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"/>
@@ -316,6 +308,18 @@
<action id="VimFileGetFileInfo" class="com.maddyhome.idea.vim.action.file.FileGetFileInfoAction" text="Get File Info"/>
<action id="VimFileGetLocationInfo" class="com.maddyhome.idea.vim.action.file.FileGetLocationInfoAction" text="Get Location Info"/>
<!-- Window -->
<action id="VimWindowSplitVertical" class="com.maddyhome.idea.vim.action.window.VerticalSplitAction" text="Split window vertically"/>
<action id="VimWindowSplitHorizontal" class="com.maddyhome.idea.vim.action.window.HorizontalSplitAction" text="Split window horizontally"/>
<action id="VimWindowClose" class="com.maddyhome.idea.vim.action.window.CloseWindowAction" text="Close current window"/>
<action id="VimWindowOnly" class="com.maddyhome.idea.vim.action.window.WindowOnlyAction" text="Close all windows except current"/>
<action id="VimWindowNext" class="com.maddyhome.idea.vim.action.window.WindowNextAction" text="Select next window"/>
<action id="VimWindowPrev" class="com.maddyhome.idea.vim.action.window.WindowPrevAction" text="Select previous window"/>
<action id="VimWindowLeft" class="com.maddyhome.idea.vim.action.window.WindowLeftAction" text="Go to left window"/>
<action id="VimWindowRight" class="com.maddyhome.idea.vim.action.window.WindowRightAction" text="Go to right window"/>
<action id="VimWindowUp" class="com.maddyhome.idea.vim.action.window.WindowUpAction" text="Go to window up"/>
<action id="VimWindowDown" class="com.maddyhome.idea.vim.action.window.WindowDownAction" text="Go to window down"/>
<!-- Search -->
<action id="VimSearchFwdEntry" class="com.maddyhome.idea.vim.action.motion.search.SearchEntryFwdAction" text="Search Forward"/>
<action id="VimSearchRevEntry" class="com.maddyhome.idea.vim.action.motion.search.SearchEntryRevAction" text="Search Backward"/>
@@ -348,30 +352,8 @@
<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="VimClassNameCompletion" class="com.maddyhome.idea.vim.action.OriginalDelegateAction" text="Class Name Completion"/>
<action id="VimCodeCompletion" class="com.maddyhome.idea.vim.action.OriginalDelegateAction" text="Code Completion"/>
<action id="VimSmartTypeCompletion" class="com.maddyhome.idea.vim.action.OriginalDelegateAction" text="Smart Type Completion"/>
<action id="VimWordCompletion" class="com.maddyhome.idea.vim.action.OriginalDelegateAction" text="Word Completion"/>
<action id="VimInsertLiveTemplate" class="com.maddyhome.idea.vim.action.OriginalDelegateAction" text="Insert Live Template"/>
<!-- Keys -->
<action id="VimKeyHandler" class="com.maddyhome.idea.vim.action.key.KeyAction" text="Keys"/>
<action id="VimDummyHandler" class="com.maddyhome.idea.vim.action.key.DummyAction" text="Keys"/>
<action id="VimNotImplementedHandler" class="com.maddyhome.idea.vim.action.key.NotImplementedAction" text="Reserved For Future Use"/>
<action id="VimEditorBackSpace" class="com.maddyhome.idea.vim.action.key.BackSpaceAction" text="Backspace"/>
<action id="VimEditorDelete" class="com.maddyhome.idea.vim.action.key.DeleteAction" text="Delete"/>
<action id="VimEditorDown" class="com.maddyhome.idea.vim.action.key.DownAction" text="Down"/>
<action id="VimEditorEnter" class="com.maddyhome.idea.vim.action.key.EnterAction" text="Enter"/>
<action id="VimEditorEscape" class="com.maddyhome.idea.vim.action.key.EscapeAction" text="Escape"/>
<action id="VimEditorLeft" class="com.maddyhome.idea.vim.action.key.LeftAction" text="Left"/>
<action id="VimEditorLineEnd" class="com.maddyhome.idea.vim.action.key.LineEndAction" text="LineEnd"/>
<action id="VimEditorLineStart" class="com.maddyhome.idea.vim.action.key.LineStartAction" text="LineStart"/>
<action id="VimEditorPageDown" class="com.maddyhome.idea.vim.action.key.PageDownAction" text="PageDown"/>
<action id="VimEditorPageUp" class="com.maddyhome.idea.vim.action.key.PageUpAction" text="PageUp"/>
<action id="VimEditorRight" class="com.maddyhome.idea.vim.action.key.RightAction" text="Right"/>
<action id="VimEditorTab" class="com.maddyhome.idea.vim.action.key.TabAction" text="Tab"/>
<action id="VimEditorToggleInsertState" class="com.maddyhome.idea.vim.action.key.ToggleInsertStateAction" text="Insert/Overwrite"/>
<action id="VimEditorUp" class="com.maddyhome.idea.vim.action.key.UpAction" text="Up"/>
<action id="VimDigraphEntry" class="com.maddyhome.idea.vim.action.key.KeyAction" text="Digraph Entry"/>
<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>
</idea-plugin>

View File

@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<keymap version="1" name="Vim" disable-mnemonics="false" parent="$default">
<action id="VimKeyHandler">
<keyboard-shortcut first-keystroke="control 2" />
<keyboard-shortcut first-keystroke="control A" />
<keyboard-shortcut first-keystroke="control alt SPACE" />
<keyboard-shortcut first-keystroke="control B" />
<keyboard-shortcut first-keystroke="control BACK_SLASH" />
<keyboard-shortcut first-keystroke="control C" />
<keyboard-shortcut first-keystroke="control CLOSE_BRACKET" />
<keyboard-shortcut first-keystroke="control D" />
<keyboard-shortcut first-keystroke="control E" />
<keyboard-shortcut first-keystroke="control END" />
<keyboard-shortcut first-keystroke="control F" />
<keyboard-shortcut first-keystroke="control G" />
<keyboard-shortcut first-keystroke="control H" />
<keyboard-shortcut first-keystroke="control HOME" />
<keyboard-shortcut first-keystroke="control I" />
<keyboard-shortcut first-keystroke="control J" />
<keyboard-shortcut first-keystroke="control K" />
<keyboard-shortcut first-keystroke="control L" />
<keyboard-shortcut first-keystroke="control LEFT" />
<keyboard-shortcut first-keystroke="control M" />
<keyboard-shortcut first-keystroke="control O" />
<keyboard-shortcut first-keystroke="control OPEN_BRACKET" />
<keyboard-shortcut first-keystroke="control P" />
<keyboard-shortcut first-keystroke="control PAGE_DOWN" />
<keyboard-shortcut first-keystroke="control PAGE_UP" />
<keyboard-shortcut first-keystroke="control Q" />
<keyboard-shortcut first-keystroke="control R" />
<keyboard-shortcut first-keystroke="control RIGHT" />
<keyboard-shortcut first-keystroke="control S" />
<keyboard-shortcut first-keystroke="control SPACE" />
<keyboard-shortcut first-keystroke="control T" />
<keyboard-shortcut first-keystroke="control U" />
<keyboard-shortcut first-keystroke="control V" />
<keyboard-shortcut first-keystroke="control W" />
<keyboard-shortcut first-keystroke="control X" />
<keyboard-shortcut first-keystroke="control Y" />
<keyboard-shortcut first-keystroke="control Z" />
<keyboard-shortcut first-keystroke="KP_DOWN" />
<keyboard-shortcut first-keystroke="KP_LEFT" />
<keyboard-shortcut first-keystroke="KP_RIGHT" />
<keyboard-shortcut first-keystroke="KP_UP" />
<keyboard-shortcut first-keystroke="shift control 2" />
<keyboard-shortcut first-keystroke="shift control SPACE" />
<keyboard-shortcut first-keystroke="shift DOWN" />
<keyboard-shortcut first-keystroke="shift LEFT" />
<keyboard-shortcut first-keystroke="shift RIGHT" />
<keyboard-shortcut first-keystroke="shift UP" />
</action>
</keymap>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

View File

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

View File

@@ -0,0 +1,127 @@
/*
* 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;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.actionSystem.TypedAction;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.event.*;
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerListener;
import com.intellij.util.messages.MessageBusConnection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
/**
* @author vlan
*/
public class EventFacade {
@NotNull private static final EventFacade ourInstance = new EventFacade();
@Nullable private TypedActionHandler myOriginalTypedActionHandler;
private EventFacade() {
}
@NotNull
public static EventFacade getInstance() {
return ourInstance;
}
public void addProjectManagerListener(@NotNull ProjectManagerListener listener) {
ProjectManager.getInstance().addProjectManagerListener(listener);
}
public void setupTypedActionHandler(@NotNull TypedActionHandler handler) {
final TypedAction typedAction = getTypedAction();
myOriginalTypedActionHandler = typedAction.getRawHandler();
typedAction.setupRawHandler(handler);
}
public void restoreTypedActionHandler() {
if (myOriginalTypedActionHandler != null) {
getTypedAction().setupRawHandler(myOriginalTypedActionHandler);
}
}
public void registerCustomShortcutSet(@NotNull AnAction action, @NotNull ShortcutSet shortcutSet,
@Nullable JComponent component) {
action.registerCustomShortcutSet(shortcutSet, component);
}
public void unregisterCustomShortcutSet(@NotNull AnAction action, @Nullable JComponent component) {
action.unregisterCustomShortcutSet(component);
}
public void addFileEditorManagerListener(@NotNull Project project, @NotNull FileEditorManagerListener listener) {
final MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener);
}
public void addDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
document.addDocumentListener(listener);
}
public void removeDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
document.removeDocumentListener(listener);
}
public void addEditorFactoryListener(@NotNull EditorFactoryListener listener, @NotNull Disposable parentDisposable) {
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
}
public void addEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
editor.addEditorMouseListener(listener);
}
public void removeEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
editor.removeEditorMouseListener(listener);
}
public void addEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
editor.addEditorMouseMotionListener(listener);
}
public void removeEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
editor.removeEditorMouseMotionListener(listener);
}
public void addEditorSelectionListener(@NotNull Editor editor, @NotNull SelectionListener listener) {
editor.getSelectionModel().addSelectionListener(listener);
}
public void removeEditorSelectionListener(@NotNull Editor editor, @NotNull SelectionListener listener) {
editor.getSelectionModel().removeSelectionListener(listener);
}
@NotNull
private TypedAction getTypedAction() {
return EditorActionManager.getInstance().getTypedAction();
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -22,21 +22,25 @@ import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.project.Project;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.extension.VimExtensionHandler;
import com.maddyhome.idea.vim.group.RegisterGroup;
import com.maddyhome.idea.vim.helper.DelegateCommandListener;
import com.maddyhome.idea.vim.helper.DigraphSequence;
import com.maddyhome.idea.vim.helper.EditorHelper;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.helper.RunnableHelper;
import com.maddyhome.idea.vim.helper.StringHelper;
import com.maddyhome.idea.vim.key.*;
import com.maddyhome.idea.vim.option.Options;
import org.jetbrains.annotations.NotNull;
@@ -91,6 +95,26 @@ public class KeyHandler {
return origHandler;
}
/**
* Invoked before acquiring a write lock and actually handling the keystroke.
*
* Drafts an optional {@link ActionPlan} that will be used as a base for zero-latency rendering in editor.
*
* @param editor The editor the key was typed into
* @param key The keystroke typed by the user
* @param context The data context
* @param plan The current action plan
*/
public void beforeHandleKey(@NotNull Editor editor, @NotNull KeyStroke key,
@NotNull DataContext context, @NotNull ActionPlan plan) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
if (mode == CommandState.Mode.INSERT || mode == CommandState.Mode.REPLACE) {
VimPlugin.getChange().beforeProcessKey(editor, context, key, plan);
}
}
/**
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
* processing.
@@ -100,30 +124,40 @@ public class KeyHandler {
* @param context The data context
*/
public void handleKey(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context) {
handleKey(editor, key, context, true);
}
public void handleKey(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
boolean allowKeyMappings) {
VimPlugin.clearError();
// All the editor actions should be performed with top level editor!!!
// Be careful: all the EditorActionHandler implementation should correctly process InjectedEditors
editor = InjectedLanguageUtil.getTopLevelEditor(editor);
final CommandState editorState = CommandState.getInstance(editor);
final boolean isRecording = editorState.isRecording();
boolean shouldRecord = true;
// If this is a "regular" character keystroke, get the character
char chKey = key.getKeyChar() == KeyEvent.CHAR_UNDEFINED ? 0 : key.getKeyChar();
if (isEditorReset(key, editorState)) {
handleEditorReset(editor, key, context);
}
// At this point the user must be typing in a command. Most commands can be preceded by a number. Let's
// check if a number can be entered at this point, and if so, did the user send us a digit.
else if (isCommandCount(editorState, chKey)) {
final boolean isRecording = editorState.isRecording();
boolean shouldRecord = true;
// Check for command count before key mappings - otherwise e.g. ':map 0 ^' breaks command counts that contain a zero
if (isCommandCount(editorState, chKey)) {
// Update the count
count = count * 10 + (chKey - '0');
}
else if (allowKeyMappings && handleKeyMapping(editor, key, context)) {
return;
}
// 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)) {
// "Remove" the last digit sent to us
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.
// 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) {
@@ -154,22 +188,22 @@ public class KeyHandler {
// If this is an argument node then the last keystroke was not part of the current command but should
// be the first keystroke of the argument of the current command
else if (node instanceof ArgumentNode) {
shouldRecord = handleArgumentNode(editor, key, context, editorState, true, (ArgumentNode)node);
shouldRecord = handleArgumentNode(editor, key, context, editorState, (ArgumentNode)node);
}
else {
if (lastWasBS && lastChar != 0 && Options.getInstance().isSet("digraph")) {
char dig = CommandGroups.getInstance().getDigraph().getDigraph(lastChar, key.getKeyChar());
char dig = VimPlugin.getDigraph().getDigraph(lastChar, key.getKeyChar());
key = KeyStroke.getKeyStroke(dig);
}
// If we are in insert/replace mode send this key in for processing
if (editorState.getMode() == CommandState.Mode.INSERT || editorState.getMode() == CommandState.Mode.REPLACE) {
if (!CommandGroups.getInstance().getChange().processKey(editor, context, key)) {
if (!VimPlugin.getChange().processKey(editor, context, key)) {
shouldRecord = false;
}
}
else if (editorState.getMappingMode() == KeyParser.MAPPING_CMD_LINE) {
if (!CommandGroups.getInstance().getProcess().processExKey(editor, key, true)) {
else if (editorState.getMappingMode() == MappingMode.CMD_LINE) {
if (!VimPlugin.getProcess().processExKey(editor, key)) {
shouldRecord = false;
}
}
@@ -188,7 +222,7 @@ public class KeyHandler {
executeCommand(editor, key, context, editorState);
}
else if (state == State.BAD_COMMAND) {
if (editorState.getMappingMode() == KeyParser.MAPPING_OP_PEND) {
if (editorState.getMappingMode() == MappingMode.OP_PENDING) {
editorState.popState();
}
else {
@@ -202,23 +236,123 @@ public class KeyHandler {
fullReset(editor);
}
else if (isRecording && shouldRecord) {
CommandGroups.getInstance().getRegister().recordKeyStroke(key);
VimPlugin.getRegister().recordKeyStroke(key);
}
}
private boolean handleKeyMapping(@NotNull final Editor editor, @NotNull final KeyStroke key,
@NotNull final DataContext context) {
final CommandState commandState = CommandState.getInstance(editor);
commandState.stopMappingTimer();
final List<KeyStroke> mappingKeys = commandState.getMappingKeys();
final List<KeyStroke> fromKeys = new ArrayList<KeyStroke>(mappingKeys);
fromKeys.add(key);
final MappingMode mappingMode = commandState.getMappingMode();
if (MappingMode.NVO.contains(mappingMode) && (state != State.NEW_COMMAND || currentArg != Argument.Type.NONE)) {
return false;
}
final KeyMapping mapping = VimPlugin.getKey().getKeyMapping(mappingMode);
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)) {
mappingKeys.add(key);
if (!application.isUnitTestMode() && Options.getInstance().isSet(Options.TIMEOUT)) {
commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
mappingKeys.clear();
if (editor.isDisposed()) {
return;
}
for (KeyStroke keyStroke : fromKeys) {
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
}
}, ModalityState.stateForComponent(editor.getComponent())));
}
return true;
}
else if (mappingInfo != null) {
mappingKeys.clear();
final Runnable handleMappedKeys = new Runnable() {
@Override
public void run() {
if (editor.isDisposed()) {
return;
}
final List<KeyStroke> toKeys = mappingInfo.getToKeys();
final VimExtensionHandler extensionHandler = mappingInfo.getExtensionHandler();
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);
}
}
};
if (application.isUnitTestMode()) {
handleMappedKeys.run();
}
else {
application.invokeLater(handleMappedKeys);
}
return true;
}
else {
final List<KeyStroke> unhandledKeys = new ArrayList<KeyStroke>(mappingKeys);
mappingKeys.clear();
for (KeyStroke keyStroke : unhandledKeys) {
handleKey(editor, keyStroke, context, false);
}
return false;
}
}
private static <T> boolean isPrefix(@NotNull List<T> list1, @NotNull List<T> list2) {
if (list1.size() > list2.size()) {
return false;
}
for (int i = 0; i < list1.size(); i++) {
if (!list1.get(i).equals(list2.get(i))) {
return false;
}
}
return true;
}
private void handleEditorReset(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull final DataContext context) {
if (state != State.COMMAND && count == 0 && currentArg == Argument.Type.NONE && currentCmd.size() == 0 &&
CommandGroups.getInstance().getRegister().getCurrentRegister() == RegisterGroup.REGISTER_DEFAULT) {
if (state != State.COMMAND && count == 0 && currentArg == Argument.Type.NONE && currentCmd.size() == 0) {
RegisterGroup register = VimPlugin.getRegister();
if (register.getCurrentRegister() == register.getDefaultRegister()) {
if (key.getKeyCode() == KeyEvent.VK_ESCAPE) {
CommandProcessor.getInstance().executeCommand(editor.getProject(), new Runnable() {
@Override
public void run() {
KeyHandler.executeAction("VimEditorEscape", context);
KeyHandler.executeAction("EditorEscape", context);
}
}, "", null);
}
VimPlugin.indicateError();
}
}
reset(editor);
}
@@ -237,9 +371,7 @@ public class KeyHandler {
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
return (editorState.getMode() == CommandState.Mode.COMMAND || state == State.COMMAND) &&
(key.getKeyCode() == KeyEvent.VK_ESCAPE ||
(key.getKeyCode() == KeyEvent.VK_C && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0) ||
(key.getKeyCode() == '[' && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0));
StringHelper.isCloseKeyStroke(key);
}
private void handleCharArgument(@NotNull KeyStroke key, char chKey) {
@@ -301,7 +433,6 @@ public class KeyHandler {
private void executeCommand(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
@NotNull CommandState editorState) {
DelegateCommandListener.getInstance().setRunnable(null);
// Let's go through the command stack and merge it all into one command. At this time there should never
// be more than two commands on the stack - one is the actual command and the other would be a motion
// command argument needed by the first command
@@ -328,8 +459,7 @@ public class KeyHandler {
}
// If we were in "operator pending" mode, reset back to normal mode.
if (editorState.getMappingMode() == KeyParser.MAPPING_OP_PEND) {
//CommandState.getInstance().setMappingMode(KeyParser.MAPPING_NORMAL);
if (editorState.getMappingMode() == MappingMode.OP_PENDING) {
editorState.popState();
}
@@ -339,28 +469,29 @@ public class KeyHandler {
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
Project project = editor.getProject();
if (cmd.getType().isRead() || project == null || EditorHelper.canEdit(project, editor)) {
final Command.Type type = cmd.getType();
if (type.isWrite() && !editor.getDocument().isWritable()) {
VimPlugin.indicateError();
reset(editor);
}
if (ApplicationManager.getApplication().isDispatchThread()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
String name = cmd.getAction().getTemplatePresentation().getText();
name = name != null ? "Vim " + name : "";
if (cmd.getType().isWrite()) {
if (type.isWrite()) {
RunnableHelper.runWriteCommand(project, action, name, action);
}
else {
else if (type.isRead()) {
RunnableHelper.runReadCommand(project, action, name, action);
}
}
}
else {
VimPlugin.indicateError();
reset(editor);
CommandProcessor.getInstance().executeCommand(project, action, name, action);
}
}
}
private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
@NotNull CommandState editorState, boolean shouldRecord,
@NotNull ArgumentNode node) {
@NotNull CommandState editorState, @NotNull ArgumentNode node) {
// Create a new command based on what the user has typed so far, excluding this keystroke.
Command cmd = new Command(count, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
@@ -378,8 +509,7 @@ public class KeyHandler {
// Is the current command an operator? If so set the state to only accept "operator pending"
// commands
if ((node.getFlags() & Command.FLAG_OP_PEND) != 0) {
//CommandState.getInstance().setMappingMode(KeyParser.MAPPING_OP_PEND);
editorState.pushState(editorState.getMode(), editorState.getSubMode(), KeyParser.MAPPING_OP_PEND);
editorState.pushState(editorState.getMode(), editorState.getSubMode(), MappingMode.OP_PENDING);
}
break;
case EX_STRING:
@@ -395,9 +525,9 @@ public class KeyHandler {
if (currentArg != Argument.Type.NONE) {
partialReset(editor);
handleKey(editor, key, context);
shouldRecord = false; // Prevent this from getting recorded twice
return false;
}
return shouldRecord;
return true;
}
private void handleCommandNode(@NotNull Editor editor, @NotNull DataContext context, @NotNull CommandNode node) {
@@ -424,7 +554,7 @@ public class KeyHandler {
}
}
else if (currentArg == Argument.Type.EX_STRING && (node.getFlags() & Command.FLAG_COMPLETE_EX) != 0) {
String text = CommandGroups.getInstance().getProcess().endSearchCommand(editor, context);
String text = VimPlugin.getProcess().endSearchCommand(editor, context);
Argument arg = new Argument(text);
Command cmd = currentCmd.peek();
cmd.setArgument(arg);
@@ -465,10 +595,10 @@ public class KeyHandler {
}
if (arg.getArgType() == Argument.Type.EX_STRING) {
CommandGroups.getInstance().getProcess().startSearchCommand(editor, context, count, key);
VimPlugin.getProcess().startSearchCommand(editor, context, count, key);
state = State.NEW_COMMAND;
currentArg = Argument.Type.EX_STRING;
editorState.pushState(CommandState.Mode.EX_ENTRY, CommandState.SubMode.NONE, KeyParser.MAPPING_CMD_LINE);
editorState.pushState(CommandState.Mode.EX_ENTRY, CommandState.SubMode.NONE, MappingMode.CMD_LINE);
}
}
}
@@ -479,12 +609,10 @@ public class KeyHandler {
* @param name The name of the action to execute
* @param context The context to run it in
*/
public static void executeAction(@NotNull String name, @NotNull DataContext context) {
public static boolean executeAction(@NotNull String name, @NotNull DataContext context) {
ActionManager aMgr = ActionManager.getInstance();
AnAction action = aMgr.getAction(name);
if (action != null) {
executeAction(action, context);
}
return action != null && executeAction(action, context);
}
/**
@@ -493,16 +621,20 @@ public class KeyHandler {
* @param action The action to execute
* @param context The context to run it in
*/
public static void executeAction(@NotNull AnAction action, @NotNull DataContext context) {
public static boolean executeAction(@NotNull AnAction action, @NotNull DataContext context) {
// Hopefully all the arguments are sufficient. So far they all seem to work OK.
// We don't have a specific InputEvent so that is null
// What is "place"? Leave it the empty string for now.
// Is the template presentation sufficient?
// What are the modifiers? Is zero OK?
action.actionPerformed(
new AnActionEvent(null, context, "", action.getTemplatePresentation(), ActionManager.getInstance(),
// API change - don't merge
0));
final AnActionEvent event = new AnActionEvent(null, context, "", action.getTemplatePresentation(),
ActionManager.getInstance(), 0);
action.update(event);
if (event.getPresentation().isEnabled()) {
action.actionPerformed(event);
return true;
}
return false;
}
/**
@@ -515,7 +647,9 @@ public class KeyHandler {
count = 0;
keys = new ArrayList<KeyStroke>();
CommandState editorState = CommandState.getInstance(editor);
editorState.setCurrentNode(KeyParser.getInstance().getKeyRoot(editorState.getMappingMode()));
editorState.stopMappingTimer();
editorState.getMappingKeys().clear();
editorState.setCurrentNode(VimPlugin.getKey().getKeyRoot(editorState.getMappingMode()));
}
/**
@@ -543,8 +677,7 @@ public class KeyHandler {
reset(editor);
lastChar = 0;
lastWasBS = false;
CommandGroups.getInstance().getRegister().resetRegister();
DelegateCommandListener.getInstance().setRunnable(null);
VimPlugin.getRegister().resetRegister();
}
/**
@@ -564,7 +697,7 @@ public class KeyHandler {
executeAction(cmd.getAction(), context);
if (editorState.getMode() == CommandState.Mode.INSERT || editorState.getMode() == CommandState.Mode.REPLACE) {
CommandGroups.getInstance().getChange().processCommand(editor, cmd);
VimPlugin.getChange().processCommand(editor, cmd);
}
// Now that the command has been executed let's clean up a few things.
@@ -572,7 +705,7 @@ public class KeyHandler {
// By default the "empty" register is used by all commands so we want to reset whatever the last register
// selected by the user was to the empty register - unless we just executed the "select register" command.
if (cmd.getType() != Command.Type.SELECT_REGISTER) {
CommandGroups.getInstance().getRegister().resetRegister();
VimPlugin.getRegister().resetRegister();
}
// If, at this point, we are not in insert, replace, or visual modes, we need to restore the previous
@@ -587,14 +720,14 @@ public class KeyHandler {
KeyHandler.getInstance().reset(editor);
if (wasRecording && editorState.isRecording()) {
CommandGroups.getInstance().getRegister().recordKeyStroke(key);
VimPlugin.getRegister().recordKeyStroke(key);
}
}
private Editor editor;
private DataContext context;
private Command cmd;
private KeyStroke key;
private final Editor editor;
private final DataContext context;
private final Command cmd;
private final KeyStroke key;
}
private static enum State {
@@ -608,7 +741,7 @@ public class KeyHandler {
private int count;
private List<KeyStroke> keys;
private State state;
@NotNull private Stack<Command> currentCmd = new Stack<Command>();
@NotNull private final Stack<Command> currentCmd = new Stack<Command>();
@NotNull private Argument.Type currentArg;
private TypedActionHandler origHandler;
@Nullable private DigraphSequence digraph = null;

File diff suppressed because it is too large Load Diff

View File

@@ -1,240 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.google.common.base.Joiner;
import com.google.common.io.Files;
import com.google.common.io.Resources;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.impl.stores.StorageUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.keymap.impl.KeymapImpl;
import com.intellij.openapi.keymap.impl.KeymapManagerImpl;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.maddyhome.idea.vim.ui.VimKeymapDialog;
import org.jdom.Document;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import static com.google.common.io.ByteStreams.toByteArray;
/**
* @author oleg
*/
public class VimKeyMapUtil {
private static final Joiner PATH_JOINER = Joiner.on(File.separatorChar);
public static final String VIM_KEYMAP_NAME = "Vim";
private static final String VIM_XML = "Vim.xml";
private static final String KEYMAPS_PATH = PATH_JOINER.join(PathManager.getConfigPath(), "keymaps");
private static final String INSTALLED_VIM_KEYMAP_PATH = PATH_JOINER.join(KEYMAPS_PATH, VIM_XML);
private static Logger LOG = Logger.getInstance(VimKeyMapUtil.class);
public static boolean isVimKeymapInstalled() {
return KeymapManager.getInstance().getKeymap(VIM_KEYMAP_NAME) != null;
}
/**
* @return true if keymap was installed or was successfully installed
*/
public static boolean installKeyBoardBindings() {
LOG.debug("Check for keyboard bindings");
final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
if (localFileSystem.refreshAndFindFileByPath(KEYMAPS_PATH) == null) {
reportError("Failed to install vim keymap. Empty keymaps folder");
return false;
}
LOG.debug("No vim keyboard installed found. Installing");
try {
final byte[] bytes = toByteArray(retrieveSourceKeymapStream());
Files.write(bytes, new File(INSTALLED_VIM_KEYMAP_PATH));
final Document document = StorageUtil.loadDocument(bytes);
if (document != null && !ApplicationManager.getApplication().isUnitTestMode()) {
// Prompt user to select the parent for the Vim keyboard
if (!configureVimParentKeymap(INSTALLED_VIM_KEYMAP_PATH, document, true)) {
return false;
}
}
installKeymap(document);
} catch (IOException e) {
reportError("Source keymap not found", e);
return false;
} catch (InvalidDataException e) {
reportError("Failed to install vim keymap. Vim.xml file is corrupted", e);
return false;
} catch (Exception e) {
reportError("Failed to install vim keymap.\n", e);
return false;
}
return true;
}
private static void installKeymap(@Nullable Document document) throws InvalidDataException {
if (document == null) {
throw new InvalidDataException();
}
final KeymapImpl vimKeyMap = new KeymapImpl();
final KeymapManagerImpl keymapManager = (KeymapManagerImpl) KeymapManager.getInstance();
final Keymap[] allKeymaps = keymapManager.getAllKeymaps();
vimKeyMap.readExternal(document.getRootElement(), allKeymaps);
keymapManager.addKeymap(vimKeyMap);
}
/**
* Changes parent keymap for the Vim
*
* @return true if document was changed successfully
*/
private static boolean configureVimParentKeymap(final String path, @NotNull final Document document,
final boolean showNotification)
throws IOException, InvalidDataException {
final Element rootElement = document.getRootElement();
final String parentKeymapName = rootElement.getAttributeValue("parent");
final VimKeymapDialog vimKeymapDialog = new VimKeymapDialog(parentKeymapName);
vimKeymapDialog.show();
if (vimKeymapDialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
return false;
}
rootElement.removeAttribute("parent");
final Keymap parentKeymap = vimKeymapDialog.getSelectedKeymap();
final String keymapName = parentKeymap.getName();
VimKeymapConflictResolveUtil.resolveConflicts(rootElement, parentKeymap);
// We cannot set a user-defined modifiable keymap as the parent of our Vim keymap so we have to copy its shortcuts
if (parentKeymap.canModify()) {
final KeymapImpl vimKeyMap = new KeymapImpl();
final KeymapManager keymapManager = KeymapManager.getInstance();
final KeymapManagerImpl keymapManagerImpl = (KeymapManagerImpl)keymapManager;
final Keymap[] allKeymaps = keymapManagerImpl.getAllKeymaps();
vimKeyMap.readExternal(rootElement, allKeymaps);
final HashSet<String> ownActions = new HashSet<String>(Arrays.asList(vimKeyMap.getOwnActionIds()));
final KeymapImpl parentKeymapImpl = (KeymapImpl)parentKeymap;
for (String parentAction : parentKeymapImpl.getOwnActionIds()) {
if (!ownActions.contains(parentAction)) {
final List<Shortcut> shortcuts = Arrays.asList(parentKeymap.getShortcuts(parentAction));
rootElement.addContent(VimKeymapConflictResolveUtil.createActionElement(parentAction, shortcuts));
}
}
final Keymap grandParentKeymap = parentKeymap.getParent();
rootElement.setAttribute("parent", grandParentKeymap.getName());
}
else {
rootElement.setAttribute("parent", keymapName);
}
VimPlugin.getInstance().setPreviousKeyMap(keymapName);
// Save modified keymap to the file
JDOMUtil.writeDocument(document, path, "\n");
if (showNotification) {
Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
"Successfully configured vim keymap to be based on " +
parentKeymap.getPresentableName(),
NotificationType.INFORMATION));
}
return true;
}
public static boolean isVimKeymapUsed() {
return KeymapManager.getInstance().getActiveKeymap().getName().equals(VIM_KEYMAP_NAME);
}
/**
* @return true if keymap was switched successfully, false otherwise
*/
public static boolean switchKeymapBindings(final boolean enableVimKeymap) {
LOG.debug("Enabling keymap");
// In case if Vim keymap is already in use or we don't need it, we have nothing to do
if (isVimKeymapUsed() == enableVimKeymap) {
return false;
}
final KeymapManagerImpl manager = (KeymapManagerImpl) KeymapManager.getInstance();
// Get keymap to enable
final String keymapName2Enable = enableVimKeymap ? VIM_KEYMAP_NAME : VimPlugin.getInstance().getPreviousKeyMap();
if (keymapName2Enable.isEmpty()) {
return false;
}
if (keymapName2Enable.equals(manager.getActiveKeymap().getName())) {
return false;
}
LOG.debug("Enabling keymap:" + keymapName2Enable);
final Keymap keymap = manager.getKeymap(keymapName2Enable);
if (keymap == null) {
reportError("Failed to enable keymap: " + keymapName2Enable);
return false;
}
// Save previous keymap to enable after VIM emulation is turned off
if (enableVimKeymap) {
VimPlugin.getInstance().setPreviousKeyMap(manager.getActiveKeymap().getName());
}
manager.setActiveKeymap(keymap);
final String keyMapPresentableName = keymap.getPresentableName();
Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
keyMapPresentableName + " keymap was successfully enabled", NotificationType.INFORMATION));
LOG.debug(keyMapPresentableName + " keymap was successfully enabled");
return true;
}
@NotNull
private static InputStream retrieveSourceKeymapStream() throws IOException {
String keymapPath = PATH_JOINER.join(PathManager.getPluginsPath(), VimPlugin.IDEAVIM_NOTIFICATION_TITLE, VIM_XML);
try {
return new FileInputStream(keymapPath);
} catch (FileNotFoundException e) {
if (ApplicationManager.getApplication().isInternal()) {
LOG.debug("Development mode on. Trying to retrieve source keymap from resources");
return Resources.getResource(VimKeyMapUtil.class, "/" + VIM_XML).openStream();
}
throw e;
}
}
private static void reportError(final String message) {
reportError(message, null);
}
private static void reportError(final String message, @Nullable final Exception e) {
LOG.error(message, e);
Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
message + String.valueOf(e), NotificationType.ERROR));
}
}

View File

@@ -1,242 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.google.common.collect.ImmutableList;
import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.MouseShortcut;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.keymap.impl.KeymapImpl;
import com.intellij.openapi.util.SystemInfo;
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.util.*;
import static com.google.common.collect.Lists.newLinkedList;
import static com.google.common.collect.Maps.newHashMap;
/**
* User: zolotov
* Date: 1/8/13
*/
public class VimKeymapConflictResolveUtil {
private static final String SHIFT = "shift";
private static final String CONTROL = "control";
private static final String META = "meta";
private static final String ALT = "alt";
private static final String ALT_GRAPH = "altGraph";
private static final String DOUBLE_CLICK = "doubleClick";
private static final String VIM_KEY_HANDLER_ACTION_ID = "VimKeyHandler";
private static final String ACTION_TAG = "action";
private static final String KEYBOARD_SHORTCUT_TAG = "keyboard-shortcut";
private static final String MOUSE_SHORTCUT_TAG = "mouse-shortcut";
private static final String ID_ATTRIBUTE = "id";
private static final String FIRST_KEYSTROKE_ATTRIBUTE = "first-keystroke";
private static final String KEYSTROKE_ATTRIBUTE = "keystroke";
private static final String SECOND_KEYSTROKE_ATTRIBUTE = "second-keystroke";
private static final List<Integer> ALTERNATIVE_MODIFIERS = ImmutableList.of(
InputEvent.ALT_DOWN_MASK,
InputEvent.CTRL_DOWN_MASK,
InputEvent.SHIFT_DOWN_MASK,
InputEvent.META_DOWN_MASK,
InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK,
InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK,
InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK,
InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK,
InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
public static void resolveConflicts(Element targetKeymapRoot, Keymap parentKeymap) {
final Collection<String> vimHandlingShortcuts = getVimHandlingShortcuts(targetKeymapRoot);
final Map<String, List<Shortcut>> shortcutsToOverride = retrieveShortcutsToOverride(vimHandlingShortcuts, parentKeymap);
overrideShortcuts(targetKeymapRoot, shortcutsToOverride);
}
/**
* @param targetKeymapRoot root element of Vim keymap
* @return all shortcuts in string representation that should be handled by Vim plugin
*/
private static Collection<String> getVimHandlingShortcuts(Element targetKeymapRoot) {
Element vimKeyHandlerAction = retrieveActionElement(targetKeymapRoot);
if (vimKeyHandlerAction != null) {
Collection<String> result = newLinkedList();
for (Object childAction : vimKeyHandlerAction.getChildren()) {
if (childAction instanceof Element) {
Element shortcut = (Element)childAction;
result.add(shortcut.getAttributeValue(FIRST_KEYSTROKE_ATTRIBUTE));
}
}
return result;
}
return Collections.emptyList();
}
/**
* @param targetKeymapRoot root element of Vim keymap
* @return Retrieve VimKeyHandler action element
*/
@Nullable
private static Element retrieveActionElement(Element targetKeymapRoot) {
Element vimKeyHandlerAction = null;
for (Object child : targetKeymapRoot.getChildren(ACTION_TAG)) {
if (child instanceof Element) {
Element action = (Element)child;
if (VIM_KEY_HANDLER_ACTION_ID.equals(action.getAttributeValue(ID_ATTRIBUTE))) {
vimKeyHandlerAction = action;
break;
}
}
}
return vimKeyHandlerAction;
}
/**
* @param vimHandlingShortcuts collection of shortcuts that should be handled by Vim plugin
* @param parentKeymap selected parent keymap for vim keymap
* @return mapping of action names to its shortcuts that we should save in Vim-keymap
* (or empty list of shortcuts if action just should be disabled)
*/
private static Map<String, List<Shortcut>> retrieveShortcutsToOverride(Collection<String> vimHandlingShortcuts, Keymap parentKeymap) {
Map<String, List<Shortcut>> result = newHashMap();
for (String shortcut : vimHandlingShortcuts) {
final Map<String, ArrayList<KeyboardShortcut>> conflicts = parentKeymap.getConflicts("", KeyboardShortcut.fromString(shortcut));
for (Map.Entry<String, ArrayList<KeyboardShortcut>> conflict : conflicts.entrySet()) {
String actionName = conflict.getKey();
final ArrayList<KeyboardShortcut> conflictedShortcuts = conflict.getValue();
if (result.containsKey(actionName)) {
// found another conflict for already overridden action
List<Shortcut> overridesShortcuts = result.get(actionName);
for (KeyboardShortcut conflictedShortcut : conflictedShortcuts) {
overridesShortcuts.remove(conflictedShortcut);
}
}
else {
// let's override action with all non-conflict shortcuts
List<Shortcut> overriddenShortcuts = newLinkedList();
for (Shortcut actionShortcut : parentKeymap.getShortcuts(actionName)) {
if (!(actionShortcut instanceof KeyboardShortcut) || !conflictedShortcuts.contains(actionShortcut)) {
overriddenShortcuts.add(actionShortcut);
}
}
if (overriddenShortcuts.isEmpty()) {
for (Integer modifier : ALTERNATIVE_MODIFIERS) {
if (!SystemInfo.isMac && (modifier & InputEvent.META_DOWN_MASK) != 0) {
continue;
}
final KeyStroke originalStroke = KeyStroke.getKeyStroke(shortcut);
final int modifiers = originalStroke.getModifiers() | modifier;
//noinspection MagicConstant
final KeyStroke stroke = KeyStroke.getKeyStroke(originalStroke.getKeyCode(), modifiers);
final KeyboardShortcut alternativeShortcut = new KeyboardShortcut(stroke, null);
if (parentKeymap.getConflicts("", alternativeShortcut).isEmpty()) {
overriddenShortcuts.add(alternativeShortcut);
break;
}
}
}
result.put(actionName, overriddenShortcuts);
}
}
}
return result;
}
/**
* Fill vim keymap with overridden actions.
* Only keyboard and mouse shortcuts will be overridden.
*
* @param targetKeymapRoot root element of Vim keymap
* @param shortcutsToOverride overriding mapping: actions -> shortcuts_should_be_saved
*/
private static void overrideShortcuts(Element targetKeymapRoot, Map<String, List<Shortcut>> shortcutsToOverride) {
for (Map.Entry<String, List<Shortcut>> action : shortcutsToOverride.entrySet()) {
targetKeymapRoot.addContent(createActionElement(action.getKey(), action.getValue()));
}
}
public static Element createActionElement(String actionName, List<Shortcut> shortcuts) {
final Element overridesAction = new Element(ACTION_TAG);
overridesAction.setAttribute(ID_ATTRIBUTE, actionName);
for (Shortcut shortcut : shortcuts) {
if (shortcut instanceof KeyboardShortcut) {
KeyboardShortcut keyboardShortcut = (KeyboardShortcut)shortcut;
final String firstShortcutString = KeymapImpl.getKeyShortcutString(keyboardShortcut.getFirstKeyStroke());
final Element shortcutElement = createShortcutElement(KEYBOARD_SHORTCUT_TAG, FIRST_KEYSTROKE_ATTRIBUTE,
firstShortcutString);
overridesAction.addContent(shortcutElement);
final KeyStroke secondKeyStroke = keyboardShortcut.getSecondKeyStroke();
if (secondKeyStroke != null) {
final String secondShortcutString = KeymapImpl.getKeyShortcutString(secondKeyStroke);
shortcutElement.setAttribute(SECOND_KEYSTROKE_ATTRIBUTE, secondShortcutString);
}
}
else if (shortcut instanceof MouseShortcut) {
overridesAction.addContent(createShortcutElement(MOUSE_SHORTCUT_TAG, KEYSTROKE_ATTRIBUTE, getMouseShortcutString((MouseShortcut)shortcut)));
}
}
return overridesAction;
}
private static Element createShortcutElement(String elementName, String shortcutAttributeName, String shortcut) {
final Element shortcutElement = new Element(elementName);
shortcutElement.setAttribute(shortcutAttributeName, shortcut);
return shortcutElement;
}
/**
* Create string representation of mouse shortcut
* KeymapImpl has implementation for mouse shortcut marshaling, but it is private :-(
*
* @param shortcut mouse shortcut
* @return string representation of mouse shortcut
*/
private static String getMouseShortcutString(MouseShortcut shortcut) {
StringBuilder builder = new StringBuilder();
int modifiers = shortcut.getModifiers();
if ((MouseEvent.SHIFT_DOWN_MASK & modifiers) > 0) {
builder.append(SHIFT).append(' ');
}
if ((MouseEvent.CTRL_DOWN_MASK & modifiers) > 0) {
builder.append(CONTROL).append(' ');
}
if ((MouseEvent.META_DOWN_MASK & modifiers) > 0) {
builder.append(META).append(' ');
}
if ((MouseEvent.ALT_DOWN_MASK & modifiers) > 0) {
builder.append(ALT).append(' ');
}
if ((MouseEvent.ALT_GRAPH_DOWN_MASK & modifiers) > 0) {
builder.append(ALT_GRAPH).append(' ');
}
builder.append("button").append(shortcut.getButton()).append(' ');
if (shortcut.getClickCount() > 1) {
builder.append(DOUBLE_CLICK);
}
return builder.toString().trim();
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -17,46 +17,56 @@
*/
package com.maddyhome.idea.vim;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
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.openapi.application.Application;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
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.editor.ex.EditorEx;
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
import com.intellij.openapi.keymap.impl.DefaultKeymap;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter;
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.vfs.CharsetToolkit;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
import com.maddyhome.idea.vim.command.CommandState;
import com.intellij.util.io.HttpRequests;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.vimscript.VimScriptParser;
import com.maddyhome.idea.vim.group.*;
import com.maddyhome.idea.vim.helper.*;
import com.maddyhome.idea.vim.helper.DocumentManager;
import com.maddyhome.idea.vim.helper.MacKeyRepeat;
import com.maddyhome.idea.vim.option.Options;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.awt.*;
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
@@ -70,28 +80,16 @@ import java.awt.*;
*/
@State(
name = "VimSettings",
storages = {
@Storage(
id = "main",
file = "$APP_CONFIG$/vim_settings.xml"
)}
)
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element>
{
storages = {@Storage(file = "$APP_CONFIG$/vim_settings.xml")})
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
private static final String IDEAVIM_STATISTICS_TIMESTAMP_KEY = "ideavim.statistics.timestamp";
public static final String IDEAVIM_NOTIFICATION_ID = "ideavim";
public static final String IDEAVIM_STICKY_NOTIFICATION_ID = "ideavim-sticky";
public static final String IDEAVIM_NOTIFICATION_TITLE = "IdeaVim";
public static final int STATE_VERSION = 2;
public static final int STATE_VERSION = 4;
private static final boolean BLOCK_CURSOR_VIM_VALUE = true;
private static final boolean ANIMATED_SCROLLING_VIM_VALUE = false;
private static final boolean REFRAIN_FROM_SCROLLING_VIM_VALUE = true;
private VimTypedActionHandler vimHandler;
private boolean isBlockCursor = false;
private boolean isAnimatedScrolling = false;
private boolean isRefrainFromScrolling = false;
private boolean error = false;
private int previousStateVersion = 0;
@@ -100,206 +98,111 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
// It is enabled by default to avoid any special configuration after plugin installation
private boolean enabled = true;
private static Logger LOG = Logger.getInstance(VimPlugin.class);
private static final Logger LOG = Logger.getInstance(VimPlugin.class);
private final Application myApp;
@NotNull private final MotionGroup motion;
@NotNull private final ChangeGroup change;
@NotNull private final CopyGroup copy;
@NotNull private final MarkGroup mark;
@NotNull private final RegisterGroup register;
@NotNull private final FileGroup file;
@NotNull private final SearchGroup search;
@NotNull private final ProcessGroup process;
@NotNull private final MacroGroup macro;
@NotNull private final DigraphGroup digraph;
@NotNull private final HistoryGroup history;
@NotNull private final KeyGroup key;
@NotNull private final WindowGroup window;
@NotNull private final EditorGroup editor;
public VimPlugin() {
motion = new MotionGroup();
change = new ChangeGroup();
copy = new CopyGroup();
mark = new MarkGroup();
register = new RegisterGroup();
file = new FileGroup();
search = new SearchGroup();
process = new ProcessGroup();
macro = new MacroGroup();
digraph = new DigraphGroup();
history = new HistoryGroup();
key = new KeyGroup();
window = new WindowGroup();
editor = new EditorGroup();
/**
* Creates the Vim Plugin
*/
public VimPlugin(final Application app) {
myApp = app;
LOG.debug("VimPlugin ctr");
}
@NotNull
public static VimPlugin getInstance() {
return (VimPlugin)ApplicationManager.getApplication().getComponent(IDEAVIM_COMPONENT_NAME);
}
/**
* Supplies the name of the plugin
*
* @return The plugin name
*/
@NotNull
@Override
public String getComponentName() {
return IDEAVIM_COMPONENT_NAME;
}
public String getPreviousKeyMap() {
return previousKeyMap;
}
public void setPreviousKeyMap(final String keymap) {
previousKeyMap = keymap;
}
/**
* Initialize the Vim Plugin. This plugs the vim key handler into the editor action manager.
*/
@Override
public void initComponent() {
LOG.debug("initComponent");
Notifications.Bus.register(IDEAVIM_STICKY_NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON);
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
updateState();
checkAndInstallKeymap();
}
});
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
// Replace the default key handler with the Vim key handler
vimHandler = new VimTypedActionHandler(action.getHandler());
action.setupHandler(vimHandler);
// Add some listeners so we can handle special events
setupListeners();
final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getRawHandler()));
// Register vim actions in command mode
RegisterActions.registerActions();
// Add some listeners so we can handle special events
setupListeners();
// Register ex handlers
CommandParser.getInstance().registerHandlers();
if (!ApplicationManager.getApplication().isUnitTestMode()) {
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
if (ideaVimRc != null) {
VimScriptParser.executeFile(ideaVimRc);
}
}
LOG.debug("done");
}
private void updateState() {
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
boolean requiresRestart = false;
if (previousStateVersion < 1 && SystemInfo.isMac && VimKeyMapUtil.isVimKeymapInstalled()) {
if (Messages.showYesNoDialog("Vim keymap generator has been updated to create keymaps more compatible " +
"with base keymaps.\n\nDo you want to reconfigure your Vim keymap?\n\n" +
"Warning: Any custom shortcuts will be lost!\n\n" +
"(You can do it later using Tools | Reconfigure Vim Keymap).",
IDEAVIM_NOTIFICATION_TITLE,
Messages.getQuestionIcon()) == Messages.YES) {
KeyHandler.executeAction("VimReconfigureKeymap", SimpleDataContext.getProjectContext(null));
}
}
if (previousStateVersion < 2 && SystemInfo.isMac) {
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
final Boolean enabled = keyRepeat.isEnabled();
if (enabled == null || !enabled) {
if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold " +
"(requires restart)?\n\n" +
"(You can do it manually by running 'defaults write -g " +
"ApplePressAndHoldEnabled 0' in the console).",
IDEAVIM_NOTIFICATION_TITLE,
Messages.getQuestionIcon()) == Messages.YES) {
keyRepeat.setEnabled(true);
requiresRestart = true;
}
}
}
if (requiresRestart) {
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
app.restart();
}
}
}
private static void checkAndInstallKeymap() {
// Ensure that Vim keymap is installed and install if not.
// Moreover we can use installed keymap as indicator of the first time installed plugin
if (VimPlugin.isEnabled()) {
boolean vimKeyMapInstalled = VimKeyMapUtil.isVimKeymapInstalled();
// In case if keymap wasn't installed, we assume that this is the first launch after installation
if (!vimKeyMapInstalled) {
vimKeyMapInstalled = VimKeyMapUtil.installKeyBoardBindings();
if (!vimKeyMapInstalled) {
if (Messages.showYesNoDialog("It is crucial to use Vim keymap for IdeaVim plugin correct work, " +
"however it was not installed correctly.\nDo you want " +
ApplicationManagerEx.getApplicationEx().getName() +
" to disable Vim emulation?", IDEAVIM_NOTIFICATION_TITLE, Messages.getQuestionIcon()) == Messages.YES) {
VimPlugin.getInstance().turnOffPlugin();
return;
}
}
// Enable proper keymap bindings
VimKeyMapUtil.switchKeymapBindings(true);
}
// In this case we should warn if user doesn't use vim keymap
else {
if (!VimKeyMapUtil.isVimKeymapUsed()) {
Notifications.Bus.notify(new Notification(IDEAVIM_NOTIFICATION_ID, IDEAVIM_NOTIFICATION_TITLE,
"Vim keymap is not active, IdeaVim plugin may work incorrectly",
NotificationType.WARNING));
}
}
}
}
/**
* This sets up some listeners so we can handle various events that occur
*/
private void setupListeners() {
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
DocumentManager.getInstance().init();
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
public void editorCreated(@NotNull EditorFactoryEvent event) {
final Editor editor = event.getEditor();
isBlockCursor = editor.getSettings().isBlockCursor();
isAnimatedScrolling = editor.getSettings().isAnimatedScrolling();
isRefrainFromScrolling = editor.getSettings().isRefrainFromScrolling();
EditorData.initializeEditor(editor);
DocumentManager.getInstance().addListeners(editor.getDocument());
if (VimPlugin.isEnabled()) {
// Turn on insert mode if editor doesn't have any file
if (!EditorData.isFileEditor(editor) && editor.getDocument().isWritable() &&
!CommandState.inInsertMode(editor)) {
KeyHandler.getInstance().handleKey(editor, KeyStroke.getKeyStroke('i'), new EditorDataContext(editor));
}
editor.getSettings().setBlockCursor(!CommandState.inInsertMode(editor));
editor.getSettings().setAnimatedScrolling(ANIMATED_SCROLLING_VIM_VALUE);
editor.getSettings().setRefrainFromScrolling(REFRAIN_FROM_SCROLLING_VIM_VALUE);
}
}
public void editorReleased(@NotNull EditorFactoryEvent event) {
EditorData.uninitializeEditor(event.getEditor());
event.getEditor().getSettings().setAnimatedScrolling(isAnimatedScrolling);
event.getEditor().getSettings().setRefrainFromScrolling(isRefrainFromScrolling);
DocumentManager.getInstance().removeListeners(event.getEditor().getDocument());
}
}, myApp);
// Since the Vim plugin custom actions aren't available to the call to <code>initComponent()</code>
// we need to force the generation of the key map when the first project is opened.
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
public void projectOpened(@NotNull final Project project) {
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MotionGroup.MotionEditorChange());
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileGroup.SelectionCheck());
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new SearchGroup.EditorSelectionCheck());
}
public void projectClosed(final Project project) {
}
});
CommandProcessor.getInstance().addCommandListener(DelegateCommandListener.getInstance());
}
/**
* This shuts down the Vim plugin. All we need to do is reinstall the original key handler
*/
@Override
public void disposeComponent() {
LOG.debug("disposeComponent");
turnOffPlugin();
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
action.setupHandler(vimHandler.getOriginalTypedHandler());
EventFacade.getInstance().restoreTypedActionHandler();
LOG.debug("done");
}
@Override
public Element getState() {
LOG.debug("Saving state");
final Element element = new Element("ideavim");
// Save whether the plugin is enabled or not
final Element state = new Element("state");
state.setAttribute("version", Integer.toString(STATE_VERSION));
state.setAttribute("enabled", Boolean.toString(enabled));
element.addContent(state);
mark.saveData(element);
register.saveData(element);
search.saveData(element);
history.saveData(element);
key.saveData(element);
editor.saveData(element);
return element;
}
@Override
public void loadState(@NotNull final Element element) {
LOG.debug("Loading state");
@@ -316,30 +219,100 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
previousKeyMap = state.getAttributeValue("keymap");
}
CommandGroups.getInstance().readData(element);
mark.readData(element);
register.readData(element);
search.readData(element);
history.readData(element);
key.readData(element);
editor.readData(element);
}
@Override
public Element getState() {
LOG.debug("Saving state");
final Element element = new Element("ideavim");
// Save whether the plugin is enabled or not
final Element state = new Element("state");
state.setAttribute("version", Integer.toString(STATE_VERSION));
state.setAttribute("enabled", Boolean.toString(enabled));
state.setAttribute("keymap", previousKeyMap);
element.addContent(state);
CommandGroups.getInstance().saveData(element);
return element;
@NotNull
public static MotionGroup getMotion() {
return getInstance().motion;
}
@NotNull
public static ChangeGroup getChange() {
return getInstance().change;
}
@NotNull
public static CopyGroup getCopy() {
return getInstance().copy;
}
@NotNull
public static MarkGroup getMark() {
return getInstance().mark;
}
@NotNull
public static RegisterGroup getRegister() {
return getInstance().register;
}
@NotNull
public static FileGroup getFile() {
return getInstance().file;
}
@NotNull
public static SearchGroup getSearch() {
return getInstance().search;
}
@NotNull
public static ProcessGroup getProcess() {
return getInstance().process;
}
@NotNull
public static MacroGroup getMacro() {
return getInstance().macro;
}
@NotNull
public static DigraphGroup getDigraph() {
return getInstance().digraph;
}
@NotNull
public static HistoryGroup getHistory() {
return getInstance().history;
}
@NotNull
public static KeyGroup getKey() {
return getInstance().key;
}
@NotNull
public static WindowGroup getWindow() {
return getInstance().window;
}
@NotNull
public static EditorGroup getEditor() {
return getInstance().editor;
}
@NotNull
public static PluginId getPluginId() {
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";
}
}
/**
* Indicates whether the user has enabled or disabled the plugin
*
* @return true if the Vim plugin is enabled, false if not
*/
public static boolean isEnabled() {
return getInstance().enabled;
}
@@ -354,8 +327,10 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
if (enabled) {
getInstance().turnOnPlugin();
}
}
VimKeyMapUtil.switchKeymapBindings(enabled);
public static boolean isError() {
return getInstance().error;
}
/**
@@ -370,6 +345,12 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
}
}
public static void clearError() {
if (ApplicationManager.getApplication().isUnitTestMode()) {
getInstance().error = false;
}
}
public static void showMode(String msg) {
showMessage(msg);
}
@@ -390,54 +371,163 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
}
}
public void turnOnPlugin() {
@NotNull
private static VimPlugin getInstance() {
return (VimPlugin)ApplicationManager.getApplication().getComponent(IDEAVIM_COMPONENT_NAME);
}
private void turnOnPlugin() {
KeyHandler.getInstance().fullReset(null);
setCursors(BLOCK_CURSOR_VIM_VALUE);
setAnimatedScrolling(ANIMATED_SCROLLING_VIM_VALUE);
setRefrainFromScrolling(REFRAIN_FROM_SCROLLING_VIM_VALUE);
CommandGroups.getInstance().getMotion().turnOn();
getEditor().turnOn();
getMotion().turnOn();
}
public void turnOffPlugin() {
private void turnOffPlugin() {
KeyHandler.getInstance().fullReset(null);
setCursors(isBlockCursor);
setAnimatedScrolling(isAnimatedScrolling);
setRefrainFromScrolling(isRefrainFromScrolling);
CommandGroups.getInstance().getMotion().turnOff();
getEditor().turnOff();
getMotion().turnOff();
}
private void setCursors(boolean isBlock) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
// Vim plugin should be turned on in insert mode
((EditorEx)editor).setInsertMode(true);
editor.getSettings().setBlockCursor(isBlock);
private void updateState() {
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
if (SystemInfo.isMac) {
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
final Boolean enabled = keyRepeat.isEnabled();
final Boolean isKeyRepeat = editor.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?\n\n" +
"(You can do it manually by running 'defaults write -g " +
"ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE,
Messages.getQuestionIcon()) == Messages.YES) {
editor.setKeyRepeat(true);
keyRepeat.setEnabled(true);
}
else {
editor.setKeyRepeat(false);
}
}
}
if (previousStateVersion > 0 && previousStateVersion < 3) {
final KeymapManagerEx manager = KeymapManagerEx.getInstanceEx();
Keymap keymap = null;
if (previousKeyMap != null) {
keymap = manager.getKeymap(previousKeyMap);
}
if (keymap == null) {
keymap = manager.getKeymap(DefaultKeymap.getInstance().getDefaultKeymapName());
}
assert keymap != null : "Default keymap not found";
new Notification(
VimPlugin.IDEAVIM_STICKY_NOTIFICATION_ID,
VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
String.format("IdeaVim plugin doesn't use the special \"Vim\" keymap any longer. " +
"Switching to \"%s\" keymap.<br/><br/>" +
"Now it is possible to set up:<br/>" +
"<ul>" +
"<li>Vim keys in your ~/.ideavimrc file using key mapping commands</li>" +
"<li>IDE action shortcuts in \"File | Settings | Keymap\"</li>" +
"<li>Vim or IDE handlers for conflicting shortcuts in <a href='#settings'>Vim Emulation</a> settings</li>" +
"</ul>", keymap.getPresentableName()),
NotificationType.INFORMATION,
new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
ShowSettingsUtil.getInstance().editConfigurable((Project)null, new VimEmulationConfigurable());
}
}).notify(null);
manager.setActiveKeymap(keymap);
}
if (previousStateVersion > 0 && previousStateVersion < 4) {
new Notification(
VimPlugin.IDEAVIM_STICKY_NOTIFICATION_ID,
VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
"The ~/.vimrc file is no longer read by default, use ~/.ideavimrc instead. You can read it from your " +
"~/.ideavimrc using this command:<br/><br/>" +
"<code>source ~/.vimrc</code>",
NotificationType.INFORMATION).notify(null);
}
}
}
private void setAnimatedScrolling(boolean isOn) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setAnimatedScrolling(isOn);
/**
* This sets up some listeners so we can handle various events that occur
*/
private void setupListeners() {
final EventFacade eventFacade = EventFacade.getInstance();
setupStatisticsReporter(eventFacade);
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
eventFacade.addProjectManagerListener(new ProjectManagerAdapter() {
@Override
public void projectOpened(@NotNull final Project project) {
eventFacade.addFileEditorManagerListener(project, new MotionGroup.MotionEditorChange());
eventFacade.addFileEditorManagerListener(project, new FileGroup.SelectionCheck());
eventFacade.addFileEditorManagerListener(project, new SearchGroup.EditorSelectionCheck());
}
});
}
private void setRefrainFromScrolling(boolean isOn) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setRefrainFromScrolling(isOn);
/**
* 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;
}
}
public boolean isError() {
return error;
);
}
public static void clearError() {
if (ApplicationManager.getApplication().isUnitTestMode()) {
getInstance().error = false;
catch (IOException e) {
LOG.warn(e);
}
}
});
}
}
}, application);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -18,78 +18,69 @@
package com.maddyhome.idea.vim;
import com.intellij.codeInsight.lookup.LookupEx;
import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* This handler accepts all regular keystrokes and passes them on to the Vim Key handler
*/
public class VimTypedActionHandler implements TypedActionHandler {
/**
* Creates an instance of the key handler
* Accepts all regular keystrokes and passes them on to the Vim key handler.
*
* @param origHandler The original key handler
* IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}.
*/
public class VimTypedActionHandler implements TypedActionHandlerEx {
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
private final TypedActionHandler origHandler;
@NotNull private final KeyHandler handler;
public VimTypedActionHandler(TypedActionHandler origHandler) {
this.origHandler = origHandler;
handler = KeyHandler.getInstance();
handler.setOriginalHandler(origHandler);
}
/**
* Gives the original key handler
*
* @return The original key handler
*/
public TypedActionHandler getOriginalTypedHandler() {
return origHandler;
}
/**
* All characters typed into an editor will get sent to this handler. Only letters, numbers, and punctuation
* are sent here. Keys like Tab, Enter, Home, Backspace, etc. and all Control-Letter etc. argType keys are not
* sent by Idea to this handler.
*
* @param editor The editor the character was typed into
* @param charTyped The character that was typed
* @param context The data context
*/
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
// If the plugin is disabled we simply resend the character to the original handler
if (!VimPlugin.isEnabled()) {
origHandler.execute(editor, charTyped, context);
return;
}
// In case if keystrokes go to lookup, we use original handler
final LookupEx lookup = LookupManager.getActiveLookup(editor);
if (lookup != null && lookup.isFocused()) {
origHandler.execute(editor, charTyped, context);
return;
}
// Run key handler outside of the key typed command for creating our own undoable commands
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
if (isEnabled(editor)) {
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
}
else {
TypedActionHandler originalHandler = KeyHandler.getInstance().getOriginalHandler();
if (originalHandler instanceof TypedActionHandlerEx) {
((TypedActionHandlerEx)originalHandler).beforeExecute(editor, charTyped, context, plan);
}
}
}
@Override
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
if (isEnabled(editor)) {
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), context);
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
catch (Throwable e) {
logger.error(e);
}
}
});
else {
origHandler.execute(editor, charTyped, context);
}
}
private TypedActionHandler origHandler;
private KeyHandler handler;
private static Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
private boolean isEnabled(@NotNull Editor editor) {
if (VimPlugin.isEnabled()) {
final Lookup lookup = LookupManager.getActiveLookup(editor);
return lookup == null || !lookup.isFocused();
}
return false;
}
}

View File

@@ -1,48 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractDelegateAction extends AnAction implements DelegateAction {
protected AbstractDelegateAction() {
}
protected AbstractDelegateAction(@NotNull AnAction origAction) {
setOrigAction(origAction);
}
public void setOrigAction(@NotNull AnAction origAction) {
if (logger.isDebugEnabled()) {
logger.debug("origAction=" + origAction);
}
this.origAction = origAction;
copyFrom(origAction);
}
public AnAction getOrigAction() {
return origAction;
}
private AnAction origAction;
private static Logger logger = Logger.getInstance(AbstractDelegateAction.class.getName());
}

View File

@@ -1,52 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractDelegateEditorAction extends EditorAction implements DelegateAction {
protected AbstractDelegateEditorAction(EditorActionHandler handler) {
super(handler);
}
protected AbstractDelegateEditorAction(EditorActionHandler handler, @NotNull EditorAction origAction) {
this(handler);
setOrigAction(origAction);
}
public void setOrigAction(@NotNull AnAction origAction) {
if (logger.isDebugEnabled()) {
logger.debug("origAction=" + origAction);
}
this.origAction = origAction;
copyFrom(origAction);
}
public AnAction getOrigAction() {
return origAction;
}
private AnAction origAction;
private static Logger logger = Logger.getInstance(AbstractDelegateEditorAction.class.getName());
}

View File

@@ -1,27 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.intellij.openapi.actionSystem.AnAction;
public interface DelegateAction {
void setOrigAction(AnAction origAction);
AnAction getOrigAction();
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,9 +21,9 @@ package com.maddyhome.idea.vim.action;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
/**
@@ -34,9 +34,9 @@ public class ExEntryAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
CommandGroups.getInstance().getProcess().startExCommand(editor, context, cmd);
VimPlugin.getProcess().startExCommand(editor, context, cmd);
return true;
}

View File

@@ -1,33 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import org.jetbrains.annotations.NotNull;
public class OriginalDelegateAction extends AbstractDelegateAction {
public void actionPerformed(@NotNull AnActionEvent event) {
Editor editor = event.getData(PlatformDataKeys.EDITOR);
if (editor != null) {
getOrigAction().actionPerformed(event);
}
}
}

View File

@@ -1,63 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.event.KeyEvent;
public class PassThruDelegateAction extends AbstractDelegateAction {
public PassThruDelegateAction(KeyStroke stroke) {
this.stroke = stroke;
}
public void actionPerformed(@NotNull AnActionEvent event) {
if (logger.isDebugEnabled()) {
logger.debug("actionPerformed key=" + stroke);
}
final Editor editor = event.getData(PlatformDataKeys.EDITOR); // API change - don't merge
if (editor == null || !VimPlugin.isEnabled()) {
getOrigAction().actionPerformed(event);
}
else if (event.getInputEvent() instanceof KeyEvent) {
KeyStroke key = KeyStroke.getKeyStrokeForEvent((KeyEvent)event.getInputEvent());
if (logger.isDebugEnabled()) {
logger.debug("event = KeyEvent: " + key);
}
KeyHandler.getInstance().handleKey(editor, key, event.getDataContext());
}
else {
if (logger.isDebugEnabled()) {
logger.debug("event is a " + event.getInputEvent().getClass().getName());
}
KeyHandler.getInstance().handleKey(editor, stroke, event.getDataContext());
}
}
private KeyStroke stroke;
private static Logger logger = Logger.getInstance(PassThruDelegateAction.class.getName());
}

View File

@@ -1,63 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class PassThruDelegateEditorAction extends AbstractDelegateEditorAction {
public PassThruDelegateEditorAction(KeyStroke stroke, EditorActionHandler origHandler) {
super(new MyHandler(stroke, origHandler));
}
private static Logger logger = Logger.getInstance(PassThruDelegateEditorAction.class.getName());
private static class MyHandler extends EditorActionHandler {
public MyHandler(KeyStroke stroke, EditorActionHandler handler) {
this.stroke = stroke;
this.origHandler = handler;
}
public void execute(@NotNull Editor editor, @NotNull DataContext dataContext) {
if (logger.isDebugEnabled()) {
logger.debug("actionPerformed key=" + stroke);
}
if (!VimPlugin.isEnabled()) {
origHandler.execute(editor, dataContext);
}
else {
if (logger.isDebugEnabled()) {
logger.debug("event = KeyEvent: " + stroke);
}
KeyHandler.getInstance().handleKey(InjectedLanguageUtil.getTopLevelEditor(editor), stroke, dataContext);
}
}
private KeyStroke stroke;
private EditorActionHandler origHandler;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -18,14 +18,24 @@
package com.maddyhome.idea.vim.action;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.handler.ResetModeHandler;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.KeyHandler;
import org.jetbrains.annotations.NotNull;
/**
*
*/
// TODO: Cannot find the corresponding Vim command. Remove it?
public class ResetModeAction extends EditorAction {
public ResetModeAction() {
super(new ResetModeHandler());
super(new EditorActionHandler() {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
KeyHandler.getInstance().fullReset(InjectedLanguageUtil.getTopLevelEditor(editor));
}
});
}
}

View File

@@ -0,0 +1,80 @@
/*
* 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;
import com.google.common.collect.ImmutableSet;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.helper.StringHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* Action that represents a Vim command.
*
* Actions should be registered in resources/META-INF/plugin.xml and in package-info.java
* inside {@link com.maddyhome.idea.vim.action}.
*
* @author vlan
*/
public abstract class VimCommandAction extends EditorAction {
protected VimCommandAction(EditorActionHandler defaultHandler) {
super(defaultHandler);
}
@NotNull
public abstract Set<MappingMode> getMappingModes();
@NotNull
public abstract Set<List<KeyStroke>> getKeyStrokesSet();
@NotNull
public abstract Command.Type getType();
@NotNull
public Argument.Type getArgumentType() {
return Argument.Type.NONE;
}
/**
* Returns various binary flags for the command.
*
* These legacy flags will be refactored in future releases.
*
* @see com.maddyhome.idea.vim.command.Command
*/
public int getFlags() {
return 0;
}
@NotNull
protected static Set<List<KeyStroke>> parseKeysSet(@NotNull String... keyStrings) {
final ImmutableSet.Builder<List<KeyStroke>> builder = ImmutableSet.builder();
for (String keyString : keyStrings) {
builder.add(StringHelper.parseKeys(keyString));
}
return builder.build();
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -16,11 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim;
package com.maddyhome.idea.vim.action;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.DumbAware;
import com.maddyhome.idea.vim.VimPlugin;
/**
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option

View File

@@ -0,0 +1,252 @@
/*
* 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;
import com.google.common.collect.ImmutableSet;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.change.insert.InsertExitModeAction;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.key.ShortcutOwner;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static java.awt.event.KeyEvent.*;
/**
* Handles Vim keys that are treated as action shortcuts by the IDE.
*
* These keys are not passed to {@link com.maddyhome.idea.vim.VimTypedActionHandler} and should be handled by actions.
*/
public class VimShortcutKeyAction extends AnAction implements DumbAware {
private static final String ACTION_ID = "VimShortcutKeyAction";
@NotNull public static final Set<KeyStroke> VIM_ONLY_EDITOR_KEYS = ImmutableSet.<KeyStroke>builder()
.addAll(getKeyStrokes(VK_ENTER, 0))
.addAll(getKeyStrokes(VK_ESCAPE, 0))
.addAll(getKeyStrokes(VK_TAB, 0))
.addAll(getKeyStrokes(VK_BACK_SPACE, 0, CTRL_MASK))
.addAll(getKeyStrokes(VK_INSERT, 0))
.addAll(getKeyStrokes(VK_DELETE, 0, CTRL_MASK))
.addAll(getKeyStrokes(VK_UP, 0, CTRL_MASK, SHIFT_MASK))
.addAll(getKeyStrokes(VK_DOWN, 0, CTRL_MASK, SHIFT_MASK))
.addAll(getKeyStrokes(VK_LEFT, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
.addAll(getKeyStrokes(VK_RIGHT, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
.addAll(getKeyStrokes(VK_HOME, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
.addAll(getKeyStrokes(VK_END, 0, CTRL_MASK, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
.addAll(getKeyStrokes(VK_PAGE_UP, 0, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
.addAll(getKeyStrokes(VK_PAGE_DOWN, 0, SHIFT_MASK, CTRL_MASK | SHIFT_MASK))
.build();
@NotNull private static final Set<KeyStroke> NON_FILE_EDITOR_KEYS = ImmutableSet.<KeyStroke>builder()
.addAll(getKeyStrokes(VK_ENTER, 0))
.addAll(getKeyStrokes(VK_ESCAPE, 0))
.addAll(getKeyStrokes(VK_TAB, 0))
.addAll(getKeyStrokes(VK_UP, 0))
.addAll(getKeyStrokes(VK_DOWN, 0))
.build();
private static final Logger ourLogger = Logger.getInstance(VimShortcutKeyAction.class.getName());
private static AnAction ourInstance = null;
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Editor editor = getEditor(e);
final KeyStroke keyStroke = getKeyStroke(e);
if (editor != null && keyStroke != null) {
final ShortcutOwner owner = VimPlugin.getKey().getSavedShortcutConflicts().get(keyStroke);
if (owner == ShortcutOwner.UNDEFINED) {
notifyAboutShortcutConflict(keyStroke);
}
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
}
}
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(isEnabled(e));
}
@NotNull
public static AnAction getInstance() {
if (ourInstance == null) {
final AnAction originalAction = ActionManager.getInstance().getAction(ACTION_ID);
ourInstance = EmptyAction.wrap(originalAction);
}
return ourInstance;
}
private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) {
VimPlugin.getKey().getSavedShortcutConflicts().put(keyStroke, ShortcutOwner.VIM);
final String message = String.format(
"Using the <b>%s</b> shortcut for Vim emulation.<br/>" +
"You can redefine it as an <a href='#ide'>IDE shortcut</a> or " +
"configure its handler in <a href='#settings'>Vim Emulation</a> settings.",
KeymapUtil.getShortcutText(new KeyboardShortcut(keyStroke, null)));
final NotificationListener listener = new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
final String description = e.getDescription();
if ("#ide".equals(description)) {
VimPlugin.getKey().getSavedShortcutConflicts().put(keyStroke, ShortcutOwner.IDE);
notification.expire();
}
else if ("#settings".equals(description)) {
ShowSettingsUtil.getInstance().editConfigurable((Project)null, new VimEmulationConfigurable());
}
}
};
final Notification notification = new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID,
VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
message,
NotificationType.INFORMATION,
listener);
notification.notify(null);
}
private boolean isEnabled(@NotNull AnActionEvent e) {
if (VimPlugin.isEnabled()) {
final Editor editor = getEditor(e);
final KeyStroke keyStroke = getKeyStroke(e);
if (editor != null && keyStroke != null) {
final int keyCode = keyStroke.getKeyCode();
if (LookupManager.getActiveLookup(editor) != null) {
return isExitInsertMode(keyStroke);
}
if (keyCode == VK_ESCAPE) {
return isEnabledForEscape(editor);
}
if (CommandState.inInsertMode(editor)) {
// XXX: <Tab> won't be recorded in macros
if (keyCode == VK_TAB) {
return false;
}
// Debug watch, Python console, etc.
if (NON_FILE_EDITOR_KEYS.contains(keyStroke) && !EditorData.isFileEditor(editor)) {
return false;
}
}
if (VIM_ONLY_EDITOR_KEYS.contains(keyStroke)) {
return true;
}
final Map<KeyStroke, ShortcutOwner> savedShortcutConflicts = VimPlugin.getKey().getSavedShortcutConflicts();
final ShortcutOwner owner = savedShortcutConflicts.get(keyStroke);
if (owner == ShortcutOwner.VIM) {
return true;
}
else if (owner == ShortcutOwner.IDE) {
return !isShortcutConflict(keyStroke);
}
else {
if (isShortcutConflict(keyStroke)) {
savedShortcutConflicts.put(keyStroke, ShortcutOwner.UNDEFINED);
}
return true;
}
}
}
return false;
}
private boolean isEnabledForEscape(@NotNull Editor editor) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
return isPrimaryEditor(editor) || (EditorData.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
}
/**
* Checks if the editor is a primary editor in the main editing area.
*/
private boolean isPrimaryEditor(@NotNull Editor editor) {
final Project project = editor.getProject();
if (project == null) return false;
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
return StreamEx.of(fileEditorManager.getAllEditors())
.anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor)));
}
private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) {
for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) {
// XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux
if (keys.size() == 1 && keyStroke.equals(keys.get(0))) {
return true;
}
}
return false;
}
private boolean isShortcutConflict(@NotNull KeyStroke keyStroke) {
return !VimPlugin.getKey().getKeymapConflicts(keyStroke).isEmpty();
}
@NotNull
private static List<KeyStroke> getKeyStrokes(int keyCode, @NotNull int... modifiers) {
final List<KeyStroke> keyStrokes = new ArrayList<KeyStroke>();
for (int modifier : modifiers) {
keyStrokes.add(KeyStroke.getKeyStroke(keyCode, modifier));
}
return keyStrokes;
}
@Nullable
private KeyStroke getKeyStroke(@NotNull AnActionEvent e) {
final InputEvent inputEvent = e.getInputEvent();
if (inputEvent instanceof KeyEvent) {
final KeyEvent keyEvent = (KeyEvent)inputEvent;
return KeyStroke.getKeyStrokeForEvent(keyEvent);
}
return null;
}
@Nullable
private Editor getEditor(@NotNull AnActionEvent e) {
return e.getData(PlatformDataKeys.EDITOR);
}
}

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
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -22,7 +22,7 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
import org.jetbrains.annotations.NotNull;
@@ -33,7 +33,7 @@ public class RedoAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return UndoRedoHelper.redo(context);
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -22,12 +22,12 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.KeyHandler;
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.CommandState;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.key.KeyParser;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
/**
@@ -37,10 +37,11 @@ public class RepeatChangeAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand();
if (cmd != null) {
if (command.getRawCount() > 0) {
cmd.setCount(command.getCount());
@@ -53,10 +54,13 @@ public class RepeatChangeAction extends EditorAction {
}
}
Command save = state.getCommand();
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
state.setCommand(cmd);
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, KeyParser.MAPPING_NORMAL);
char reg = CommandGroups.getInstance().getRegister().getCurrentRegister();
CommandGroups.getInstance().getRegister().selectRegister(state.getLastChangeRegister());
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
char reg = VimPlugin.getRegister().getCurrentRegister();
VimPlugin.getRegister().selectRegister(state.getLastChangeRegister());
try {
KeyHandler.executeAction(cmd.getAction(), context);
}
@@ -67,8 +71,9 @@ public class RepeatChangeAction extends EditorAction {
if (save != null) {
state.setCommand(save);
}
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
state.saveLastChangeCommand(cmd);
CommandGroups.getInstance().getRegister().selectRegister(reg);
VimPlugin.getRegister().selectRegister(reg);
return true;
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -24,7 +24,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.ExException;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
/**
@@ -34,7 +34,7 @@ public class RepeatExCommandAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
int count = command.getCount();
try {

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -22,7 +22,7 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
import org.jetbrains.annotations.NotNull;
@@ -33,7 +33,7 @@ public class UndoAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return UndoRedoHelper.undo(context);
}

View File

@@ -0,0 +1,74 @@
/*
* 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.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class AutoIndentLinesVisualAction extends VimCommandAction {
public AutoIndentLinesVisualAction() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
VimPlugin.getChange().autoIndentRange(editor, caret, context, range);
return true;
}
});
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("=");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_FORCE_LINEWISE | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -35,9 +38,16 @@ public class ChangeCaseLowerMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_LOWER, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,29 +19,58 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeCaseLowerVisualAction extends EditorAction {
public class ChangeCaseLowerVisualAction extends VimCommandAction {
public ChangeCaseLowerVisualAction() {
super(new Handler());
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
return VimPlugin.getChange().changeCaseRange(topLevelEditor, caret, range, CharacterHelper.CASE_LOWER);
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return CommandGroups.getInstance().getChange().changeCaseRange(InjectedLanguageUtil.getTopLevelEditor(editor),
range, CharacterHelper.CASE_LOWER);
}
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("u");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeCaseToggleCharacterAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseToggleCharacter(editor, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -35,9 +38,16 @@ public class ChangeCaseToggleMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_TOGGLE, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,26 +19,56 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeCaseToggleVisualAction extends EditorAction {
public class ChangeCaseToggleVisualAction extends VimCommandAction {
public ChangeCaseToggleVisualAction() {
super(new Handler());
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_TOGGLE);
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return CommandGroups.getInstance().getChange().changeCaseRange(editor, range, CharacterHelper.CASE_TOGGLE);
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("~");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -35,9 +38,15 @@ public class ChangeCaseUpperMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_UPPER, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_UPPER, argument);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,26 +19,55 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeCaseUpperVisualAction extends EditorAction {
public class ChangeCaseUpperVisualAction extends VimCommandAction {
public ChangeCaseUpperVisualAction() {
super(new Handler());
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_UPPER);
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return CommandGroups.getInstance().getChange().changeCaseRange(editor, range, CharacterHelper.CASE_UPPER);
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("U");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeCharacterAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
return CommandGroups.getInstance().getChange().changeCharacter(editor, count, argument.getCharacter());
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.getCharacter());
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeCharactersAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeCharacters(editor, context, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCharacters(editor, caret, count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeEndOfLineAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeEndOfLine(editor, context, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeEndOfLine(editor, caret, count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,12 +21,13 @@ package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
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.ex.LineRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -36,9 +37,9 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/&");
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
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
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,13 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.ex.LineRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -35,10 +37,17 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
int line = editor.getCaretModel().getLogicalPosition().line;
LineRange range = new LineRange(line, line);
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/");
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
boolean result = true;
for (Caret caret : editor.getCaretModel().getAllCarets()) {
final int line = caret.getLogicalPosition().line;
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, new LineRange(line, line), "s", "//~/")) {
result = false;
}
}
return result;
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,23 +19,30 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeLineAction extends EditorAction {
public ChangeLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeLine(editor, context, count);
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().changeLine(editor, caret, count);
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @NotNull Argument argument) {
return CommandGroups.getInstance().getChange().changeMotion(editor, context, count, rawCount, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeNumberDecAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeNumber(editor, -count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, -count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class ChangeNumberIncAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeNumber(editor, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
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.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeReplaceAction extends EditorAction {
public ChangeReplaceAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().changeReplace(editor, context);
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().changeReplace(editor, context);
return true;
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,27 +19,60 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeVisualAction extends EditorAction {
public class ChangeVisualAction extends VimCommandAction {
public ChangeVisualAction() {
super(new Handler());
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final SelectionType type = EditorData.wasVisualBlockMode(editor) && range.isMultiple()
? SelectionType.BLOCK_WISE
: SelectionType.CHARACTER_WISE;
return VimPlugin.getChange().changeRange(editor, caret, range, type);
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
final SelectionType type = range.isMultiple() ? SelectionType.BLOCK_WISE : SelectionType.CHARACTER_WISE;
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, type);
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("c", "s");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MULTIKEY_UNDO | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -20,24 +20,59 @@ package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeVisualCharacterAction extends EditorAction {
public class ChangeVisualCharacterAction extends VimCommandAction {
public ChangeVisualCharacterAction() {
super(new Handler());
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
final Argument argument = cmd.getArgument();
return argument != null && VimPlugin.getChange().changeCharacterRange(editor, range, argument.getCharacter());
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @NotNull TextRange range) {
return CommandGroups.getInstance().getChange().changeCharacterRange(editor, range,
cmd.getArgument().getCharacter());
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("r");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.DIGRAPH;
}
@Override
public int getFlags() {
return Command.FLAG_ALLOW_DIGRAPH | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,30 +19,59 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeVisualLinesAction extends EditorAction {
public class ChangeVisualLinesAction extends VimCommandAction {
public ChangeVisualLinesAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
}
});
}
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, SelectionType.LINE_WISE);
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("R", "S");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_MULTIKEY_UNDO | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,44 +19,72 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
/**
*/
public class ChangeVisualLinesEndAction extends EditorAction {
public ChangeVisualLinesEndAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
if (range.isMultiple()) {
int[] starts = range.getStartOffsets();
int[] ends = range.getEndOffsets();
/**
* @author vlan
*/
public class ChangeVisualLinesEndAction extends VimCommandAction {
public ChangeVisualLinesEndAction() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
if (EditorData.wasVisualBlockMode(editor) && range.isMultiple()) {
final int[] starts = range.getStartOffsets();
final int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
if (ends[i] > starts[i]) {
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
range = new TextRange(starts, ends);
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, SelectionType.BLOCK_WISE);
final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
}
}
});
}
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, SelectionType.LINE_WISE);
}
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("C");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_MULTIKEY_UNDO | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,9 +21,9 @@ package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
/**
@@ -33,9 +33,9 @@ public class FilterCountLinesAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
return true;
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -22,11 +22,12 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.group.MotionGroup;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
/**
@@ -36,10 +37,15 @@ public class FilterMotionAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
cmd.getArgument(), false, false);
final Argument argument = cmd.getArgument();
if (argument == null) {
return false;
}
TextRange range = MotionGroup
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(), cmd.getRawCount(),
argument, false);
if (range == null) {
return false;
}
@@ -48,7 +54,7 @@ public class FilterMotionAction extends EditorAction {
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
if (current.line != start.line) {
MotionGroup.moveCaret(editor, range.getStartOffset());
MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), range.getStartOffset());
}
int count;
@@ -60,7 +66,7 @@ public class FilterMotionAction extends EditorAction {
}
Command command = new Command(count, null, null, Command.Type.UNDEFINED, 0);
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, command);
VimPlugin.getProcess().startFilterCommand(editor, context, command);
return true;
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -20,25 +20,51 @@ package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class FilterVisualLinesAction extends EditorAction {
public class FilterVisualLinesAction extends VimCommandAction {
public FilterVisualLinesAction() {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
super(new EditorActionHandlerBase() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
CommandGroups.getInstance().getMotion().resetVisual(editor, true);
VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
VimPlugin.getMotion().resetVisual(editor, true);
return true;
}
});
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("!");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE;
}
}

View File

@@ -0,0 +1,72 @@
/*
* 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.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ReformatCodeVisualAction extends VimCommandAction {
public ReformatCodeVisualAction() {
super(new VisualOperatorActionHandler() {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
VimPlugin.getChange().reformatCode(context);
return true;
}
});
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gq");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_FORCE_LINEWISE | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class DeleteCharacterAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteCharacter(editor, 1, false);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, 1, false);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class DeleteCharacterLeftAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteCharacter(editor, -count, false);
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class DeleteCharacterRightAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteCharacter(editor, count, false);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, count, false);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,14 @@ public class DeleteEndOfLineAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteEndOfLine(editor, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteEndOfLine(editor, caret, count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,12 +37,18 @@ public class DeleteJoinLinesAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().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
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,12 +37,18 @@ public class DeleteJoinLinesSpacesAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().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
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,29 +19,56 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteJoinVisualLinesAction extends EditorAction {
public class DeleteJoinVisualLinesAction extends VimCommandAction {
public DeleteJoinVisualLinesAction() {
super(new Handler());
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, false);
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
if (editor.isOneLineMode()) {
return false;
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, range, false);
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gJ");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,29 +19,56 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteJoinVisualLinesSpacesAction extends EditorAction {
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
public DeleteJoinVisualLinesSpacesAction() {
super(new Handler());
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, true);
}
});
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
if (editor.isOneLineMode()) {
return false;
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, range, true);
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("J");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,23 +19,30 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteLineAction extends EditorAction {
public DeleteLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return CommandGroups.getInstance().getChange().deleteLine(editor, count);
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().deleteLine(editor, caret, count);
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +37,15 @@ public class DeleteMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
return CommandGroups.getInstance().getChange().deleteMotion(editor, context, count, rawCount, argument, false);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange().deleteMotion(editor, caret, context, count, rawCount, argument, false);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,35 +19,66 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteVisualAction extends EditorAction {
public class DeleteVisualAction extends VimCommandAction {
public DeleteVisualAction() {
super(new Handler());
}
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_LINE) {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.fromSubMode(mode), false);
}
else {
return VimPlugin.getChange().deleteRange(editor, caret, range, SelectionType.fromSubMode(mode), false);
}
}
});
}
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
SelectionType.fromSubMode(mode), false);
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("d", "x", "<Del>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,38 +19,68 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
/**
*/
public class DeleteVisualLinesAction extends EditorAction {
public DeleteVisualLinesAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
/**
* @author vlan
*/
public class DeleteVisualLinesAction extends VimCommandAction {
public DeleteVisualLinesAction() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_BLOCK) {
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
SelectionType.fromSubMode(mode), false);
return VimPlugin.getChange()
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), range, SelectionType.fromSubMode(mode),
false);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
}
}
});
}
return CommandGroups.getInstance().getChange().deleteRange(editor, range, SelectionType.LINE_WISE, false);
}
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("X");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,46 +19,74 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
/**
*/
public class DeleteVisualLinesEndAction extends EditorAction {
public DeleteVisualLinesEndAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends VisualOperatorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
if (range.isMultiple()) {
int[] starts = range.getStartOffsets();
int[] ends = range.getEndOffsets();
/**
* @author vlan
*/
public class DeleteVisualLinesEndAction extends VimCommandAction {
public DeleteVisualLinesEndAction() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
if (CommandState.inVisualBlockMode(editor)) {
final int[] starts = range.getStartOffsets();
final int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
if (ends[i] > starts[i]) {
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
range = new TextRange(starts, ends);
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
SelectionType.BLOCK_WISE, false);
final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange()
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), blockRange, SelectionType.BLOCK_WISE, false);
}
else {
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
}
}
});
}
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
SelectionType.LINE_WISE, false);
}
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("D");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_EXIT_VISUAL;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,23 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertAfterCursorAction extends EditorAction {
public InsertAfterCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertAfterCursor(editor, context);
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertAfterCursor(editor, context);
return true;
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,23 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertAfterLineEndAction extends EditorAction {
public InsertAfterLineEndAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertAfterLineEnd(editor, context);
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertAfterLineEnd(editor, context);
return true;
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,23 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertAtPreviousInsertAction extends EditorAction {
public InsertAtPreviousInsertAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertAtPreviousInsert(editor, context);
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
return true;
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -20,24 +20,50 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertBeforeCursorAction extends EditorAction {
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class InsertBeforeCursorAction extends VimCommandAction {
public InsertBeforeCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertBeforeCursor(editor, context);
super(new ChangeEditorActionHandler() {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertBeforeCursor(editor, context);
return true;
}
});
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("i", "<Insert>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@Override
public int getFlags() {
return Command.FLAG_MULTIKEY_UNDO;
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -21,23 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertBeforeFirstNonBlankAction extends EditorAction {
public InsertBeforeFirstNonBlankAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
CommandGroups.getInstance().getChange().insertBeforeFirstNonBlank(editor, context);
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
return true;
}
});
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
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;
/**
*/
@@ -33,13 +36,19 @@ public class InsertCharacterAboveCursorAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().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
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
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;
/**
*/
@@ -33,13 +36,19 @@ public class InsertCharacterBelowCursorAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return CommandGroups.getInstance().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
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,17 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -33,9 +38,15 @@ public class InsertDeleteInsertedTextAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return CommandGroups.getInstance().getChange().insertDeleteInsertedText(editor);
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().insertDeleteInsertedText(editor, caret);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -19,12 +19,17 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -33,9 +38,15 @@ public class InsertDeletePreviousWordAction extends EditorAction {
super(new Handler());
}
private static class Handler extends AbstractEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return CommandGroups.getInstance().getChange().insertDeletePreviousWord(editor);
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().insertDeletePreviousWord(editor, caret);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -23,7 +23,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.VimPlugin;
import org.jetbrains.annotations.NotNull;
/**
@@ -35,7 +35,7 @@ public class InsertEnterAction extends EditorAction {
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
CommandGroups.getInstance().getChange().processEnter(InjectedLanguageUtil.getTopLevelEditor(editor), context);
VimPlugin.getChange().processEnter(InjectedLanguageUtil.getTopLevelEditor(editor), context);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -18,24 +18,53 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.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.group.CommandGroups;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
/**
*/
public class InsertExitModeAction extends EditorAction {
public InsertExitModeAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class InsertExitModeAction extends VimCommandAction {
private static final String ACTION_ID = "VimInsertExitMode";
protected InsertExitModeAction() {
super(new EditorActionHandlerBase() {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEscape(editor, context);
return true;
}
});
}
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
CommandGroups.getInstance().getChange().processEscape(InjectedLanguageUtil.getTopLevelEditor(editor), context);
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-[>", "<C-C>", "<Esc>", "<C-\\><C-N>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
public static VimCommandAction getInstance() {
return (VimCommandAction)ActionManager.getInstance().getAction(ACTION_ID);
}
}

View File

@@ -1,41 +0,0 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 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.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.group.CommandGroups;
import org.jetbrains.annotations.NotNull;
/**
*/
public class InsertHelpAction extends EditorAction {
public InsertHelpAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
CommandGroups.getInstance().getChange().insertHelp(InjectedLanguageUtil.getTopLevelEditor(editor), context);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2013 The IdeaVim authors
* 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
@@ -23,7 +23,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.VimPlugin;
import org.jetbrains.annotations.NotNull;
/**
@@ -35,7 +35,7 @@ public class InsertInsertAction extends EditorAction {
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
CommandGroups.getInstance().getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context);
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context);
}
}
}

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