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

Compare commits

...

745 Commits
0.50 ... 0.53

Author SHA1 Message Date
Alex Plate
60caac5139 Update CHANGES.md 2019-08-07 14:14:01 +03:00
Alex Plate
307e438a1e [EA-128752] Fix NPE on isPrimaryEditor 2019-08-06 15:38:33 +03:00
Alex Plate
89489f7c7f [EA-144484] Fix NPE on panel activation 2019-08-06 15:15:31 +03:00
Alex Plate
923a4706a0 [EA-137898] Fix file is invalid exception 2019-08-06 14:23:03 +03:00
Alex Plate
2594c7179e [EA-138502] Control-flow exceptions (like ProcessCanceledException) should never be logged 2019-08-06 14:21:33 +03:00
Alex Plate
0e2289caa6 [EA-129083] Fix OOBE for # action 2019-08-05 20:39:07 +03:00
Alex Plate
be26968237 [EA-138309] Fix possible exception 2019-08-05 20:20:44 +03:00
Alex Plate
022f1ededc Fix caret shape after enabling of plugin 2019-08-05 19:50:32 +03:00
Alex Plate
70a19dd95d Fix positioning on the end line in insert mode 2019-08-05 19:19:46 +03:00
Alex Plate
00b3f5b9f5 Update CHANGES.md 2019-08-05 13:59:49 +03:00
Alex Plate
8b0bb413d8 Merge pull request #198 from citizenmatt/bug/ex-dead-keys
Fix exception with dead keys in ex entry
2019-08-05 13:14:14 +03:00
Matt Ellis
bd5e7d94fe Fix tests 2019-08-02 21:21:32 +01:00
Matt Ellis
d43b2364a0 Reset ex entry panel when emulation is disabled 2019-08-02 16:49:00 +01:00
Matt Ellis
610e73d9e3 Merge branch 'master' into bug/ex-dead-keys 2019-08-02 13:55:31 +01:00
Alex Plate
6f2a454d46 [EA-141098] Fix exception during surround 2019-08-02 15:30:45 +03:00
Alex Plate
4edce29d53 [EA-209287] Fix exception on file close 2019-08-02 15:25:40 +03:00
Alex Plate
ed2b8dd129 Fix ex search for japanese language 2019-08-02 14:03:30 +03:00
Alex Plate
42cdb36a51 Update CHANGES.md 2019-08-01 18:48:47 +03:00
Alex Plate
159c22ac21 [EA-117268 2352322] Fix OOBE for check in string function 2019-08-01 18:34:50 +03:00
Alex Plate
75b6833245 [EA-117268 2386601] Fix OOBE for sentence detection 2019-08-01 18:34:49 +03:00
Alex Plate
b567717c75 [EA-117268 2394021] Fix OOBE for isEmptyLine function 2019-08-01 18:34:49 +03:00
Alex Plate
b2af829e2e [EA-117268 5135780] Fix OOBE for display ascii info 2019-08-01 18:34:49 +03:00
Alex Plate
6e81714937 [EA-117268 5154892] Fix OOBE for motion outer word 2019-08-01 18:34:49 +03:00
Alex Plate
cb9474d8d0 [EA-117268 5159449] Fix exception for inser character around cursor 2019-08-01 18:34:49 +03:00
Alex Plate
be47e4c050 [EA-117268 5165327] Fix a' for last caret position 2019-08-01 18:34:45 +03:00
Alex Plate
c301898147 [EA-117268 5167045] Fix das for empty file 2019-08-01 17:35:51 +03:00
Alex Plate
8324561022 Remove code comments 2019-08-01 17:17:06 +03:00
Alex Plate
834d630ef7 [EA-117268] Fix exception with w action 2019-08-01 17:09:43 +03:00
Alex Plate
c6259adad1 [VIM-1743] Do not show ideaput notification during surround 2019-08-01 16:03:11 +03:00
Alex Plate
9d1be34958 [VIM-1648] Make S&R self synchronized 2019-08-01 13:20:00 +03:00
Alex Plate
ce4e64ec40 Create annotations to annotate whenever a function require write/read lock 2019-07-31 21:15:32 +03:00
Alex Plate
b017466270 Clean up searchAndReplace method 2019-07-31 20:35:10 +03:00
Alex Plate
568d2304ea Ex commands should define write/read access explicitly 2019-07-31 20:15:09 +03:00
Alex Plate
5dc1b245d0 Get rid of OTHER_READ_WRITE flag because technically it's right action 2019-07-31 16:56:57 +03:00
Alex Plate
978d95b351 Clean up ex command processing 2019-07-31 16:47:19 +03:00
Alex Plate
90079c9dfe Remove legacy DONT_REOPEN flag
It's not used since 18cd7547
2019-07-31 16:26:48 +03:00
Alex Plate
57dec7e211 Fix mouse click appearance 2019-07-30 19:32:54 +03:00
Alex Plate
fa75c853a7 Update mouse pressed caret rules 2019-07-30 18:53:03 +03:00
Alex Plate
0887a57e29 [VIM-1725] Enable selection adjustment with a small delay 2019-07-30 17:52:34 +03:00
Alex Plate
18901dcd44 [EA-104755] Fix "Editor is disposed" exception with CTRL-O command 2019-07-29 20:11:20 +03:00
Alex Plate
caecbe5b63 Reformat isEndAllowed method 2019-07-26 20:24:54 +03:00
Alex Plate
077cab656b [EA-209305] Fix SO exception on enabling disabled plugin 2019-07-26 19:57:09 +03:00
Alex Plate
95d7a7e860 Insert some inferred annotations 2019-07-26 16:10:30 +03:00
Alex Plate
77a77c34b8 Fix possible NPE 2019-07-26 16:09:25 +03:00
Alex Plate
fa78cc2a9f Add Naveen Kumar Molleti to contributors list 2019-07-26 16:03:00 +03:00
Alex Plate
03f18af66f Temporaly get back ideajoin-examples because of help link in release
Revert "Move ideajoin examples to wiki"

This reverts commit d06f2a2d
2019-07-26 16:01:12 +03:00
Alex Plate
4e21145808 Merge pull request #200 from NOLFXceptMe/master
Fix ideajoin examples URL
2019-07-26 15:59:39 +03:00
Alex Plate
258557ee5d [VIM-1713] Add possibility to get ExEntryPanel without shortcuts 2019-07-26 15:27:30 +03:00
Alex Plate
88ad420716 Update kotlin version 2019-07-26 12:04:08 +03:00
Naveen Kumar Molleti
4828e40f0d Fix ideajoin examples URL 2019-07-25 17:49:34 -07:00
Alex Plate
5be29f5a07 Convert ExKeyBindings to kotlin 2019-07-25 18:29:31 +03:00
Alex Plate
48ac99a29b WIP: Renaming file 'ExKeyBindings' with Kotlin extension 2019-07-25 17:20:59 +03:00
Alex Plate
2c4f2139dd Fix warnings 2019-07-25 13:52:07 +03:00
Alex Plate
47236c1e6c Convert VimSurroundExtenstionTest to kotlin 2019-07-25 13:28:00 +03:00
Alex Plate
5d8996dc38 WIP: Renaming file 'VimSurroundExtensionTest' with Kotlin extension 2019-07-25 13:24:00 +03:00
Alex Plate
9feff84125 [VIM-1710] Fix opening empty file with "relative number" enabled 2019-07-24 16:34:42 +03:00
Alex Plate
c0fc62a1d6 [VIM-1712] Fix Y command for visual mode 2019-07-24 15:56:19 +03:00
Alex Plate
6b06d58759 [VIM-1711] Search is not triggered during surround action 2019-07-24 15:10:48 +03:00
Alex Plate
d06f2a2d18 Move ideajoin examples to wiki 2019-07-24 12:20:23 +03:00
Alex Plate
7c5dca202e Preparation to 0.52 version 2019-07-23 14:18:31 +03:00
Alex Plate
055e006c27 Github doesn't recognize jetbrains:// url 2019-07-22 16:22:05 +03:00
Alex Plate
2f11451f9d Update EAP section for README 2019-07-22 14:51:38 +03:00
Alex Plate
5b8d5ca72a Add test for template notification 2019-07-18 17:39:02 +03:00
Alex Plate
40cd8b65d7 Revert "Update deprecated method"
This reverts commit 3ec6bb84
2019-07-18 17:25:14 +03:00
Alex Plate
3ec6bb84ee Update deprecated method 2019-07-18 17:17:44 +03:00
Alex Plate
180c870208 Add notification for enabling select mode while template editing 2019-07-18 17:13:02 +03:00
Alex Plate
5a81d02271 Create doc with explanation of handlers and commands structure 2019-07-18 14:18:11 +03:00
Alex Plate
465abf47c8 Use enum for parser state machine 2019-07-18 13:24:04 +03:00
Alex Plate
54544c2683 [VIM-1359] Fix behavior of i_Ctrl-W action 2019-07-18 12:32:54 +03:00
Alex Plate
cf41b8745a Fixing execution actions from visual mode 2019-07-17 20:14:51 +03:00
Alex Plate
1a1fc8604a Remove unused arguments from some methods 2019-07-17 18:19:15 +03:00
Alex Plate
b9ecf20596 Reorganize tests for ex commands 2019-07-17 16:00:41 +03:00
Alex Plate
1326e8470a Update docs of IdeaVim 2019-07-17 15:39:20 +03:00
Alex Plate
68ae03ef85 Replace behaviour to the american-style behavior 2019-07-17 14:39:09 +03:00
Alex Plate
8750c30b7d Move to selection start/end in select mode if template is active 2019-07-17 14:34:54 +03:00
Alex Plate
869945e68c Extract template checking into separate file 2019-07-17 13:41:10 +03:00
Alex Plate
c263881586 Log about new shape of caret 2019-07-17 13:26:09 +03:00
Alex Plate
b56c82cefb Move tests to correct package 2019-07-17 12:54:43 +03:00
Alex Plate
7d936041c0 Create toSimpleString function for CommandState.State 2019-07-16 19:12:12 +03:00
Alex Plate
8208def57a Add logging to entering visual mode 2019-07-16 17:22:10 +03:00
Alex Plate
a0ead808d5 Add tests for put with idea 2019-07-16 17:10:31 +03:00
Alex Plate
95e7464962 Remove mnemonics for actions 2019-07-16 15:41:10 +03:00
Alex Plate
21a299cb2b Test notifications for ideajoin and ideaput 2019-07-16 15:28:29 +03:00
Alex Plate
4f644ee1fe Add notification about ideaput option 2019-07-16 13:36:48 +03:00
Alex Plate
0f7528b73b Create VimState class and move isIdeaJoinNotified to it 2019-07-16 12:25:32 +03:00
Alex Plate
354262ba9b Update ideajoin notification 2019-07-15 19:50:52 +03:00
Alex Plate
7790674d9d Add examples of ideajoin option 2019-07-15 17:27:47 +03:00
Alex Plate
707fb53dda Move all notifications to notification service 2019-07-15 16:23:40 +03:00
Alex Plate
6f356f8390 Replace some java methods with kotlin functions 2019-07-15 14:25:26 +03:00
Alex Plate
dc2530957f Rename smartjoin with ideajoin 2019-07-15 14:22:36 +03:00
Alex Plate
e88dcae1a0 Rename idemarks to ideamarks 2019-07-15 14:19:48 +03:00
Alex Plate
a5fff878c5 Add Brendan Annable to contributors list 2019-07-15 13:07:53 +03:00
Alex Plate
d71d66e8be Merge pull request #199 from BrendanAnnable/patch-1
Fix link typo in CHANGES.md
2019-07-15 13:06:13 +03:00
Brendan Annable
54275a8870 Fix link typo in CHANGES.md 2019-07-15 10:25:32 +10:00
Alex Plate
90eda82045 [VIM-1698] Paste clears clipboard 2019-07-12 19:04:56 +03:00
Alex Plate
6816dc4f75 Update version of jb annotations 2019-07-12 16:36:39 +03:00
Alex Plate
c17ad0ef2d Fix back search in texts with tabs 2019-07-12 16:11:59 +03:00
Alex Plate
3f71f58454 Reformat CharPointer class 2019-07-12 14:34:25 +03:00
Alex Plate
b2055ad44f Update email of Jonatan Tierno 2019-07-12 12:52:05 +03:00
Alex Plate
b3eefc9e25 [VIM-1700] Add tests for some searches with tabs 2019-07-11 17:22:17 +03:00
Alex Plate
41baee7b43 Add VimFunctionMark and VimTestFunction annotations 2019-07-11 16:22:53 +03:00
Alex Plate
fc7d6589bf Add function that converts dots to tabs in tests 2019-07-11 16:22:24 +03:00
Alex Plate
e0e94e482a Add logs to controlSelection 2019-07-11 14:24:02 +03:00
Alex Plate
c5964c270d Add logging to search process 2019-07-11 14:24:00 +03:00
Alex Plate
69c850d1ac Move toCharacterPosition and fromCharPositionToOffset methods to CharacterPosition class 2019-07-11 12:25:26 +03:00
Alex Plate
004d0146b7 WIP: Renaming file 'CharacterPosition' with Kotlin extension 2019-07-11 12:16:33 +03:00
Alex Plate
cee9c81496 [VIM-1697] Fix wrong search with tab characters 2019-07-10 19:07:10 +03:00
Alex Plate
1c01097491 Add new options test 2019-07-10 16:44:06 +03:00
Alex Plate
ae08438b7b Reformat vimOptionTestCase 2019-07-10 14:52:09 +03:00
Alex Plate
440b60bdba Update license formatting 2019-07-10 12:51:10 +03:00
Alex Plate
d83bab55aa Make tabs more viewable for developers 2019-07-10 12:50:40 +03:00
Alex Plate
e1f582bcfc Register new actions in info file 2019-07-09 19:01:24 +03:00
Alex Plate
e50f95abb3 Reset modeBeforeEnteringNonVimVisual before each action 2019-07-09 18:41:33 +03:00
Alex Plate
4e16a8b6f9 Revert "Remove mode restoring after unexpected selection"
This reverts commit e23f5cb1
2019-07-09 15:18:46 +03:00
Alex Plate
cf1ec16fdd Fix macro replay 2019-07-08 17:04:18 +03:00
Alex Plate
e23f5cb159 Remove mode restoring after unexpected selection 2019-07-08 16:54:47 +03:00
Alex Plate
4d07171aaa Convert UndoRedoHelper to kotlin 2019-07-08 11:48:23 +03:00
Alex Plate
7c50662ef6 WIP: Renaming file 'UndoRedoHelper' with Kotlin extension 2019-07-08 11:46:44 +03:00
Alex Plate
90126b4d29 Remove unused action 2019-07-05 16:21:33 +03:00
Alex Plate
7580af1b5f Support ctrl-up and ctrl-down jumps 2019-07-05 16:07:57 +03:00
Alex Plate
8188203aed Remove version from javadocs 2019-07-05 14:17:17 +03:00
Alex Plate
d91f5461d5 Plugin listeners are not loaded if plugin is disabled 2019-07-05 13:24:39 +03:00
Alex Plate
066b18c792 Do not move one char back in insert mode 2019-07-05 12:40:47 +03:00
Alex Plate
91de1004e6 Fix small code smells 2019-07-05 12:22:25 +03:00
Alex Plate
fecd2d7111 Use BaseComponent instead of deprecated ApplicationComponent 2019-07-05 12:17:54 +03:00
Alex Plate
07dd0884f3 Fix "explicit type" inspection 2019-07-04 18:39:29 +03:00
Alex Plate
a1fb97bd90 Remove some deprecations 2019-07-04 17:52:29 +03:00
Alex Plate
2e002d76b2 Replace deprecated getTopLevelEditor method 2019-07-04 17:40:13 +03:00
Alex Plate
aa13742c9a Remove deprecated rightJustify and leftJustify methods 2019-07-04 17:09:56 +03:00
Alex Plate
7effcb3aac Define action place for executable actions 2019-07-04 16:48:23 +03:00
Alex Plate
19a4610373 Add tests for visual change functionality 2019-07-03 18:11:19 +03:00
Andrey Vlasovskikh
4cdbbaa35d Token-based auth for publishing the plugin 2019-07-02 18:40:23 +03:00
Alex Plate
e2a8ba7f0c Add gradle task with slack notifications about EAP releases 2019-07-02 17:28:12 +03:00
Alex Plate
1923e14ac4 Update CHANGES 2019-07-02 16:04:33 +03:00
Alex Plate
6d1869af61 [VIM-1668] Fix smart step into 2019-07-02 14:22:15 +03:00
Alex Plate
6e005a0c62 Fir exception in paste via IDE 2019-07-02 13:18:48 +03:00
Alex Plate
5d88558b36 Update kotlin version 2019-07-02 12:44:50 +03:00
Alex Plate
2770634627 Protection against wrong handlers 2019-07-01 20:14:27 +03:00
Alex Plate
1602ab2355 Add logs to controlNonVimSelectionChange 2019-07-01 17:30:28 +03:00
Alex Plate
7a37cb6f0b Checking whether current mode is command before entering insert mode 2019-07-01 16:21:55 +03:00
Alex Plate
4d6de7500e [VIM-752] Finish template from normal mode 2019-07-01 15:33:09 +03:00
Alex Plate
13d36de121 WIP: Renaming file 'MotionDownFirstNonSpaceAction' with Kotlin extension 2019-07-01 15:05:22 +03:00
Alex Plate
ae992ed366 Convert Argument.java to kotlin 2019-07-01 14:48:27 +03:00
Alex Plate
c03b16a6e8 WIP: Renaming file 'Argument' with Kotlin extension 2019-07-01 14:39:40 +03:00
Alex Plate
7823291b44 Fix NPE while moving caret 2019-07-01 14:31:44 +03:00
Alex Plate
59d79cc329 Add debug info about pushing and popping state 2019-07-01 14:24:32 +03:00
Alex Plate
c24ebf3427 Create test for validating info file 2019-06-28 14:22:50 +03:00
Alex Plate
434d5be26c Enable identity checker for unit test mode 2019-06-28 12:38:39 +03:00
Alex Plate
f904ceae7a Remove bad test 2019-06-28 12:21:02 +03:00
Alex Plate
9e62eefee0 Write better logs during execution 2019-06-27 19:57:30 +03:00
Alex Plate
7fdb31abf0 Fix problems of actions registration
Different vim tree were build by different orders of command registering
2019-06-27 19:34:15 +03:00
Alex Plate
e1d4e2f526 Fix few caret position problems 2019-06-27 15:50:46 +03:00
Alex Plate
f18e317dcf Reformat all listeners in project 2019-06-27 12:19:14 +03:00
Alex Plate
e143a286ef Do not reset caret on small mouse dragging 2019-06-26 19:31:56 +03:00
Alex Plate
faa9c26283 Reformat resetCursor function 2019-06-26 19:21:45 +03:00
Alex Plate
da182f5539 Add protection for cases when vimSelectionStart is null in visual mode 2019-06-26 19:08:21 +03:00
Alex Plate
ced51e37b4 Convert all commands to VimCommandAction 2019-06-26 18:51:55 +03:00
Alex Plate
f61134fd69 Use VimCommandAction for insert commands 2019-06-26 15:43:01 +03:00
Alex Plate
578f60ba91 WIP: Renaming file 'ShiftRightLinesAction' with Kotlin extension 2019-06-26 15:29:42 +03:00
Alex Plate
02effac75c WIP: Renaming file 'ShiftLeftLinesAction' with Kotlin extension 2019-06-26 15:26:11 +03:00
Alex Plate
72f4b21aea Use VimCommandAction for COPY/PASTE actions 2019-06-26 13:53:58 +03:00
Alex Plate
1aa59afaf0 WIP: Renaming file 'YankLineAction' with Kotlin extension 2019-06-26 13:46:18 +03:00
Alex Plate
45df3ed168 Use VimCommandAction for NVO actions 2019-06-26 13:33:20 +03:00
Alex Plate
b344972931 WIP: Renaming file 'MotionScrollPageUpAction' with Kotlin extension 2019-06-26 13:24:33 +03:00
Alex Plate
7886a816b2 WIP: Renaming file 'MotionScrollPageDownAction' with Kotlin extension 2019-06-26 13:12:21 +03:00
Alex Plate
4722730aff Move userData functions to UserDataManager.kt 2019-06-26 12:29:11 +03:00
Alex Plate
27a2c6192f Rename CaretData to UserDataManager 2019-06-25 16:49:15 +03:00
Alex Plate
db77d133dc Use userData() for managing editor's user data 2019-06-25 16:48:46 +03:00
Alex Plate
000ebfaf2f Fix all missing @Override annotations 2019-06-25 15:20:31 +03:00
Alex Plate
a47001516d Reformat HandlerBase 2019-06-25 15:18:37 +03:00
Alex Plate
fa9901271a WIP: Renaming file 'EditorActionHandlerBase' with Kotlin extension 2019-06-25 15:18:37 +03:00
Alex Plate
913e8c355b Fix tests after reformat 2019-06-25 15:18:36 +03:00
Alex Plate
aeef2f8948 Reformat ChangeEditorActionHandler 2019-06-25 15:18:36 +03:00
Alex Plate
9be8e2b5b9 WIP: Renaming file 'ChangeEditorActionHandler' with Kotlin extension 2019-06-25 15:18:36 +03:00
Alex Plate
99b68801d9 Remove CaretOrder 2019-06-25 15:18:36 +03:00
Alex Plate
4c766298f1 Change hierarchy of handlers 2019-06-25 15:18:36 +03:00
Alex Plate
2618d09ef8 VimCommandAction accepts EditorActionHandlerBase 2019-06-25 15:18:36 +03:00
Alex Plate
2bef98408c MotionEditorAction new inherits VimCommandAction 2019-06-25 15:18:35 +03:00
Alex Plate
dbf90d4f37 Rename .java to .kt 2019-06-25 15:18:35 +03:00
Alex Plate
1e378dd1dd Fix duplicated key mappings 2019-06-25 15:18:35 +03:00
Alex Plate
fa51c25919 TextObjects have now always MOTION type 2019-06-25 15:18:35 +03:00
Alex Plate
c880f49b81 Convert registerCommandLineActions to VimCommandAction 2019-06-25 15:18:35 +03:00
Alex Plate
1835220ba3 Convert registerVariousModesActions to VimCommandAction 2019-06-25 15:18:35 +03:00
Alex Plate
813126cecb Merge pull request #195 from citizenmatt/feature/search
Fixes some bugs with search highlights and behaviour, bringing behaviour more in line with Vim.

  VIM-1535 - Use same text attributes ("Text search results") and highlight layer (selection - 1) as IntelliJ's own Find feature. This makes search results more visible. Previously, it would add the highlight below e.g. "identifier under caret" and would use the same colours as Highlight Usages, meaning the current search highlight could easily be lost.
  Hide IntelliJ's Find results when starting incsearch, and hide IdeaVim search results when starting IntelliJ Find
  Add tests for search highlights and incremental search behaviour
  Move the current line during incremental search. Original caret location and scroll position is restored if the search is cancelled
  Search highlights are reset and redrawn when the ignorecase, smartcase and hlsearch options are modified. Does not redraw if the highlights have been hidden with :nohlsearch
  Highlight all find results instead of just first with incsearch and hlsearch enabled
  Remove old search highlights when starting to type a new search with incsearch and hlsearch enabled
  Highlight first search result if incsearch is disabled, and hlsearch is enabled (as per Vim)
  Incremental search correctly strips trailing options, e.g. /Foo/+1
  Add incremental search while typing :substitute command (as per Vim). Does not handle :global, :vglobal, :smagic or :snomagic, as these aren't supported by IdeaVim
  Fix disabling Vim emulation does not remove search highlights
  VIM-1413 - Fix smartcase option being ignored in incremental search.
  VIM-128 - Fix :substitute not respecting ignorecase and smartcase options
  Fix next/previous search not handling smartcase override for search next word. E.g. * on Editor overrides smartcase. Now n/N will remember if smartcase was overridden.
  Only close ex entry on <BS> if there is no text
  Treat <Del> at end of ex entry text as <BS>
  VIM-1682 - Fix exception when searching backwards
  Fix exception when trying to show search highlights for the last \n in the file
2019-06-25 15:14:58 +03:00
Matt Ellis
86dbd3a03a Correctly recognise abbreviated command in incsearch 2019-06-22 15:08:31 +02:00
Matt Ellis
948c2cd021 Only show one set of search results
Don't allow both IntelliJ and IdeaVim highlights to be visible at the same time
2019-06-22 15:08:20 +02:00
Alex Plate
f9ca77a982 Merge branch 'master' into feature/search 2019-06-20 15:13:15 +03:00
Matt Ellis
2aa45b8794 Merge branch 'master' into feature/search 2019-06-20 12:14:55 +02:00
Alex Plate
3a056dc844 Update CHANGES.md 2019-06-19 16:09:39 +03:00
Alex Plate
2b2fc27899 [VIM-608] Call save actions for :w commands 2019-06-19 16:06:21 +03:00
Alex Plate
35d5eb1713 Fix tests for idea marks 2019-06-19 15:30:37 +03:00
Alex Plate
86fab38407 [VIM-959] Add idemarks option 2019-06-19 13:45:18 +03:00
Matt Ellis
866fe5cc8d Merge branch 'master' into feature/search 2019-06-18 20:07:21 +02:00
Alex Plate
2845f8543c Use objects for options 2019-06-18 20:08:02 +03:00
Alex Plate
011699d58f Add notification about smartjoin option 2019-06-18 17:23:52 +03:00
Alex Plate
ddd37f5bee Reformat Options file 2019-06-18 16:27:40 +03:00
Alex Plate
44202b5c4d Rename .java to .kt 2019-06-18 16:11:09 +03:00
Matt Ellis
b157d07b6d Improve handling of Delete and Backspace in ex entry 2019-06-18 13:27:32 +01:00
Matt Ellis
31d30a9115 Only close ex entry with backspace if no text 2019-06-18 11:49:55 +01:00
Matt Ellis
cc7ee5acc0 Remove unused action 2019-06-18 11:44:44 +01:00
Matt Ellis
35bcb627c2 Correctly start/reset highlighting with :s command 2019-06-15 11:21:02 +01:00
Matt Ellis
a7882fadba Reorder methods. No other changes 2019-06-15 10:39:59 +01:00
Alex Plate
fe4525b441 Add smartjoin option 2019-06-14 19:05:53 +03:00
Alex Plate
e17594a7aa Remove VimFileEditor test case 2019-06-14 17:44:54 +03:00
Matt Ellis
416357bf27 Incsearch highlights current match if nohlsearch
This also fixes a bug which would return an incorrect range when searching backwards, and two matches are found on a line, one before and one after the search position. This is due to reusing a reference, rather than making a copy. This was never discovered because we only used the start offset, not the end!
2019-06-14 15:43:20 +01:00
Alex Plate
ae021ea930 Update indent for kt test files 2019-06-14 17:10:23 +03:00
Matt Ellis
32735a5e06 Fix start offset for incsearch with :s command 2019-06-14 12:20:07 +01:00
Matt Ellis
5b1d26263b Add incsearch highlights for :substitute command
Includes support for :global and :vglobal for when IdeaVim adds them
2019-06-14 10:39:07 +01:00
Alex Plate
84be5bc732 Reformat Motion and Visual handlers 2019-06-13 19:28:43 +03:00
Alex Plate
bf1dee2bc4 Reformat CommandHandler 2019-06-13 18:43:49 +03:00
Alex Plate
e0aadacf93 Remove flags function 2019-06-13 17:30:20 +03:00
Alex Plate
35481682a9 Fix NPE on text preprocessing during insert 2019-06-13 16:09:27 +03:00
Alex Plate
64291d336c Fix selection with mouse on line end 2019-06-13 15:21:00 +03:00
Alex Plate
3fe1ee4bd8 Fix problems with vertical movement 2019-06-13 15:01:31 +03:00
Matt Ellis
130a8d0f00 Disable search highlights when disabling plugin 2019-06-13 11:51:25 +01:00
Matt Ellis
36c4596a08 Fix exception with dead keys in ex entry
Will also highlight composed text on Mac
2019-06-11 19:57:11 +01:00
Alex Plate
ebad3812e4 Add docs for TextObjectActionHandler 2019-06-11 19:52:31 +03:00
Alex Plate
004c1c915f Rename VimActionCommand to VimCommands 2019-06-11 19:52:25 +03:00
Alex Plate
39bd13a6ca Migrate text object to new registration model 2019-06-11 19:42:52 +03:00
Alex Plate
f10ac679e2 Rename .java to .kt 2019-06-11 19:36:55 +03:00
Alex Plate
8d49012d64 Reformat VimCommandAction: get handler from makeHandler method 2019-06-11 16:00:37 +03:00
Alex Plate
91392c1e83 Convert VimActionHandler to kotlin 2019-06-11 14:10:43 +03:00
Alex Plate
65bb31e92a Rename .java to .kt 2019-06-11 14:10:43 +03:00
Alex Plate
c06fa72936 Remove empty javadocs 2019-06-11 13:20:53 +03:00
Alex Plate
a1adb1eb43 Create noneOfEnum helper function 2019-06-11 13:15:52 +03:00
Alex Plate
778ddb0e75 Support gn text objects 2019-06-11 13:06:36 +03:00
Alex Plate
e919a026b7 Remove secondary carets on gn search 2019-06-11 12:01:56 +03:00
Alex Plate
a78f78604a Move gn commands to motion package 2019-06-11 11:58:06 +03:00
Alex Plate
eeea093bb8 Improve performance of gn command 2019-06-11 11:49:59 +03:00
Alex Plate
b795c62ab7 Reformat SearchGroup file 2019-06-10 16:29:17 +03:00
Alex Plate
b7c7b268d4 Add Jonatan Tierno to contributors list 2019-06-10 14:59:38 +03:00
Alex Plate
f7b9351e38 Merge pull request #134 from jonatantierno/master
VIM-635. Command gn.
2019-06-10 14:53:49 +03:00
Alex Plate
4e205d078d Merge branch 'master' into pull/134
# Conflicts:
#	src/com/maddyhome/idea/vim/group/MotionGroup.java
2019-06-10 14:48:50 +03:00
Alex Plate
16016cb13d [VIM-714] Fix caret vertical movements problems 2019-06-10 13:27:20 +03:00
Alex Plate
4754fff89b Use primary caret for post move in case of block selection 2019-06-10 13:15:32 +03:00
Alex Plate
f88ed69f1f Support new external java plugin for 192+ versions 2019-06-10 12:36:06 +03:00
Alex Plate
2e7f7cf642 Fix tests with visual selection 2019-06-10 11:17:12 +03:00
Matt Ellis
60f9403657 Incsearch highlights all matches + current match 2019-06-07 23:33:05 +01:00
Alex Plate
4c9974f7eb Update intellij plugin and set default idea version to 2019.1 2019-06-07 20:59:21 +03:00
Alex Plate
eace5c5543 Fix typo 2019-06-07 16:19:34 +03:00
Alex Plate
f6d16ea4d9 Protection for empty file 2019-06-07 15:15:11 +03:00
Alex Plate
ac2f11360c Extract some methods to CommandStateExtensions 2019-06-07 15:04:57 +03:00
Alex Plate
48a5eee9ab Put information about leaving feedback to EAP section 2019-06-07 12:34:47 +03:00
Alex Plate
380156aa4b Use star register for clipboard test 2019-06-06 16:53:09 +03:00
Alex Plate
d4cd8a228f Move ideaput option to 'clipboard options' 2019-06-06 14:48:19 +03:00
Alex Plate
6081f1d5ff Merge pull request #197 from JetBrains/IdeaPut
VIM-25 Smart put operations (via IJ)
2019-06-06 14:08:06 +03:00
Alex Plate
0139967b29 Avoid dragging when select a word with double click 2019-06-06 13:27:06 +03:00
Alex Plate
0a30a42b2e Avoid dragging when put caret on the line end 2019-06-06 13:16:41 +03:00
Matt Ellis
ff54bfa5b3 Merge branch 'master' into feature/search 2019-06-05 20:47:34 +01:00
Matt Ellis
22445f6df9 Add tests for hlsearch and incsearch 2019-06-05 20:24:38 +01:00
Alex Plate
272aa9513a Replace <caret> with ${c} for kotlin tests 2019-06-05 19:00:36 +03:00
Alex Plate
4b1abfc60f Add test for clipboard copy 2019-06-05 18:59:09 +03:00
Alex Plate
b3130f38f2 Add logs for put and copy 2019-06-05 18:50:38 +03:00
Alex Plate
32fdbaccc3 VIM-25 Smart put operations (via IJ) 2019-06-05 15:49:31 +03:00
Alex Plate
8a4d3f5d80 Use 2-space indentation for kotlin files 2019-06-05 15:26:18 +03:00
Alex Plate
920af04b04 Added Pierce Corcoran to the contributors list 2019-06-04 18:01:13 +03:00
Alex Plate
7d13d22650 Merge pull request #161 from thecodewarrior/unnamed-register-selection-type
VIM-1473 Fixed incorrect selection type for unnamed registers
2019-06-04 17:54:33 +03:00
Alex Plate
6c17725823 [VIM-438] Enable <C-N> and <C-P> for lookups 2019-06-03 20:00:17 +03:00
Matt Ellis
f3b1ddf439 Merge branch 'master' into feature/search 2019-06-03 16:42:39 +01:00
Matt Ellis
c7de374943 Refactor highlighting API calls 2019-06-03 16:39:01 +01:00
Alex Plate
1bb6345fcb Refactor put group 2019-05-31 19:27:43 +03:00
Alex Plate
cbc5e8aea1 Make visual put single-executable
Preparation for VIM-25
2019-05-31 19:27:43 +03:00
Alex Plate
7ebb888c31 WIP: Renaming file 'PutVisualTextNoIndentAction' with Kotlin extension 2019-05-31 19:27:43 +03:00
Alex Plate
93c6a03287 WIP: Renaming file 'PutVisualTextMoveCursorAction' with Kotlin extension 2019-05-31 19:27:43 +03:00
Alex Plate
ae97fbbcc3 WIP: Renaming file 'PutVisualTextAction' with Kotlin extension 2019-05-31 19:27:42 +03:00
Alex Plate
7ef381f1a4 Make 192-EAP-SNAPSHOT as a default idea version 2019-05-31 19:02:43 +03:00
Alex Plate
70fad46534 Fill CHANGES.MD with fixed bugs 2019-05-31 17:51:28 +03:00
Alex Plate
cb8d253dc5 Fix compilation for IC-2019.1 2019-05-31 16:48:54 +03:00
Alex Plate
cacab1e039 Make companion object private in VisualOperatorActionHandler 2019-05-31 16:40:38 +03:00
Alex Plate
0bf49ebe9a Event could be null in IdeaSpecifics 2019-05-31 16:31:38 +03:00
Alex Plate
fa9b1933fa Merge pull request #186 from JetBrains/VIM-510
This huge branch was created as a result of VIM-510. It provides many
changes aiming to solve the problems associated with selection.

Main changes:

Introducing select mode.
[VIM-510] Structural selection enables visual mode.
[VIM-274] During refactoring, select mode is enabled (which works almost
like normal IntelliJ IDEA selection).
2019-05-31 12:24:33 +03:00
Alex Plate
444f676d2d Move connection to message but in IdeaSpecifics to EventFacade 2019-05-30 12:39:03 +03:00
Alex Plate
2ccba4b345 Remove @Deprecated from TextRange class 2019-05-30 12:34:25 +03:00
Alex Plate
0b76e86ace Create different method for isVisualBlock and isBlockSubMode 2019-05-30 12:26:13 +03:00
Alex Plate
f40a86e744 Refactorings after review 2019-05-30 12:18:42 +03:00
Alex Plate
5b594a4a7b Fix bad visual -> motion refactoring 2019-05-30 12:16:59 +03:00
Alex Plate
ea857b9c7b Fix single execution for visual operation 2019-05-28 15:44:04 +03:00
Alex Plate
14a11f06e5 Merge pull request #196 from citizenmatt/VIM-1061
VIM-1061 Explicitly register shortcuts for digraphs

Ensures that the keyboard shortcuts required for digraphs (<C-K>, <C-V>, <C-Q> and <BS>) are all explicitly registered.

Digraphs are handled directly by the key handler, so there is no action that can provide keys to be registered. If the keys aren't registered, the key stroke doesn't get to the key handler and digraphs don't work.

Technically, these shortcuts are already registered by other actions, but it is better to be explicit, as VIM-1061 demonstrates. Digraphs with <C-K> were broken in 0.51, but fixed by accident by #194, which included the key sequence <C-W><C-K>, meaning <C-K> is registered.

Tests are not possible for this change as it affects the IDE event loop and the tests invoke handleKey directly,
2019-05-27 15:55:07 +03:00
Matt Ellis
987c89774c VIM-1061 Explicitly register shortcuts for digraphs 2019-05-24 15:34:21 +01:00
Alex Plate
52d0c44014 Fix enter action for select mode 2019-05-24 15:43:21 +03:00
Alex Plate
e70d188b82 Add logging for visual operations 2019-05-24 15:13:37 +03:00
Alex Plate
9419c4b796 Fix gq (reformat code) action 2019-05-24 14:52:36 +03:00
Alex Plate
58c6aba6af Move all special keys handlers to single file 2019-05-24 12:00:40 +03:00
Alex Plate
d09ae1a66e Fix bad refactoring 2019-05-24 11:54:05 +03:00
Alex Plate
12717d13de Make VisualStartFinishWrapper private 2019-05-24 11:52:04 +03:00
Alex Plate
b363a05a7d Remove caretMergingListener in finally block 2019-05-24 11:51:12 +03:00
Alex Plate
318515db6f Rename Util to Helper 2019-05-24 11:46:08 +03:00
Alex Plate
da7ff06734 Rename acontinue* to acontinue* 2019-05-24 11:41:40 +03:00
Alex Plate
86f4a2743a Remove some items from CONTRIBUTING 2019-05-24 11:38:42 +03:00
Alex Plate
f86a1a0002 Hide alwaysBatchExecution property from inheritors 2019-05-24 11:01:15 +03:00
Alex Plate
e5d4a5f061 Put ShiftedArrowKeyHandler to ShiftedSpecialKeyHandler 2019-05-23 22:23:52 +03:00
Alex Plate
7be884b138 Remove FLAG_FORCE_LINEWISE and FLAG_FORCE_VISUAL flags 2019-05-23 18:06:11 +03:00
Alex Plate
4eacdeec5e Check if caret valid before adjusting selection 2019-05-23 16:09:28 +03:00
Alex Plate
8a9a5919f2 Reset handler after exiting visual mode during tab switch 2019-05-23 15:46:51 +03:00
Alex Plate
442883c377 Make Command data class 2019-05-23 15:26:49 +03:00
Alex Plate
33939917c0 Print actionId of visual command to log 2019-05-22 14:59:51 +03:00
Alex Plate
e1721bf337 Handle backspace via vim with active lookup 2019-05-21 16:53:52 +03:00
Alex Plate
5081ede268 [VIM-1666] properly handling of digraphs after pressing backspace 2019-05-21 15:52:17 +03:00
Alex Plate
393416a925 Format KeyHandler file 2019-05-21 15:49:00 +03:00
Alex Plate
34ec791ba3 Add VimOptionDefault to docs 2019-05-21 12:25:27 +03:00
Alex Plate
f4b80d4d80 Add docs to VimListOptionTestCase 2019-05-20 19:10:37 +03:00
Alex Plate
fcbc1773ad Add VimListOptionTestCase for testing IdeaVim options 2019-05-20 17:34:06 +03:00
Alex Plate
4d971be732 Support End and Shift-End motions 2019-05-20 13:21:24 +03:00
Alex Plate
deff56db29 Extract handler for shifted arrows 2019-05-20 12:54:05 +03:00
Matt Ellis
5b78a02a53 Update CHANGES.md 2019-05-19 20:06:57 +02:00
Matt Ellis
9c5420c79c Fix exception highlighting last CR in file
Custom implementation of offsetToCharacterPosition failed when the text range of the last CR in the file wrapped to a line that didn't exist in the editor. This caused an exception when search highlights included the last CR in the file
2019-05-19 19:40:26 +02:00
Matt Ellis
bd58802ed6 Make incsearch work with entering digraphs 2019-05-17 23:19:02 +01:00
Matt Ellis
71504d0ded Merge branch 'master' into ideavim-search
# Conflicts:
#	src/com/maddyhome/idea/vim/ui/ExEntryPanel.java
2019-05-17 23:00:22 +01:00
Matt Ellis
3aff7693c7 Use same formatting as Find for search/replace 2019-05-17 22:29:59 +01:00
Matt Ellis
b46f426f30 Reset highlights when options change 2019-05-17 22:29:59 +01:00
Matt Ellis
70652d445c Fix next/prev after search word and smartcase
Makes sure that search word forward/backward ignores smartcase for first and subsequent searches.
2019-05-17 22:29:58 +01:00
Matt Ellis
35f96b28bc VIM-128 Substitute works with ignorecase and smartcase 2019-05-17 22:28:40 +01:00
Matt Ellis
dd40bb3850 Move current line during incsearch 2019-05-17 11:26:36 +01:00
Alex Plate
849c0cbd49 Support shifted and non-shifter Home key 2019-05-16 17:22:47 +02:00
Alex Plate
201d613ac1 Extract handler for non-shifted special keys 2019-05-16 16:11:40 +02:00
Alex Plate
8897ecd0d5 Extract handler for shifted special keys 2019-05-16 16:09:39 +02:00
Alex Plate
784a8e625f Set log level to info for VisualCommands 2019-05-16 13:40:05 +02:00
Alex Plate
770cc2cd72 Use !! in tests instead of ?: run 2019-05-15 19:57:17 +02:00
Alex Plate
fa620be738 Fill doc for new commands 2019-05-15 19:40:30 +02:00
Alex Plate
34893e7847 Support the rest of selectmodel options 2019-05-15 18:55:56 +02:00
Alex Plate
c49d5b4ffa Move packages to better location 2019-05-15 15:47:29 +02:00
Alex Plate
c37387db64 Full support for selectmode option 2019-05-15 15:22:55 +02:00
Alex Plate
83b626b77e Remove ExtendSelection actions 2019-05-15 13:01:18 +02:00
Alex Plate
45932d9189 Save last column during shift-motions 2019-05-15 10:25:38 +02:00
Alex Plate
fe01820f3f Add support for key in selectmode option 2019-05-15 10:18:44 +02:00
Alex Plate
2ad4436cef Add support for startsel in keymodel option 2019-05-15 09:59:31 +02:00
Alex Plate
5b8fb49d4c Additional null check 2019-05-15 07:09:06 +03:00
Alex Plate
dca0240c13 Fix opening dialog boxes 2019-05-14 20:38:15 +03:00
Alex Plate
ce692df94f Fix cc command for empty document 2019-05-14 19:34:26 +03:00
Alex Plate
dbcf2acce4 Support cmd for selectmode option 2019-05-14 19:14:53 +03:00
Alex Plate
3bc628417f WIP: Renaming file 'VisualToggleLineModeAction' with Kotlin extension 2019-05-14 18:52:53 +03:00
Alex Plate
45b286206f Replace <caret> with ${c} 2019-05-14 17:15:14 +03:00
Alex Plate
bdc9b78ec8 Merge branch 'master' into VIM-510 2019-05-14 16:51:55 +03:00
Alex Plate
e23c11f15a Remove unused index.txt 2019-05-14 16:20:57 +03:00
Alex Plate
6865d25035 Put actions to package-info 2019-05-14 14:53:10 +03:00
Andrey Vlasovskikh
bfcc75f754 Use 2 spaces for Kotlin files as per the IntelliJ platform coding style 2019-05-14 14:13:11 +03:00
Alex Plate
25289ed4c5 Fix dot command for visual change 2019-05-14 13:20:44 +03:00
Alex Plate
2c32cbfbfd Fix linewise change to end of document 2019-05-14 13:16:30 +03:00
Alex Plate
310d664fdc Update contributing.md 2019-05-14 12:06:09 +03:00
Matt Ellis
74dce4b70a Fix incsearch with trailing characters 2019-05-14 14:51:07 +08:00
Matt Ellis
187963cc38 VIM-1413 Handle smartcase in incremental search 2019-05-14 14:50:30 +08:00
Matt Ellis
afd618c61a VIM-1535 Use correct text attributes for search
Uses the same attributes and layers as the IDE's own Find preview
2019-05-14 14:34:43 +08:00
Alex Plate
4196ec5093 Fix big O for visual block mode 2019-05-13 21:18:35 +03:00
Alex Plate
49d28f1eeb WIP: Renaming file 'VisualSwapEndsBlockAction' with Kotlin extension 2019-05-13 20:27:21 +03:00
Alex Plate
90640c9378 WIP: Renaming file 'VisualSwapEndsAction' with Kotlin extension 2019-05-13 20:23:34 +03:00
Alex Plate
bf0e9fb107 Inline vimForAllOrPrimaryCaret function 2019-05-13 16:19:05 +03:00
Alex Plate
eba0bf8f41 Move VisualSelection to another package 2019-05-13 16:15:43 +03:00
Alex Plate
66dc40f6e2 [VIM-1655] Deleted in insert mode text is not yanked 2019-05-13 15:23:59 +03:00
Alex Plate
caa0caf297 Scroll caret to next selection in multicaret plugin 2019-05-13 14:51:57 +03:00
Alex Plate
e6a36178ff Extract getKey method from ReadWrite properties 2019-05-13 14:45:38 +03:00
Alex Plate
263cc2df2a Add Michael Ziwisky to contributors list 2019-05-13 13:45:12 +03:00
Alex Plate
da556e0546 Merge pull request #194 from mziwisky/move-to-windows
map "<C-W><C-{H,J,K,L}>" to Window<Direction>Action
2019-05-13 13:43:08 +03:00
Michael Ziwisky
3180ae1a41 map "<C-W><C-{H,J,K,L}>" to Window<Direction>Action
from vim help:

tag		command		   action in Normal mode
---------------------------------------------------------
|CTRL-W_CTRL-H|	CTRL-W CTRL-H	   same as "CTRL-W h"
|CTRL-W_CTRL-J|	CTRL-W CTRL-J	   same as "CTRL-W j"
|CTRL-W_CTRL-K|	CTRL-W CTRL-K	   same as "CTRL-W k"
|CTRL-W_CTRL-L|	CTRL-W CTRL-L	   same as "CTRL-W l"
2019-05-09 16:06:21 -07:00
Alex Plate
b3bf33f488 Merge pull request #193 from citizenmatt/feature/cmdline-editing
Improvements to ex entry
2019-05-08 19:43:55 +03:00
Alex Plate
58081ed0ef Fix broken test 2019-05-08 19:43:13 +03:00
Alex Plate
f80111299f Use '\n' separator for CmdHandler 2019-05-08 19:32:09 +03:00
Alex Plate
f5dd1722f5 Fix separator related failed tests 2019-05-08 19:20:14 +03:00
Alex Plate
4237ce9b3c Support multicaret for entering visual mode with count 2019-05-08 18:44:02 +03:00
Alex Plate
b3f3a307ba Support entering visual mode with count without previous visual operation 2019-05-08 17:39:33 +03:00
Alex Plate
381e84e649 Add docs to userDataCaretToEditor delegator 2019-05-08 17:01:33 +03:00
Alex Plate
4ccddf839f Remove unnecessary caret user data 2019-05-08 16:46:04 +03:00
Alex Plate
f40ee92826 Support enter visual mode with count 2019-05-08 16:42:16 +03:00
Alex Plate
686c774e0f Add VimBehaviourDiffers for motion right tests 2019-05-08 16:08:39 +03:00
Alex Plate
13b28e6f1c Save call for editor in IdeaSpecifics 2019-05-08 12:47:07 +03:00
Matt Ellis
7fe0609e9e Fix tests 2019-05-08 07:05:58 +01:00
Alex Plate
b24aec26c0 WIP: Renaming file 'VisualChange' with Kotlin extension 2019-05-07 20:27:34 +03:00
Alex Plate
c465d303e5 Remove extra caret data 2019-05-07 18:08:49 +03:00
Alex Plate
13e80db668 Add comments to CaretData 2019-05-07 17:51:50 +03:00
Alex Plate
712e3df4b8 Add muted tests to dollar motion in visual block mode 2019-05-07 17:12:15 +03:00
Matt Ellis
98d22523be Merge branch 'master' into feature/cmdline-editing 2019-05-07 12:32:25 +01:00
Matt Ellis
6326360595 Update UI of ex output panel 2019-05-07 12:29:50 +01:00
Matt Ellis
7cfbddfd35 Remove unused editor actions 2019-05-07 12:25:02 +01:00
Alex Plate
92eb6dab2f Add information about @VimBehaviourDiffers annotation to CONTRIBUTE.md 2019-05-07 14:08:02 +03:00
Alex Plate
7cebdc7270 Add folding regions for IdeaSpecifics 2019-05-07 12:52:30 +03:00
Matt Ellis
f9094223ba Add correct caret shape for lost focus 2019-05-07 09:46:58 +01:00
Matt Ellis
849e0964ba Remove gap between ex label and text field
Also replaces incorrect border around entry panel, fixing off by one UI border drawing

Fixes VIM-1240, fixes VIM-1485
2019-05-07 00:16:09 +01:00
Alex Plate
096ed14978 Add null-check for LaF listener
(cherry picked from commit afe745dc44)
2019-05-06 18:08:40 +03:00
Alex Plate
d04196ec7c Use native selection for visual operations 2019-05-06 17:05:45 +03:00
Alex Plate
bf7f6054c6 Get editor on action execution start 2019-05-06 15:08:39 +03:00
Alex Plate
afe745dc44 Add null-check for LaF listener 2019-05-06 14:52:10 +03:00
Alex Plate
5032bc4da7 Add some comments to functions 2019-05-06 14:49:58 +03:00
Alex Plate
10c19bbb94 Move caret one char left (after selection) not in recursive way 2019-05-06 13:38:06 +03:00
Alex Plate
7519eb1f43 Move listeners to separate package 2019-05-06 12:20:15 +03:00
Alex Plate
95b800638b Enter insert mode when enabling template without selection 2019-05-06 12:18:22 +03:00
Matt Ellis
ff9a3a55e2 Ensure current action processes next keystroke
This allows cancelling inserting digraph or register with movement keys. Unprocessed keys are ignored, unless it's <C-C>, in which case the ex entry is cancelled.
2019-04-30 20:58:06 +01:00
Alex Plate
56b4e50aab Event is not null for before/after actionPerformed 2019-04-30 19:05:05 +03:00
Matt Ellis
32d513a74f Reset ex entry when lost focus due to mouse click 2019-04-30 16:50:05 +01:00
Alex Plate
8ce4768aa6 Enable insert mode after surround with if action 2019-04-30 18:49:21 +03:00
Alex Plate
13128d354d Remove redundant static call 2019-04-30 16:58:56 +03:00
Alex Plate
31b41cacba Fix motion caret to the next line after changing full text 2019-04-30 16:33:31 +03:00
Alex Plate
ddaf190c3c Add file to define Idea-specific behaviour
Move caret to right position for rider - extendSelection action
2019-04-30 15:47:28 +03:00
Alex Plate
e873009aeb Disable listeners if IdeaVim was not enabled on editor creation 2019-04-30 14:44:39 +03:00
Matt Ellis
7ec3abb069 Correctly set focus when handling cmode mapping
Fixes VIM-1419, fixes VIM-1493
2019-04-30 11:42:30 +01:00
Alex Plate
5b628c2f48 Use constants from TestUtil in VimTestCase 2019-04-30 13:19:12 +03:00
Alex Plate
dcb2300699 Add test for removing indent in PyCharm 2019-04-30 12:29:57 +03:00
Alex Plate
cfd69d1603 Stay in select mode in PyCharm after deleting indent 2019-04-30 11:35:45 +03:00
Alex Plate
f816bc23e9 Create more complicated VimSelection structure. Support dollar motion 2019-04-29 16:46:30 +03:00
Matt Ellis
8601730dd8 Add prompt when inserting digraphs and registers
Also resets state correctly when cancelling inserts
2019-04-29 14:12:19 +01:00
Alex Plate
336342c72e [IDEA-211429] Directly enable insert mode for dialogs 2019-04-29 15:16:18 +03:00
Alex Plate
357763ff55 [VIM-1644] Update changelist 2019-04-29 15:10:07 +03:00
Alex Plate
45b757697a Merge pull request #192 from danielemegna/VIM-1644
[Vim 1644] - Fix action repeat broken with visual mode
2019-04-29 15:08:20 +03:00
Alex Plate
a9a0d6233e Merge pull request #191 from citizenmatt/feature/beep
Only beep once every half second
2019-04-29 14:42:15 +03:00
Alex Plate
91dbf51d8b Add Simon Rainer to contributors list 2019-04-29 14:01:29 +03:00
Alex Plate
af79066c26 Merge pull request #179 from Vvalter/master
Fix VIM-1090 and VIM-1100 tag motion with duplicate tags.
2019-04-29 13:59:15 +03:00
Alex Plate
c5f6676ac2 Put tag tests to separate files 2019-04-29 13:56:42 +03:00
Matt Ellis
906d2a4168 Insert register at caret location, instead of appending 2019-04-29 11:44:34 +01:00
Alex Plate
b85b4a7f72 Add Elliot Courant to contributors list 2019-04-29 13:26:30 +03:00
Alex Plate
3b360c807e Merge pull request #188 from ECourant/feature/command
(VIM-1105) Adding support for command aliasing.
2019-04-29 13:21:53 +03:00
Alex Plate
d0bec7db4d Update copyright and make code more kotlin-specific 2019-04-29 13:07:57 +03:00
Alex Plate
7af5d8debd Fix wrong copyright setting 2019-04-29 12:41:25 +03:00
Matt Ellis
e7603a78d0 Add tests for ex entry shortcuts 2019-04-29 09:29:08 +01:00
Matt Ellis
3a728df3b1 Ensure all shortcuts are seen by ex entry field
Fixes VIM-1550
2019-04-28 17:06:23 +01:00
Daniele Megna
417fa314b4 Fix VIM-1644: keep Visual and VisualBlock start-end values updated
during MotionGroup#toggleVisual method
2019-04-28 11:20:20 +02:00
Simon Rainer
73cfd71bd4 Fixes successive tag block selection. 2019-04-27 12:46:33 +02:00
Daniele Megna
3a092012bb Add some repeat action passing tests 2019-04-27 11:25:56 +02:00
Simon Rainer
415abd13c9 Merge remote-tracking branch 'upstream/master' 2019-04-26 17:18:08 +02:00
Matt Ellis
e94eac77eb Show correct caret shape on command line
Also refreshes font when editor font changes
2019-04-26 14:44:40 +01:00
Matt Ellis
25b11349a4 Update list of cmdline editing commands 2019-04-26 14:43:56 +01:00
Elliot Courant
4ea8e15710 (VIM-1105) Adding support for command aliasing.
Commands `command`, `comclear` and `delcommand` have been added. `command` also
supports -nargs, allowing arguments to be passed to the aliased command.
Symbols supported for -nargs are: <args> <q-args> <count> <lt>.
2019-04-26 06:17:30 -05:00
Matt Ellis
890562e810 Only beep once every half second 2019-04-26 11:49:41 +01:00
Alex Plate
9b4d38ed3c Rearrange VisualMotionGroup code 2019-04-25 17:19:36 +03:00
Alex Plate
33c33431f9 Update indent 2019-04-25 16:09:22 +03:00
Alex Plate
53d3e0db88 Remove useless function 2019-04-25 15:22:32 +03:00
Alex Plate
94e4556bee Remove unnecessary user data (wasVisualBlock) 2019-04-25 14:56:15 +03:00
Alex Plate
1ad9dd4a28 Save caret position after cursor dragging 2019-04-25 14:47:14 +03:00
Alex Plate
e15f0e07dd Add some comments to VisualGroup 2019-04-25 13:29:42 +03:00
Alex Plate
eda734e728 Add missing @NotNull annotation 2019-04-25 12:09:24 +03:00
Alex Plate
205c6e9ed2 Rename AddInlays action 2019-04-25 12:09:24 +03:00
Alex Plate
5132327d62 Merge pull request #159 from ikenox/search-action-by-shortcut-key
Search actionlist by keyboard shortcuts which is assigned to action
2019-04-25 12:09:09 +03:00
Alex Plate
55e0200fb6 Move caret to right place after gutter mouse selection 2019-04-25 11:45:55 +03:00
Alex Plate
fefd6699f3 Select full line while visual line mode 2019-04-25 11:04:05 +03:00
Alex Plate
963840612c Select full line while visual line mode 2019-04-25 10:54:46 +03:00
Alex Plate
fd8e567c60 Format ChangeGroup 2019-04-24 20:26:55 +03:00
Alex Plate
69d02b8abb Fix small typos in userData() functions 2019-04-24 17:09:08 +03:00
Alex Plate
ccf721fd6c Store vim selection start and end in VimSelection model 2019-04-24 15:01:12 +03:00
Naoto Ikeno
98c4bb2c4f fix broken tests 2019-04-24 12:48:52 +09:00
Alex Plate
55bd13c3f2 Reorganize Visual- and MotionHandlers 2019-04-23 17:26:57 +03:00
Alex Plate
95c5256fe3 Fix failed tests 2019-04-23 16:06:01 +03:00
Alex Plate
f8de555032 [VIM-1184] Store all vim settings only locally (except keymapping) 2019-04-23 15:49:33 +03:00
Alex Plate
060d27f57a Move BlockParen tests to separate files 2019-04-23 13:23:43 +03:00
Alex Plate
917d3a4ded Add Romain Gautier to contributors list 2019-04-23 12:53:53 +03:00
Alex Plate
13b75dea27 Merge pull request #189 from Nimamoh/VIM-1633
VIM-1633 - fix block selection
2019-04-23 12:48:09 +03:00
Romain Gautier
9487cd2b0b Revert block tag part 2019-04-23 00:19:04 +02:00
Alex Plate
20dbe1bde6 Enter select mode for oneRowEditor in case on unexpected selection change 2019-04-22 15:24:44 +03:00
Alex Plate
c7f42cfca8 Enter insert mode after backspace in select mode 2019-04-22 15:24:19 +03:00
Alex Plate
3f9585b1fb Restore mode after :action 2019-04-22 14:57:09 +03:00
Alex Plate
e021663975 Print submode of select mode in bar 2019-04-22 14:38:03 +03:00
romain.gautier@nimamoh.net
8c1cca0d57 VIM-1633 - correct handling of self closing tags 2019-04-18 18:30:24 +02:00
Simon Rainer
6d74480998 Fixes tag motion handling slashes incorrectly. 2019-04-18 16:12:04 +02:00
Simon Rainer
31bad3a1e1 Merge https://github.com/JetBrains/ideavim 2019-04-18 15:24:09 +02:00
romain.gautier@nimamoh.net
f0ccf6c3a5 VIM-1633 - empty tag block selection case 2019-04-18 14:55:54 +02:00
romain.gautier@nimamoh.net
367b13cdad VIM-1633 - fix tag block selection 2019-04-18 13:17:35 +02:00
Alex Plate
47ac879ed9 Move caret one char left after double click 2019-04-18 13:57:01 +03:00
Alex Plate
28a50c00bb Move caret one character left while after mouse selection 2019-04-17 20:33:23 +03:00
Alex Plate
6ceb74cb33 Fix: some motions could become linewise 2019-04-17 16:15:30 +03:00
Naoto Ikeno
9f682cded0 filter an actionlist by assigned shortcut key 2019-04-17 16:17:09 +09:00
Alex Plate
40ddc506a7 Add editorconfig for .kt files 2019-04-16 13:58:46 +03:00
Alex Plate
74d5144892 Set visual mode for non-vim selections 2019-04-15 17:46:50 +03:00
romain.gautier@nimamoh.net
ea2f2ba213 VIM-1633 - remove useless min/max, add comments 2019-04-15 15:22:45 +02:00
Alex Plate
970a5e19d0 Use try-with-resources for VimListenerSuppressor 2019-04-15 15:13:09 +03:00
Alex Plate
3786660ecd Motion right with unicode characters 2019-04-15 14:00:17 +03:00
romain.gautier@nimamoh.net
c0d72d25f8 VIM-1633 - fix block selection 2019-04-13 03:35:08 +02:00
Alex Plate
b69d7f9729 Fix problems after rebase 2019-04-12 19:08:18 +03:00
Alex Plate
03a934a8e9 Add motions to left/right/up/down arrows in select mode 2019-04-12 19:03:18 +03:00
Alex Plate
215df5cc03 Enter insert mode after select mode while editing template 2019-04-12 19:03:18 +03:00
Alex Plate
cfcdbffa7f Handle tab character with block visual selection 2019-04-12 19:03:18 +03:00
Alex Plate
7b32b75052 Suppress selection listener while lookup is active 2019-04-12 19:03:18 +03:00
Alex Plate
f6549aca76 Remove unused method 2019-04-12 19:03:18 +03:00
Alex Plate
4ce3cff2bf Shorter version of selection restore (:action) 2019-04-12 19:03:18 +03:00
Alex Plate
c4c8b8c9e1 Fix :action command with selection 2019-04-12 19:03:18 +03:00
Alex Plate
23ce30a7fc Provide vimSetSelection instead of vimStartSelectionAtPoint method 2019-04-12 19:03:17 +03:00
Alex Plate
2fd23af04a Fix commentary extension 2019-04-12 19:03:17 +03:00
Alex Plate
33534d50cd Support del and backspace in select mode 2019-04-12 19:03:17 +03:00
Alex Plate
79aed6b7b0 Add SAVE_VISUAL flag for commands 2019-04-12 19:03:17 +03:00
Alex Plate
740ef8a2d7 Update down motion 2019-04-12 19:03:17 +03:00
Alex Plate
68efd8f3d0 Properly handling of unexpected block selection 2019-04-12 19:03:17 +03:00
Alex Plate
6fe6e83cb9 Add mode, submode and caret colour checks to doTest method 2019-04-12 19:03:17 +03:00
Alex Plate
7ed7ac817d Fix KeyHandler reset after using templates 2019-04-12 19:03:16 +03:00
Alex Plate
dc39f8fe76 Add Testing section to CONTRIBUTING.md 2019-04-12 19:03:16 +03:00
Alex Plate
519cbfe38b Tests for up/down motions 2019-04-12 19:03:16 +03:00
Alex Plate
f1fd5f2aa6 Do not move secondary carets in selection block mode to selection end - 1 2019-04-12 19:03:16 +03:00
Alex Plate
2b5d06a6dc Multicaret tests for left/right motions 2019-04-12 19:03:16 +03:00
Alex Plate
ef13d04a98 Add tests for key handler 2019-04-12 19:03:16 +03:00
Alex Plate
fb3f3c7405 Add Escape action 2019-04-12 19:03:16 +03:00
Alex Plate
a9df13e4d7 Tests for left-right select motions 2019-04-12 19:03:15 +03:00
Alex Plate
a46c5383cd Update Kotlin version 2019-04-12 19:03:15 +03:00
Alex Plate
a133a94dbe Create tests for select mode toggling 2019-04-12 19:03:15 +03:00
Alex Plate
bf5cab0062 Use string templates for <caret> and <selection> in kt files 2019-04-12 19:03:15 +03:00
Alex Plate
4e64838613 Handler enter action in selection mode 2019-04-12 19:03:15 +03:00
Alex Plate
2f894a5f2f Create tests for entering select mode 2019-04-12 19:03:15 +03:00
Alex Plate
3903f6c709 Fix wrong cursor shape by copying 2019-04-12 19:03:15 +03:00
Alex Plate
78ab61ec0c Add docs for VisualGroup 2019-04-12 19:03:14 +03:00
Alex Plate
be8a5f535c Get rid of static methods to get common approach for group functions 2019-04-12 19:03:14 +03:00
Alex Plate
53a5762f98 Fixing caret in dialogs 2019-04-12 19:03:14 +03:00
Alex Plate
85c92935d3 Add motion up and down 2019-04-12 19:03:14 +03:00
Alex Plate
ed51a60dfe Fix wrong caret shape on mouse click 2019-04-12 19:03:14 +03:00
Alex Plate
6ad7771fed Fix undo/redo 2019-04-12 19:03:14 +03:00
Alex Plate
63f87cdb18 Handle enter in select mode 2019-04-12 19:03:14 +03:00
Alex Plate
73f670212e Enter select mode with multiple carets 2019-04-12 19:03:13 +03:00
Alex Plate
7418c6db73 Add switcher for select mode and line and block wise 2019-04-12 19:03:13 +03:00
Alex Plate
6892db0056 Enter selection mode on unexpected changes 2019-04-12 19:03:13 +03:00
Alex Plate
2f6bd2c287 Introduce select mode 2019-04-12 19:03:13 +03:00
Alex Plate
4bff954c3b Fix :join command 2019-04-12 19:03:13 +03:00
Alex Plate
e70f535ad3 Fix selection with undo 2019-04-12 19:03:13 +03:00
Alex Plate
da66981a1f Fix putting caret on empty line 2019-04-12 19:03:13 +03:00
Alex Plate
ab9ba94dbf Add docs for new classes and functions 2019-04-12 19:03:12 +03:00
Alex Plate
0d15b9117f Log lockers, clear stack before entering visual mode 2019-04-12 19:03:12 +03:00
Alex Plate
4de8e8e291 Adjust caret to visual end in case of unexpected changes 2019-04-12 19:03:12 +03:00
Alex Plate
ced99152a1 Fix visual block selection 2019-04-12 19:03:12 +03:00
Alex Plate
c30cd23b89 Make VimListenerSuppressor sealed 2019-04-12 19:03:12 +03:00
Alex Plate
1e58173241 Fix ChangeVisualAction 2019-04-12 19:03:12 +03:00
Alex Plate
062d7d3f71 Fix setVisualMode for caret without selection 2019-04-12 19:03:12 +03:00
Alex Plate
284983a4a7 Move listeners to separate class 2019-04-12 19:03:11 +03:00
Alex Plate
b590762259 Support block selection autodetect 2019-04-12 19:03:11 +03:00
Alex Plate
1763eb2f17 Proper visual mode exit 2019-04-12 19:03:11 +03:00
Alex Plate
5be2ca8efc Fix motion down 2019-04-12 19:03:11 +03:00
Alex Plate
826b3d6803 Handle unexpected caret events 2019-04-12 19:03:11 +03:00
Alex Plate
6852463b53 Fix visual block deletion 2019-04-12 19:03:11 +03:00
Alex Plate
9546f6069c Fix line deletion in visual mode 2019-04-12 19:03:11 +03:00
Alex Plate
d65955647c Move selection functions to VisualGroup 2019-04-12 19:03:10 +03:00
Alex Plate
5200ff8e84 Move CaretData to kotlin 2019-04-12 19:03:10 +03:00
Alex Plate
f1a667ae2e Move caret last column attribute to kotlin 2019-04-12 19:03:10 +03:00
Alex Plate
82682ece5e Remove unused moveCaret method 2019-04-12 19:03:10 +03:00
Alex Plate
61f9184728 Highlight only primary caret with block selection 2019-04-12 19:03:10 +03:00
Alex Plate
a220be8136 Fix all tests 2019-04-12 19:03:10 +03:00
Alex Plate
11b2096dba Fix last selection type 2019-04-12 19:03:10 +03:00
Alex Plate
8370248390 Define main caret for visual block selection 2019-04-12 19:03:09 +03:00
Alex Plate
f528269bc6 Fixed tests with put and yank actions 2019-04-12 19:03:09 +03:00
Alex Plate
d551531603 Test fixing 2019-04-12 19:03:09 +03:00
Alex Plate
3b50bd8509 Fix tests about caret merging 2019-04-12 19:03:09 +03:00
Alex Plate
8bc73a0101 Fix word object tests 2019-04-12 19:03:09 +03:00
Alex Plate
419c15d0c3 Fixing tests 2019-04-12 19:03:09 +03:00
Alex Plate
be90776588 Remove native caret order 2019-04-12 19:03:09 +03:00
Alex Plate
7c8cc16768 Fix tests for vim surround 2019-04-12 19:03:08 +03:00
Alex Plate
1596b0addc New structure of MotionEditorActionHandler 2019-04-12 19:03:08 +03:00
Alex Plate
886bbe1111 Use new struct of operation handler 2019-04-12 19:03:08 +03:00
Alex Plate
de266f12a4 Set selection start non nullable. Set null value with vimSelectionStartBackingNullable 2019-04-12 19:03:08 +03:00
Alex Plate
f9a5bc00e7 [WIP] Support native caret selection 2019-04-12 19:03:08 +03:00
Alex Plate
356c122767 Remove unused methods 2019-04-12 19:03:08 +03:00
Alex Plate
e9b94033c5 Format VisualOperatorActionHandler 2019-04-12 19:03:07 +03:00
Alex Plate
8e1385e4e1 Remove unused data key 2019-04-12 19:03:07 +03:00
Alex Plate
e881ed0d9a Update visual handlers to new handler 2019-04-12 19:03:07 +03:00
Alex Plate
26d03d49b1 Create tests for visual put action 2019-04-12 19:03:07 +03:00
Alex Plate
082a3b21e1 Use range markers instead of TextRanges for VisualOperatorActionHandler 2019-04-12 19:03:07 +03:00
Alex Plate
15e6e8435a Make extension properties to get visual range 2019-04-12 19:03:07 +03:00
Alex Plate
2d67067159 Split CopyGroup into class objects 2019-04-12 19:03:07 +03:00
Alex Plate
3fb3aaad2a Introduce new VisualOperatorActionHandler
Update visual put to new handler
2019-04-12 19:03:06 +03:00
Alex Plate
616479c4fc Use native caret iterator for VisualOperatorActionHandler 2019-04-12 19:03:06 +03:00
Alex Plate
9b4c732dca Remove unused caret data 2019-04-12 19:03:06 +03:00
Alex Plate
249be00463 Reformat setVisualMode and toggleVisual functions 2019-04-12 19:03:06 +03:00
Alex Plate
febcccc670 Extract visual motions to separate file 2019-04-12 19:03:06 +03:00
Alex Plate
2d4eed726f Fix motion right with tabs 2019-04-12 19:02:48 +03:00
Alex Plate
98de7888cd Add Andrew Potter to contributors list 2019-04-12 18:33:23 +03:00
Alex Plate
24eb376bed Merge pull request #166 from apottere/patch-1
Get indent from PsiFile so formatting on shift is consistent (VIM-1231)
2019-04-12 18:27:56 +03:00
Alex Plate
75fbc0f939 [VIM-1425] Fix % command 2019-04-12 15:16:26 +03:00
Alex Plate
c8c1993db3 Fix right motion for non-ascii character 2019-04-12 14:39:37 +03:00
Alex Plate
628cb33e44 Revert "[VIM-1425] Fix % command"
This reverts commit d0a39ef3
2019-04-11 16:40:25 +03:00
Alex Plate
8160df000b Revert "Fix right motion for non-ascii character"
This reverts commit f6e7019b
2019-04-11 16:26:37 +03:00
Alex Plate
d0a39ef32f [VIM-1425] Fix % command
Command % worked wrong when
- There was '\\' character on the way
- Inside strings
2019-04-11 16:09:57 +03:00
Alex Plate
f6e7019b51 Fix right motion for non-ascii character 2019-04-10 18:44:36 +03:00
Alex Plate
b7d82cddbc Add Code of Conduct to project 2019-04-10 15:59:48 +03:00
Alex Plate
22ce6fbf09 Update changelist 2019-04-10 12:51:22 +03:00
Alex Plate
c202394c3c [VIM-1628] Do not handle undefined characters 2019-04-10 12:48:30 +03:00
Alex Plate
900f415c6b [VIM-1546] Storing TAB key as input 2019-04-09 21:51:23 +03:00
Alex Plate
38a4fd5fbc [VIM-607] Fixing memory leaks when closing the project 2019-04-09 20:38:57 +03:00
Alex Plate
9f629132e4 Use Set instead of List for CommandHandler flags 2019-04-09 13:10:22 +03:00
Alex Plate
32ba7895a3 Provide more clear API for creating new Command Handlers 2019-04-08 17:19:48 +03:00
Alex Plate
65627da72b VIM-1630 Add Daniele Megna to contributors list 2019-04-08 16:42:40 +03:00
Alex Plate
00de654ca5 Merge pull request #183 from danielemegna/tabonly_handler
Implement TabOnlyHandler
2019-04-08 16:38:00 +03:00
Daniele Megna
0f5ca758b8 Implement TabOnlyHandler 2019-04-07 11:42:50 +02:00
Alex Plate
857a5b4d52 Remove information about unreleased extenstion 2019-04-04 17:10:32 +03:00
Alex Plate
3757da0f5f Add VIM-1615 to changelist 2019-04-04 15:36:13 +03:00
Alex Plate
4befd155a1 Merge pull request #182 from citizenmatt/VIM-1615
VIM-1615 Fix handling of so=999
2019-04-04 15:32:53 +03:00
Matt Ellis
bb7c2390b1 Keep bottom line aligned with bottom of screen when scrolling up 2019-04-04 00:15:23 +01:00
Alex Plate
c70d30744c Add gecko655 to contributors list 2019-04-01 19:59:09 +03:00
Alex Plate
4b49bb6d18 Merge pull request #180 from gecko655/VIM-1067
Fix issue VIM-1067: Repeat commands deletes End Of Line character when repeating "append to end of line" ('A') command.
2019-04-01 19:56:15 +03:00
Alex Plate
58481c81a0 Add sumoooru2 to contributors list 2019-04-01 19:53:51 +03:00
Alex Plate
465ed569a1 Merge pull request #178 from sumoooru2/master
Fix findBlockRange
2019-04-01 19:48:59 +03:00
Alex Plate
547a159fb3 Add message to explain which action is null 2019-03-29 11:50:37 +03:00
Alex Plate
ea4fc32e60 Update readme: add information about commentary extension 2019-03-29 11:25:19 +03:00
jtierno
47db118c21 hola 2019-03-28 21:12:16 +01:00
Alex Plate
a1ff484c85 Merge pull request #109 from dhleong/dhleong/CommentaryExtension2
Add comment motion extension
2019-03-28 13:34:03 +03:00
Matt Ellis
6ebedb9219 VIM-1615 Fix handling of so=999 2019-03-27 09:31:12 +00:00
jonatantierno
c717bed4fb Command gn 2019-03-16 14:47:09 +01:00
gecko655
170bff5a3f Added tests for VIM1067 2019-03-11 00:43:25 +09:00
gecko655
41ea121377 Fix issue VIM-1067: Repeat commands deletes End Of Line character when repeating "append to end of line" ('A') command.
The variable `ChangeGroup.oldOffset` should be initialized before every insertion action.

This fixes https://youtrack.jetbrains.com/issue/VIM-1067
2019-03-11 00:43:01 +09:00
sumoooru2
b55615fffa Add a unit test 2019-02-28 18:36:05 +09:00
Alex Plate
b3de48fdd2 Convert CommandNode to kotlin 2019-02-26 12:11:06 +03:00
Alex Plate
f58eda97c8 WIP: Renaming file 'CommandNode' with Kotlin extension 2019-02-26 12:10:03 +03:00
Alex Plate
7958aa3881 Convert CommandHandler to kotlin 2019-02-25 19:55:58 +03:00
Alex Plate
ad69ab7579 Add missing property key 2019-02-25 19:31:39 +03:00
Alex Plate
8b88be5742 Update copyright formatting 2019-02-25 19:26:34 +03:00
Alex Plate
6f31dae429 Add instruction for copyright setup 2019-02-25 19:24:39 +03:00
Alex Plate
e67ac4c3ad Use enumsets instead of bitflags for CommandHandler 2019-02-25 19:03:45 +03:00
Alex Plate
a52984f515 Remove unused constructors of CommandHandler 2019-02-25 14:05:37 +03:00
Alex Plate
746dbc2533 Convert MapHandler to kotlin 2019-02-25 13:58:18 +03:00
Alex Plate
b2c462fbaa Convert SortHandler to kotlin 2019-02-25 13:07:39 +03:00
Alex Plate
42171e5680 Convert YankLinesHandler to kotlin 2019-02-25 13:01:00 +03:00
Alex Plate
10ddc61fb7 Convert SelectFileHandler to kotlin 2019-02-25 12:51:24 +03:00
Alex Plate
ae1d3d9c09 Convert RepeatHandler to kotlin 2019-02-25 12:49:13 +03:00
Simon Rainer
990caaa75d VIM-1090 VIM-1100 fix tag motion with duplicate tags. 2019-02-24 11:32:35 +01:00
Daniel Leong
00dc6fe775 Preserve caret position (only) for linewise comments 2019-02-22 20:31:25 -05:00
Daniel Leong
3fa9f258d7 Add an HTML filetype test 2019-02-22 20:01:03 -05:00
Alex Plate
33fd60e743 Temporary remove .idea folder because of setup problems 2019-02-22 20:58:56 +03:00
Daniel Leong
fbac63085f Add WriteAction.run() wrappings as appropriate 2019-02-22 10:59:20 -05:00
Daniel Leong
35ce221cab Refactor Runnable -> lambda 2019-02-22 10:11:31 -05:00
Daniel Leong
4599d76ce4 Remove catch() 2019-02-22 10:11:31 -05:00
dhleong
6a6632e363 Fix visual-mode gc action 2019-02-22 10:11:31 -05:00
dhleong
5c18dd0603 Post handling of "remaining" key to ensure correct event ordering
Fixes the strange behavior when using the <Plug> mapping broke
in the real environment, but the unit tests passed
2019-02-22 10:11:31 -05:00
dhleong
245c48d78f Only pass extra keys for prevMappingInfo if necessary
That is, if the mapping info we're using *is* the prevMappingInfo.
If it's not, that means the prevMappingInfo was part of a prefix that
the currentMappingInfo completed
2019-02-22 10:11:31 -05:00
dhleong
e5d880b516 Update base ambiguous mapping tests 2019-02-22 10:11:31 -05:00
dhleong
ff02161062 Improve tests for more depth, cover gc(motion)/gcc issue
The failing gc(motion) tests seem more like implementation bugs
than anything else, but the the issues `gcc` with are unexpected
2019-02-22 10:11:31 -05:00
dhleong
0475610f59 Another attempt at comment motion extension 2019-02-22 10:11:31 -05:00
Alex Plate
215b94046a Use single class import in project 2019-02-22 16:28:06 +03:00
Alex Plate
a1236d855b Convert RegistersHandler to kotlin 2019-02-22 16:26:37 +03:00
Alex Plate
0f835fd3ba Convert PutLinesHandler to kotlin 2019-02-22 15:59:00 +03:00
Alex Plate
cbb0d1a05e Update .gitignore 2019-02-22 14:10:01 +03:00
Alex Plate
7bb7386c83 Update badges 2019-02-21 20:16:44 +03:00
Alex Plate
48bef164ef Move contribution information to separate file 2019-02-21 19:32:56 +03:00
Alex Plate
434c1ef275 Convert PreviousFileHandler to kotlin 2019-02-21 18:59:24 +03:00
Alex Plate
6772b08745 Convert OnlyHandler to kotlin 2019-02-21 18:56:03 +03:00
Alex Plate
7c8d560f9e Use native mechanism for multicursor iteration 2019-02-21 18:19:23 +03:00
Alex Plate
29d3e4fd5b Convert MoveTextHandler to kotlin 2019-02-21 17:34:30 +03:00
Alex Plate
db0e95deac Add .idea styles 2019-02-21 16:29:42 +03:00
Alex Plate
b8748916a7 Convert MarksHandler to kotlin 2019-02-21 15:57:21 +03:00
Alex Plate
e7c5a20ab0 Update gradle wrapper to 5.2.1 version 2019-02-21 15:31:14 +03:00
Alex Plate
bac754ac4b Add Brad Ziolko to contributor list 2019-02-21 14:51:59 +03:00
Alex Plate
e028215718 Convert LetHandler to kotlin 2019-02-21 14:45:50 +03:00
Alex Plate
908a0929f0 Merge pull request #174 from bradziolko/vim-1012
[VIM-1012] Support tab close preferences when using :q or :wq
2019-02-21 14:45:22 +03:00
Alex Plate
6565ad8e96 Update copyright on test files 2019-02-21 12:56:20 +03:00
Alex Plate
c0819a83f0 Create ignored tests for VIM-714 issue 2019-02-21 12:45:15 +03:00
sumoooru2
d35f017db5 Fix findBlockRange 2019-02-21 16:52:15 +09:00
Alex Plate
3b8da702a7 Convert JumpsHandler to kotlin 2019-02-20 18:21:50 +03:00
Alex Plate
24c24f40ab Update copyright 2019-02-20 17:01:23 +03:00
Alex Plate
865a888363 Convert JoinLinesHandler to kotlin 2019-02-20 16:40:13 +03:00
Alex Plate
1cd56cb6d1 Update changelist 2019-02-20 16:20:49 +03:00
Alex Plate
f10ef8fd70 Merge pull request #167 from AlexPl292/VIM-1570
Support some increment and decrement commands

VIM-1570
2019-02-20 16:14:17 +03:00
Alex Plate
cdff9e28a1 Support some increment and decrement commands 2019-02-20 16:10:44 +03:00
Alex Plate
ca2924510a Convert HistoryHandler to kotlin 2019-02-19 20:34:08 +03:00
Alex Plate
42cbbbfc3a Convert GotoLineHandler to kotlin 2019-02-19 20:03:31 +03:00
Alex Plate
d8d1daca67 Convert GotoCharacterHandler to kotlin 2019-02-19 20:01:47 +03:00
Alex Plate
1aa021b157 Convert FindSymbolHandler to kotlin 2019-02-19 19:59:29 +03:00
Alex Plate
5e99c45fa1 Convert FindFileHandler to kotlin 2019-02-19 19:58:18 +03:00
Alex Plate
687a601772 Add Tony Arra to contributor list 2019-02-19 19:56:18 +03:00
Alex Plate
4bc2880505 Convert FindClassHandler to kotlin 2019-02-19 19:48:18 +03:00
Alex Plate
0f474d7f3e Convert EditFileHandler to kotlin 2019-02-19 19:48:18 +03:00
Alex Plate
fe5342d63c Convert DumpHandler to kotlin 2019-02-19 19:48:18 +03:00
Alex Plate
2f9de59b79 Convert DeleteHandler to kotlin 2019-02-19 19:48:18 +03:00
Alex Plate
18d18118a0 Convert CopyHandler to kotlin 2019-02-19 19:48:18 +03:00
Alex Plate
b074b5ac70 Use coerce function for rawCount 2019-02-19 19:48:17 +03:00
Alex Plate
a38231fb1b Merge pull request #172 from TonyArra/VIM-1569
VIM-1569: Strip tag attributes from closing tag for Vim-Surround
2019-02-19 19:45:54 +03:00
Alex Plate
740abc1e70 Use enum for storing command flags 2019-02-19 16:43:23 +03:00
Alex Plate
2761dfb06f Convert CmdFilterHandler to kotlin 2019-02-19 12:07:46 +03:00
Alex Plate
93ce46bb7c Convert AsciiHandler to kotlin 2019-02-19 11:57:25 +03:00
Alex Plate
7e23fca598 New style of command definition 2019-02-18 21:32:23 +03:00
Alex Plate
472e14f339 Add dos65 to contributor list 2019-02-18 19:54:10 +03:00
Alex Plate
0c2631622e Merge pull request #88 from dos65/keypad_arrows
VIM-944 - Navigation with keypad arrows
2019-02-18 19:50:22 +03:00
Alex Plate
2285034a62 Convert ActionListHandler to kotlin 2019-02-15 21:02:25 +03:00
Alex Plate
49e28839f7 Convert ActionHandler to kotlin 2019-02-15 19:40:43 +03:00
Alex Plate
b2533565ad Convert WriteQuiteHandler to kotlin 2019-02-15 19:27:07 +03:00
Alex Plate
a96a1730a1 Convert WritePreviousHandler to kotlin 2019-02-15 19:25:35 +03:00
Alex Plate
d027d7e099 Convert WriteNextHandler to kotlin 2019-02-15 19:23:56 +03:00
Alex Plate
cf5a5564ca Convert WriteHandler to kotlin 2019-02-15 19:22:34 +03:00
Alex Plate
e183067257 Convert WriteAllHandler to kotlin 2019-02-15 19:21:10 +03:00
Alex Plate
7ab15f7f89 Convert UndoHandler to kotlin 2019-02-15 19:19:59 +03:00
Alex Plate
1a91f0cbcb Convert SubstituteHandler to kotlin 2019-02-15 19:17:37 +03:00
Alex Plate
30241e0837 Convert SplitHandler to kotlin 2019-02-15 18:58:14 +03:00
Alex Plate
aea098b668 Convert SourceHandler to kotlin 2019-02-15 18:54:36 +03:00
Alex Plate
c34948190a Update CHANGES list 2019-02-15 18:22:47 +03:00
Alex Plate
95a441b5b1 Merge pull request #175 from citizenmatt/VIM-1303
VIM-1303 Update UI when look and feel changes
2019-02-15 18:19:11 +03:00
Alex Plate
21b9b1d7f1 Convert ShiftRightHandler to kotlin, write tests for handler 2019-02-15 17:54:32 +03:00
Alex Plate
bd36a6d528 Convert ShiftLeftHandler to kotlin, write tests for handler 2019-02-15 17:48:26 +03:00
Alex Plate
aca77e1279 Convert ShellHandler to kotlin 2019-02-15 17:13:59 +03:00
Alex Plate
f7b604cb9b Convert SetHandler to kotlin 2019-02-15 17:11:02 +03:00
Alex Plate
9c5cfd6bca Convert SelectLastFileHandler to kotlin 2019-02-15 17:08:55 +03:00
Alex Plate
f657ecac6f Convert SelectFirstFileHandler to kotlin 2019-02-15 17:06:54 +03:00
Alex Plate
69aaca33a5 Convert RedoHandler to kotlin 2019-02-15 17:04:35 +03:00
Alex Plate
08168a7877 Convert QuitHandler to kotlin 2019-02-15 17:02:57 +03:00
Alex Plate
9054f48f88 Convert PromptReplaceHandler to kotlin 2019-02-15 16:59:34 +03:00
Alex Plate
fbe6b5a3a3 Convert PromptFindHandler to kotlin 2019-02-15 16:55:45 +03:00
Alex Plate
b114f4ee96 Flaky test remove 2019-02-15 14:58:49 +03:00
Alex Plate
8af5634431 Convert NoHLSearchHandler to kotlin 2019-02-14 18:08:44 +03:00
Alex Plate
1b61598149 Convert NextFileHandler to kotlin 2019-02-14 17:41:55 +03:00
Alex Plate
2cfc180df7 Convert MarkHandler to kotlin. Write tests for :mark command 2019-02-14 16:29:06 +03:00
Alex Plate
4d20e8fb28 Convert NextTab and PreviousTab handlers to kotlin 2019-02-14 15:50:35 +03:00
Alex Plate
8f3d570bf6 Add Andrei Gasparovic to contributors list 2019-02-14 15:02:05 +03:00
Alex Plate
276b19bf09 Merge pull request #132 from andreigasparovici/master
Added :tabn(ext) and :tabp(revious) functionality

VIM-801
2019-02-14 14:56:43 +03:00
Alex Plate
b0ebbdd7ff Convert HelpHandler to kotlin 2019-02-14 14:35:32 +03:00
Alex Plate
5014de6d9d Convert FileHandler to kotlin 2019-02-14 14:23:28 +03:00
Alex Plate
6dc9843aa9 Extract "%" tests into separate file 2019-02-14 13:53:49 +03:00
Alex Plate
ad6e3dee6c Add Vedran Budimcic to contributors list 2019-02-14 13:27:34 +03:00
Alex Plate
e0e51835b5 Create function for handler's flags definition 2019-02-14 13:23:02 +03:00
Alex Plate
7bccc2fbdb Merge pull request #127 from vedran/master
Support end-of-line multi line percent match in visual mode
2019-02-14 13:14:56 +03:00
Alex Plate
c2da601722 Remove unused handler 2019-02-14 12:38:24 +03:00
Alex Plate
e8fea2e969 Convert DigraphHandler and EchoHandler to kotlin 2019-02-13 16:17:18 +03:00
Alex Plate
ebe23989a7 Add link to :shell command issue 2019-02-13 15:11:00 +03:00
Alex Plate
278a2dfc07 Convert SearchGroupTest to kotlin. Add offset tests (e, b, s, +-1) 2019-02-13 15:02:56 +03:00
Alex Plate
1fb93ea73d Create kotlin-style command definition 2019-02-13 13:49:43 +03:00
Alex Plate
bfc5aaa2de Merge pull request #176 from johngrib/fix-authors-email
Fix the wrong email address
2019-02-13 12:22:47 +03:00
JohnGrib
183fbafaae Fix the wrong email address
John Grib's email address recorded as johngrib@woowahan.com
is currently not valid.
I am currently using johngrib82@gmail.com.

You can see my merged PR and my recent email address
through the following two links.

* https://github.com/JetBrains/ideavim/pull/115
* https://github.com/johngrib
2019-02-13 11:32:45 +09:00
Alex Plate
470f15fd3c Convert ExitHandler and CommandName to kotlin 2019-02-12 20:47:59 +03:00
Alex Plate
d8a5209ec4 Add Marcel Hild to contributor list 2019-02-12 20:05:47 +03:00
Alex Plate
99c6b4552a Merge pull request #126 from durandom/offset_in_slash
Make offset work in normal search
2019-02-12 19:50:48 +03:00
Alex Plate
d69bf5d76f Update changelog. Add John Grib to contributor list. 2019-02-12 18:55:01 +03:00
Alex Plate
ac484e36fa Merge pull request #115 from johngrib/feature/add-command-shell
Added :shell command
2019-02-12 18:39:23 +03:00
Alex Plate
dc88cbd902 Change implementation of ExitHandler
Use file manager for file closing
Add tests for :qa commands
2019-02-12 17:33:18 +03:00
Alex Plate
fb277e9e49 Create package for handler tests 2019-02-12 17:15:53 +03:00
Alex Plate
8c6e4ecefc Update changelog 2019-02-12 16:52:21 +03:00
Alex Plate
582393a462 Fix :only command 2019-02-12 16:42:54 +03:00
Alex Plate
c118bacffd Create VimFileEditorTestCase for editor tests 2019-02-12 16:42:06 +03:00
Andrey Vlasovskikh
132f52785c Version 0.51 2019-02-12 00:08:12 +03:00
Matt Ellis
0c1a08b231 VIM-1303 Update UI when look and feel changes 2019-02-07 08:54:41 +00:00
bradziolko
b88f13ee32 [VIM-1012] Support tab close preferences when using :q or :wq 2019-01-29 02:09:53 -06:00
Andrey Vlasovskikh
c556ec2001 Merge branch 'fixes-by-matt'
# Conflicts:
#	resources/META-INF/plugin.xml
2019-01-28 23:05:23 +03:00
Andrey Vlasovskikh
d49683ab2f Updated Kotlin to 1.3 due to compatibility IntelliJ 2019.1
The minimal compatible version is now 2018.3.
2019-01-28 22:56:14 +03:00
Andrey Vlasovskikh
810c3cd561 Use the IntelliJ repo instead of the default cache-redirector due to network issues 2019-01-28 21:54:55 +03:00
Andrey Vlasovskikh
b909157f4b Mention Rider as a compatible IDE 2019-01-28 21:51:16 +03:00
Andrey Vlasovskikh
21c1232ba6 Updated the changelog 2019-01-28 21:42:21 +03:00
Andrey Vlasovskikh
ff61a42670 Updated usages of obsolete APIs 2019-01-28 21:40:14 +03:00
Andrey Vlasovskikh
f160d855c0 Added missing nullity annotations 2019-01-28 21:38:37 +03:00
Andrey Vlasovskikh
51685a2094 Renamed attributes according to naming convention 2019-01-28 20:49:23 +03:00
Andrey Vlasovskikh
487c71ec15 Updated since-build according to the version that introduced the required API 2019-01-28 20:42:40 +03:00
Andrey Vlasovskikh
39aa60850d Fixed inspection warnings 2019-01-28 20:41:56 +03:00
Andrey Vlasovskikh
872921e6b7 Reformat code 2019-01-28 20:39:45 +03:00
Andrey Vlasovskikh
89788df95c Merge branch 'pull/173' 2019-01-28 20:38:03 +03:00
Andrey Vlasovskikh
6ccd8ed0b8 Added Matt Ellis to the list of contributors 2019-01-27 17:04:44 +03:00
Andrey Vlasovskikh
aa7e3bfa69 Updated changelog 2019-01-27 17:03:46 +03:00
Andrey Vlasovskikh
00154f2b9f Merge branch 'pull/170' 2019-01-27 16:48:05 +03:00
Matt Ellis
531a9c28ae VIM-1558 Support block inlays 2019-01-25 12:31:42 +00:00
Tony Arra
63be2c28e9 Strip tag attributes from closing tag for Vim-Surround 2019-01-21 09:17:10 -05:00
Matt Ellis
56c4e3e31f VIM-1187 Fix performance with large files and relative line numbers 2019-01-08 13:47:05 +00:00
Matt Ellis
ef2497cadc Update to IJ 2018.3 2019-01-08 13:46:20 +00:00
Andrey Vlasovskikh
95f56a8869 Added Alex Plate to the contributors list 2018-12-31 18:10:44 +03:00
Andrey Vlasovskikh
f5b1112304 Updated changelog 2018-12-31 18:09:55 +03:00
Andrey Vlasovskikh
333a5be30b Merge branch 'pull/162' 2018-12-31 18:05:38 +03:00
Andrey Vlasovskikh
6c9e697892 VIM-620 Fixed handling nested <C-O> & <Esc> in Insert and Replace modes 2018-12-31 18:01:15 +03:00
Alex Plate
7663eb531e Write test to reproduce VIM-620 issue
Enter insert mode after single command produces incorrect behaviour.
Insert mode is not escaped after Esc
2018-12-29 00:36:51 +03:00
Andrew Potter
5e80e402ee Get indent from PsiFile so formatting on shift is consistent 2018-11-02 12:54:55 -04:00
Alex Plate
5529bf284a VIM-798 Arrow keys for window navigation commands
Add new mappings to allow window navigation with arrow keys:
- ^W-<left> as ^W-h
- ^W-<down> as ^W-j
- ^W-<up> as ^W-k
- ^W-<right> as ^W-l
2018-10-01 20:19:25 +03:00
Pierce Corcoran
9e2400de69 VIM-1473 Fix incorrect selection type for unnamed registers
Selection type for unnamed and unnamedplus will only be guessed when system clipboard is different from the internal register, and even then will never assume the text is a visual block selection.
2018-09-23 19:11:10 -07:00
Andrei Gasparovici
82dfcdd5df Added :tabn(ew) and :tabp(revious) functionality 2017-08-18 11:38:52 +03:00
Vedran Budimcic
44b9946bb0 Support end-of-line multi line percent match in visual mode 2017-03-24 07:12:28 -07:00
Marcel Hild
6efd4023fd make offset work in normal search 2017-03-23 11:33:08 +01:00
John Grib
b5ea2127d9 added :shell command 2016-06-17 15:03:38 +09:00
dos65
fe1184b0d3 keypadd arrows for nvo modes 2015-05-09 17:30:40 +03:00
745 changed files with 47842 additions and 21581 deletions

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
root = true
[*.java]
indent_size = 2
indent_style = space
[*.kt]
indent_size = 2
indent_style = space

View File

@@ -1,275 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="JAVA_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="JSP_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="XML_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="FIELD_NAME_PREFIX" value="my" />
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
<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" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<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" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<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" />
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<ADDITIONAL_INDENT_OPTIONS fileType="rb">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<codeStyleSettings language="CFML">
<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="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<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="ASSIGNMENT_WRAP" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="ECMA Script Level 4">
<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" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_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="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="GSP">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Groovy">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="ELSE_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" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<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="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_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" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
<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" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<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" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<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" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<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" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<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" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<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="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="Python">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="SQL">
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

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

View File

@@ -5,9 +5,10 @@ The original author:
* [Rick Maddy](mailto:rmaddy@maddyhome.com)
The current maintainer:
The current maintainers:
* [Andrey Vlasovskikh](mailto:andrey.vlasovskikh@gmail.com)
* [Alex Plate](mailto:alexpl292@gmail.com)
Previous maintainers:
@@ -36,7 +37,7 @@ Contributors:
* [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)
* [Daniel Leong](mailto:me@dhleong.net)
* [Aleksey Lagoshin](mailto:aleksey@pri-num.com)
* [Paulo Bu](mailto:pbu_98@yahoo.com)
* [Giorgos Gaganis](mailto:gaganis@yahoo.com)
@@ -52,6 +53,27 @@ Contributors:
* [Vasily Alferov](mailto:ya-ikmik2012@yandex.ru)
* [Vitalii Karavaev](mailto:fkve97@gmail.com)
* [John Lin](mailto:johnlinp@gmail.com)
* [Alex Plate](mailto:alexpl292@gmail.com)
* [Matt Ellis](mailto:m.t.ellis@gmail.com)
* [John Grib](mailto:johngrib82@gmail.com)
* [Marcel Hild](mailto:hild@b4mad.net)
* [Vedran Budimcic](mailto:vedranb@gmail.com)
* [Andrei Gasparovici](mailto:andreigasparovici1@gmail.com)
* [dos65](mailto:qtankle@gmail.com)
* [Tony Arra](mailto:ttonyarra@gmail.com)
* [Brad Ziolko](mailto:bradziolko@gmail.com)
* [sumoooru2](mailto:sumoooru2@gmail.com)
* [gecko655](mailto:aqwsedrft1234@yahoo.co.jp)
* [Daniele Megna](mailto:megna.dany@gmail.com)
* [Andrew Potter](mailto:apottere@gmail.com)
* [Romain Gautier](mailto:romain.gautier@nimamoh.net)
* [Elliot Courant](mailto:elliot.courant@wheniwork.com)
* [Simon Rainer](mailto:simon.rainer@fau.de)
* [Michael Ziwisky](mailto:mziwisky@instructure.com)
* [Pierce Corcoran](mailto:pierce@plasticcow.com)
* [Jonatan Tierno](mailto:jonatantierno@gmail.com)
* [Brendan Annable](mailto:brendan@annable.me)
* [Naveen Kumar Molleti](mailto:nerd.naveen@gmail.com)
If you are a contributor and your name is not listed here, feel free to
contact the maintainer.

View File

@@ -16,11 +16,120 @@ 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.
0.53, 2019-08-07
--------------
* [VIM-1711](https://youtrack.jetbrains.com/issue/VIM-1711) Search is not triggered during surround action
* [VIM-1712](https://youtrack.jetbrains.com/issue/VIM-1712) Fix `Y` command for visual mode
* [VIM-1713](https://youtrack.jetbrains.com/issue/VIM-1713) Surround in visual mode put caret in correct position
* [VIM-1732](https://youtrack.jetbrains.com/issue/VIM-1732) Fix SO after enabling vim mode
* [VIM-1710](https://youtrack.jetbrains.com/issue/VIM-1710) Fix opening empty file with "relative number" enabled
* [VIM-1725](https://youtrack.jetbrains.com/issue/VIM-1725) Fix problems with Japanese language
* [VIM-1648](https://youtrack.jetbrains.com/issue/VIM-1648) Fix exception while substitute with conformation
* [VIM-1736](https://youtrack.jetbrains.com/issue/VIM-1736) Fix `` for ex panel
* [VIM-1739](https://youtrack.jetbrains.com/issue/VIM-1739) Fix full-width characters for ex panel
To Be Released
0.52, 2019-07-23
--------------
...
* Introduce [Select Mode](https://github.com/JetBrains/ideavim/wiki/Select-mode).
* Fixed `:only` command
* [VIM-1586](https://youtrack.jetbrains.com/issue/VIM-1586) Support `:shell` command
* [VIM-801](https://youtrack.jetbrains.com/issue/VIM-801) Support `:tabnext` and `:tabprevious` commands
* [VIM-1570](https://youtrack.jetbrains.com/issue/VIM-1570) Support `g<C-A>` and `g<C-X>` commands for visual mode
* [VIM-1119](https://youtrack.jetbrains.com/issue/VIM-1119) Fixed 'e' search offset
* [VIM-1587](https://youtrack.jetbrains.com/issue/VIM-1587) Fixed end-of-line multi line percent match in visual mode
* [VIM-1303](https://youtrack.jetbrains.com/issue/VIM-1303) Fixed "Changing color schemes doesn't change find input"
* [VIM-944](https://youtrack.jetbrains.com/issue/VIM-944) Fixed navigation with keypad arrows
* [VIM-1569](https://youtrack.jetbrains.com/issue/VIM-1569) Fixed surround plugin bug by `S<tag attr="attr">`
* [VIM-1012](https://youtrack.jetbrains.com/issue/VIM-1012) Fixed wrong tab selection after`:q`
* [VIM-1245](https://youtrack.jetbrains.com/issue/VIM-1245) Clear switcher list after`:q`
* [VIM-1425](https://youtrack.jetbrains.com/issue/VIM-1425) Correct `%` command
* [VIM-1521](https://youtrack.jetbrains.com/issue/VIM-1521) Support `commentary` extension
* [VIM-907](https://youtrack.jetbrains.com/issue/VIM-907) Fix `va(` command
* [VIM-1067](https://youtrack.jetbrains.com/issue/VIM-1067) Fix repeating of `A` command
* [VIM-1615](https://youtrack.jetbrains.com/issue/VIM-1615) Fix `set so=999` command and line "bouncing" with inlays
* [VIM-1630](https://youtrack.jetbrains.com/issue/VIM-1630) Support `:tabonly` command
* [VIM-607](https://youtrack.jetbrains.com/issue/VIM-607) Fix memory leaks
* [VIM-1546](https://youtrack.jetbrains.com/issue/VIM-1546) Storing TAB key as input
* [VIM-1231](https://youtrack.jetbrains.com/issue/VIM-1231) Get indent from PsiFile
* [VIM-1633](https://youtrack.jetbrains.com/issue/VIM-1633) Fixed sequential text object commands in visual mode
* [VIM-1105](https://youtrack.jetbrains.com/issue/VIM-1105) Added the `:command` command
* [VIM-1090](https://youtrack.jetbrains.com/issue/VIM-1090) Fixed tag motion with duplicate tags
* [VIM-1644](https://youtrack.jetbrains.com/issue/VIM-1644) Fixed repeat with visual mode
* Fixed invoking IDE actions instead of command line actions with same shortcuts
* [VIM-1550](https://youtrack.jetbrains.com/issue/VIM-1550) Fixed leaving command line mode on backspace
* Fix insert position of `<C-R>` in ex commands
* Command line editing caret shape and insert digraph/register feedback
* [VIM-1419](https://youtrack.jetbrains.com/issue/VIM-1419),
[VIM-1493](https://youtrack.jetbrains.com/issue/VIM-1493) Correctly set focus when handling cmode mapping
* Fix incorrect handling of subsequent key strokes after ex command line loses focus
* [VIM-1240](https://youtrack.jetbrains.com/issue/VIM-1240) Improve UI of ex command line and output panel
* [VIM-1485](https://youtrack.jetbrains.com/issue/VIM-1485) Remove incorrect gap between ex command line label and text
* [VIM-1496](https://youtrack.jetbrains.com/issue/VIM-1496) Fix focus for Recent Files action
* [VIM-1275](https://youtrack.jetbrains.com/issue/VIM-1275) "Change In Brackets" for string
* [VIM-941](https://youtrack.jetbrains.com/issue/VIM-941) Fix tab for visual block mode
* [VIM-1002](https://youtrack.jetbrains.com/issue/VIM-1002) Fix dot command for tab
* [VIM-1426](https://youtrack.jetbrains.com/issue/VIM-1426) Correct `%` command
* [VIM-1655](https://youtrack.jetbrains.com/issue/VIM-1655) Deleted word should is not yanked with Ctrl-W in insert mode
* [VIM-1031](https://youtrack.jetbrains.com/issue/VIM-1031),
[VIM-1389](https://youtrack.jetbrains.com/issue/VIM-1389),
[VIM-1666](https://youtrack.jetbrains.com/issue/VIM-1666) Fix `<BS>` for digraphs
* [VIM-1628](https://youtrack.jetbrains.com/issue/VIM-1628) Fix dead keys for JBR11
* [VIM-1061](https://youtrack.jetbrains.com/issue/VIM-1061) Fix `^K` for digraphs
* [VIM-437](https://youtrack.jetbrains.com/issue/VIM-437) Support `keymode` option
* [VIM-274](https://youtrack.jetbrains.com/issue/VIM-274) Enter select mode for refactoring
* [VIM-510](https://youtrack.jetbrains.com/issue/VIM-510) Support `Extend Selection` for visual mode
* [VIM-606](https://youtrack.jetbrains.com/issue/VIM-606) Fix select text with mouse in insert mode
* [VIM-800](https://youtrack.jetbrains.com/issue/VIM-800) Fix surround with live template
* [VIM-1013](https://youtrack.jetbrains.com/issue/VIM-1013) Fix reformat code on selection
* [VIM-1214](https://youtrack.jetbrains.com/issue/VIM-1214) Fix insert text to empty row
* [VIM-1452](https://youtrack.jetbrains.com/issue/VIM-1452) Fix reselect visual block
* [VIM-1497](https://youtrack.jetbrains.com/issue/VIM-1497) Fix rename variable action
* [VIM-1541](https://youtrack.jetbrains.com/issue/VIM-1541) Fix visual block mode problems
* [VIM-1619](https://youtrack.jetbrains.com/issue/VIM-1619) Extract method for visual mode
* [VIM-1616](https://youtrack.jetbrains.com/issue/VIM-1616) `I` with multicaret works correctly
* [VIM-1631](https://youtrack.jetbrains.com/issue/VIM-1631) Fix visual block for tab character
* [VIM-1649](https://youtrack.jetbrains.com/issue/VIM-1649) Type variable for surround live template
* [VIM-1654](https://youtrack.jetbrains.com/issue/VIM-1654) Fix NPE while indent in visual block mode
* [VIM-1657](https://youtrack.jetbrains.com/issue/VIM-1657) Fix vim repeat in visual block
* [VIM-1659](https://youtrack.jetbrains.com/issue/VIM-1658) Fix selection on empty line
* [VIM-1473](https://youtrack.jetbrains.com/issue/VIM-1473) Yanked lines are not handled as block
selection when clipboard is used
* [VIM-714](https://youtrack.jetbrains.com/issue/VIM-714) Fixed problems with caret position by vertical movement
* [VIM-635](https://youtrack.jetbrains.com/issue/VIM-635) Supported `gn` commands
* [VIM-1535](https://youtrack.jetbrains.com/issue/VIM-1535) Use same text attributes and highlight layer as IntelliJ's own Find command
* [VIM-1413](https://youtrack.jetbrains.com/issue/VIM-1413) Fix `smartcase` option being ignored in incremental search
* Fix incremental search not matching with trailing options, e.g. `/Foo/+1`
* Move the current line as well as scrolling during incremental search
* [VIM-128](https://youtrack.jetbrains.com/issue/VIM-128) Fix `:substitute` not respecting `ignorecase` and `smartcase` options
* Fix next/previous search commands not respecting `smartcase` override
* Search highlights are updated when `ignorecase`, `smartcase` and `hlsearch` options are updated, and when plugin is disabled
* Incremental search highlights all matches in file, not just first
* Added incremental search highlights for `:substitute` command
* Fix exception when trying to highlight last CR in file
* Improve behavior of `<BS>` in command line entry
* [VIM-1626](https://youtrack.jetbrains.com/issue/VIM-1626) Add `ideajoin` option
* [VIM-959](https://youtrack.jetbrains.com/issue/VIM-959) Add `ideamarks` option
* [VIM-608](https://youtrack.jetbrains.com/issue/VIM-608) Automatic upload files on explicit save
* [VIM-1548](https://youtrack.jetbrains.com/issue/VIM-1548) Respect editor settings about tabs and spaces
* [VIM-1682](https://youtrack.jetbrains.com/issue/VIM-1682) Fix backward search with OR
* [VIM-752](https://youtrack.jetbrains.com/issue/VIM-752) Enter finishes template in normal mode
* [VIM-1668](https://youtrack.jetbrains.com/issue/VIM-1668) Fix smart step into
* [VIM-1697](https://youtrack.jetbrains.com/issue/VIM-1697) Fix wrong search with tab characters
* [VIM-1700](https://youtrack.jetbrains.com/issue/VIM-1700) Fix wrong search with tab characters
* [VIM-1698](https://youtrack.jetbrains.com/issue/VIM-1698) Paste doesn't clear clipboard
* [VIM-1359](https://youtrack.jetbrains.com/issue/VIM-1359) Fix behavior of i_CTRL-W action
0.51, 2019-02-12
----------------
* [VIM-1558](https://youtrack.jetbrains.com/issue/VIM-1558) Fixed scrolling for code with block inlays in Rider 2018.3
* [VIM-1187](https://youtrack.jetbrains.com/issue/VIM-1187) Improved performance of `set relativelinenumber` on large files
* [VIM-620](https://youtrack.jetbrains.com/issue/VIM-620) Fixed handling `<C-O>` and `<Esc>` in Insert and Replace modes
* [VIM-798](https://youtrack.jetbrains.com/issue/VIM-798) Allow arrow keys for window navigation commands
0.50, 2018-10-18
@@ -456,7 +565,7 @@ Bug fixes:
* VIM-312 Fixed range and caret position after `dw` on the last single-word
line, `w` command argument for the last word in file
* Fixed `w` motion at the last word
* VIM-85 Bug fix for gi behaviour
* VIM-85 Bug fix for gi behavior
* Always move cursor at the beginning of the deleted range
* VIM-275 Fixed edge cases for `i{` motion
* VIM-314 Made `i{` motion characterwise, not linewise/characterwise in visual

4
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,4 @@
## Code of Conduct
This project and the corresponding community is governed by the [JetBrains Open Source and Community Code of Conduct](https://confluence.jetbrains.com/display/ALL/JetBrains+Open+Source+and+Community+Code+of+Conduct). Please make sure you read it.

106
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,106 @@
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20183&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20183)/statusIcon.svg?guest=1"/>
</a>
<span>2018.3 Tests</span>
</div>
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20191&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20191)/statusIcon.svg?guest=1"/>
</a>
<span>2019.1 Tests</span>
</div>
### Where to Start
In order to contribute to IdeaVim, you should have some understanding of Java or [Kotlin](https://kotlinlang.org/).
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](https://youtrack.jetbrains.com/issues/VIM?q=%23patch_welcome%20%23Unresolved%20sort%20by:%20votes%20)
in the issue tracker.
- Read about the `@VimBehaviorDiffers` annotation and fix the corresponding functionality.
### Development Environment
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
2. Import the project from the existing sources in IntelliJ IDEA 2018.1 or newer (Community or
Ultimate), by selecting "File | New | Project from Existing Sources..." or selecting "Import
Project" from the Welcome screen.
* In the project wizard, select "Import project from external model | Gradle".
* Select your Java 8+ JDK as the Gradle JVM; leave other parameters unchanged.
3. Run your IdeaVim plugin within IntelliJ via a Gradle task:
* Select the "View | Tool Windows | Gradle" tool window.
* Launch "ideavim | intellij | runIde" from the tool window.
4. Run IdeaVim tests via a Gradle task:
* Select the "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 will be located at build/distributions/IdeaVim-VERSION.zip
* You can install this file by selecting "Settings | Plugins | Install plugin
from disk...".
### Copyright
1. Go to `Preferences | Appearance & Behavior | Scopes`, press "+" button, `Shared`.
Name: Copyright scope
Pattern: `file[IdeaVIM.main]:com//*||file[IdeaVIM.test]:*/`
2. Go to `Preferences | Editor | Copyright | Copyright Profiles` and click the "+" button.
Name: IdeaVim
Text:
IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
Copyright (C) 2003-$today.year 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/>.
3. Go to `Preferences | Editor | Copyright`, click the "+" button.
Scope: Copyright scope
Copyright: IdeaVim
### Testing
1. Read about the `@VimBehaviorDiffers` annotation.
2. Please avoid senseless text like "dhjkwaldjwa", "asdasdasd",
"123 123 123 123", etc. Try to choose an example text that is easy to
read and understand what is wrong if the test fails.
For example, take a few lines from your favorite poem, or use
"Vladimir Nabokov A Discovery" if you don't have one.
3. Test your functionality properly.
Especially check whether your command works with:
line start, line end, file start, file end, empty line, multiple carets, dollar motion, etc.

View File

@@ -1,8 +1,8 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
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
@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
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
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

115
README.md
View File

@@ -8,22 +8,23 @@ IdeaVim
</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 href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Deploy&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Deploy)/statusIcon.svg?guest=1"/>
</a>
<span>Build<span>
<span>Stable</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 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>Tests</span>
<span>EAP</span>
</div>
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ platform.
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ Platform.
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
RubyMine, AppCode, DataGrip, GoLand, Cursive, and Android Studio.
RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
Resources:
@@ -47,25 +48,31 @@ 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
Keymap" on Linux & Windows, and via "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
Get 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)
receive EAP builds as updates!
1. Open `Settings | Plugins`
2. Click the gear icon :gear:, select `Manage Plugin Repositories`, and add the following url:
`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.
It is important to distinguish EAP builds from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
You can always leave your feedback with:
* [@IdeaVim](http://twitter.com/ideavim) in Twitter
* [Bug tracker](http://youtrack.jetbrains.com/issues/VIM)
Summary of Supported Vim Features
---------------------------------
@@ -88,16 +95,18 @@ Supported:
* Command line and search history
* Window commands
* Vim web help
* Select mode
Emulated Vim plugins:
* vim-surround
* vim-multiple-cursors
* vim-commentary
Not supported (yet):
* Jump lists
* Various less used commands
* Various less-used commands
See also:
@@ -111,12 +120,12 @@ Files
* ~/.ideavimrc
* Your IdeaVim-specific Vim initialization commands
You can read your ~/.vimrc file from ~/.ideavimrc using this command:
You can read your ~/.vimrc file from ~/.ideavimrc with 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
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
@@ -141,6 +150,9 @@ Available extensions:
* multiple-cursors
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
* commentary
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
* Commands: `gcc`, `gc + motion`, `v_gc`
Changes to the IDE
@@ -148,19 +160,19 @@ Changes to the IDE
### Undo/Redo
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
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ Platform,
so the behavior of the `u` and `<C-R>` commands may differ from the original
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 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.
Using `<Esc>` in dialog windows remains problematic. For most dialog windows,
the Vim emulator is put into insert mode with `<Esc>` not working. You
should use `<C-c>` or `<C-[>` instead. In some dialog windows, the normal mode is
switched by default. The usage of the Vim emulator in dialog windows is an area for
improvement.
See also [unresolved escape issues](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
@@ -170,7 +182,7 @@ IdeaVim adds two commands for listing and executing arbitrary IDE actions as
Ex commands or via `:map` command mappings:
* `:actionlist [pattern]`
* Find IDE actions by name pattern
* Find IDE actions by name or keymap pattern (E.g. `:actionlist extract`, `:actionlist <C-D`)
* `:action {name}`
* Execute an action named `NAME`
@@ -182,52 +194,7 @@ For example, here `\r` is mapped to the Reformat Code action:
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. Import the project from existing sources in IntelliJ IDEA 2018.1 or newer (Community or
Ultimate) using "File | New | Project from Existing Sources..." or "Import
Project" from the start window.
* In the project wizard select "Import project from external model | Gradle"
* Select your Java 8+ JDK as the Gradle JVM, leave other parameters unchanged
3. Run your IdeaVim plugin within IntelliJ via a Gradle task
* Select "View | Tool Windows | Gradle" tool window
* 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"
See [CONTRIBUTING.md](CONTRIBUTING.md)
Authors
-------
@@ -239,4 +206,4 @@ for a list of authors and contributors.
License
-------
IdeaVim is licensed under the terms of the GNU Public license version 2.
IdeaVim is licensed under the terms of the GNU Public License version 2.

View File

@@ -9,7 +9,7 @@ buildscript {
}
plugins {
id 'org.jetbrains.intellij' version '0.3.12'
id 'org.jetbrains.intellij' version '0.4.9'
}
apply plugin: 'java'
@@ -36,11 +36,17 @@ intellij {
updateSinceUntilBuild false
downloadSources Boolean.valueOf(downloadIdeaSources)
instrumentCode Boolean.valueOf(instrumentPluginCode)
intellijRepo = "https://www.jetbrains.com/intellij-repository"
if (!Boolean.valueOf(legacyNoJavaPlugin)) {
// Since 192 version of IJ java plugin should be defined separately
// Set `legacyNoJavaPlugin` to true if you are going to run tests under idea version < 192
plugins = ['java']
}
publishPlugin {
channels publishChannels.split(',')
username publishUsername
password publishPassword
token publishToken
}
}
@@ -50,5 +56,22 @@ repositories {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlinVersion"
compile "org.jetbrains:annotations:17.0.0"
}
tasks.register("slackEapNotification") {
doLast {
if (!slackUrl) return
def post = new URL(slackUrl).openConnection()
def message = "{\"text\":\"New EAP released: $version\"}"
post.setRequestMethod("POST")
post.setDoOutput(true)
post.setRequestProperty("Content-Type", "application/json")
post.getOutputStream().write(message.getBytes("UTF-8"))
def postRC = post.getResponseCode()
println(postRC)
if(postRC.equals(200)) {
println(post.getInputStream().getText())
}
}
}

51
doc/ideajoin-examples.md Normal file
View File

@@ -0,0 +1,51 @@
Some examples of join command with `ideajoin` option enabled.
Put `set ideajoin` to your `~/.ideavimrc` to enable this functionality.
1) Automatic join concatenated lines:
```
"Hello" + -> "Hello world"
" world!"
```
2) Nested if's:
```
if (a) { -> if (a && b) {
if (b) { ...
... }
}
}
```
3) Remove braces from one line for / if / while:
```
if (fail) { -> if (fail) return;
return;
}
```
4) Kotlin one line method:
```
fun myNumber(): Int { -> fun myNumber(): Int = 42
return 42
}
```
5) Join declaration and initialization:
```
int a; -> int a = 5;
a = 5;
```
6) Chain call:
```
sb.append("a"); -> sb.append("a").append("b");
sb.append("b");
```
And other functions provided by the plugins.

View File

@@ -1,32 +1,92 @@
List of Supported Set Commands
==============================
The following `:set` commands can appear in `~/.ideavimrc` or set manually in the command mode:
The following `:set` commands can appear in `~/.ideavimrc` or be set manually in the command mode:
'clipboard' 'cb' clipboard options
Standard clipboard options plus
`ideaput` (default on) - IdeaVim ONLY
enable native idea paste action for put operations
'digraph' 'dg' enable the entering of digraphs in Insert mode
'gdefault' 'gd' the ":substitute" flag 'g' is default on
'gdefault' 'gd' the ":substitute" flag 'g' is by default
'history' 'hi' number of command-lines that are remembered
'hlsearch' 'hls' highlight matches with last search pattern
'hlsearch' 'hls' highlight matches with the last search pattern
`ideamarks` `ideamarks` Boolean (default true) - IdeaVim ONLY
If true, creation of global mark will trigger creation of IDE's bookmark
and vice versa.
'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
`keymodel` `km` String (default "continueselect,stopselect")
List of comma separated words, which enable special things that keys
can do. These values can be used:
startsel Using a shifted special[1] key starts selection (either
Select mode or Visual mode, depending on "key" being
present in 'selectmode').
stopsel Using a NOT-shifted special[1] key stops selection.
Automatically enables `stopselect` and `stopvisual`
stopselect Using a NOT-shifted special[1] key stops - IdeaVim ONLY
select mode and removes selection.
stopvisual Using a NOT-shifted special[1] key stops - IdeaVim ONLY
visual mode and removes selection.
continueselect Using a shifted arrow key doesn't - IdeaVim ONLY
start selection, but in select mode
acts like startsel is enabled
continuevisual Using a shifted arrow key doesn't - IdeaVim ONLY
start selection, but in visual mode
acts like startsel is enabled
'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
`lookupactions` `lookupactions` String (default "VimLookupUp,VimLookupDown") - IdeaVim Only
By default all actions are handled by the IDE if lookup is active.
This list of comma-separated words enables defined vim actions for active lookup.
'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
'scrolloff' 'so' minimum number of lines above and below the cursor
'selection' 'sel' what type of selection to use
'showmode' 'smd' message on status line to show current mode
'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
`selectmode` `slm` String (default "template")
This is a comma-separated list of words, which specify when to start
Select mode instead of Visual mode, when a selection is started.
Possible values:
mouse when using the mouse
key when using shifted special[1] keys
cmd when using "v", "V", or <C-V>
template when starting a template - IdeaVim ONLY
refactoring when refactoring without - IdeaVim ONLY
a template is performed
'showmode' 'smd' message on the status line to show current mode
`ideajoin` `ideajoin` Boolean (default false) - IdeaVim ONLY
If true, join command will be performed via IDE
See wiki/`ideajoin` examples
'sidescroll' 'ss' minimum number of columns to scroll horizontally
'sidescrolloff' 'siso' min. number of columns to left and right of cursor
'smartcase' 'scs' no ignore case when pattern is uppercase
'timeout' 'to' use timeout for mapped key sequences
'timeoutlen' 'tm' time that is waited for a mapped key sequence
'timeoutlen' 'tm' timeout duration 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
'wrapscan' 'ws' searches wrap around the end of file
----------
[1] - cursor keys, <End>, <Home>, <PageUp> and <PageDown>

View File

@@ -1,9 +1,14 @@
ideaVersion IC-2018.2.5
downloadIdeaSources true
instrumentPluginCode true
version SNAPSHOT
javaVersion 1.8
kotlinVersion 1.2.71
publishUsername username
publishPassword password
publishChannels eap
ideaVersion=192-EAP-SNAPSHOT
downloadIdeaSources=true
instrumentPluginCode=true
version=SNAPSHOT
javaVersion=1.8
kotlinVersion=1.3.41
publishUsername=username
publishToken=token
publishChannels=eap
# Since 192 version of IJ java plugin should be defined separately
# Set this value to true if you are going to run tests under idea version < 192
legacyNoJavaPlugin=false
slackUrl=

Binary file not shown.

View File

@@ -1,6 +1,24 @@
#Fri Dec 29 11:00:46 MSK 2017
#
# IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
# Copyright (C) 2003-2019 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/>.
#
#Thu Feb 21 15:20:13 MSK 2019
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
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

2
gradlew vendored
View File

@@ -28,7 +28,7 @@ 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=""
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

2
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@ 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=
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

191
index.txt
View File

@@ -1,191 +0,0 @@
*index.txt*
IDEAVIM REFERENCE MANUAL based on Vim Reference Manual
*index*
This file contains a list of commands that are covered with tests, for each
mode, with a tag and a short description. The lists are sorted on ASCII value.
Tip: When looking for certain functionality, use a search command. E.g.,
to look for deleting something, use: "/delete".
1. Insert mode |insert-index|
2. Normal mode |normal-index|
2.1. Text objects |objects|
2.3. Square bracket commands |[|
3. Visual mode |visual-index|
5. EX commands |ex-cmd-index|
==============================================================================
1. Insert mode *insert-index*
tag char action in Insert mode ~
-----------------------------------------------------------------------
|i_CTRL-K| CTRL-K {char1} {char2}
enter digraph
|i_CTRL-O| CTRL-O execute a single command and return to insert
mode
|i_CTRL-R| CTRL-R {0-9a-z"%#*:=}
insert the contents of a register
|i_CTRL-W| CTRL-W delete word before the cursor
==============================================================================
2. Normal mode *normal-index*
CHAR any non-blank character
WORD a sequence of non-blank characters
N a number entered before the command
{motion} a cursor movement command
Nmove the text that is moved over with a {motion}
SECTION a section that possibly starts with '}' instead of '{'
note: 1 = cursor movement command; 2 = can be undone/redone
tag char note action in Normal mode ~
------------------------------------------------------------------------------
|quote| "{a-zA-Z0-9.%#:-"} use register {a-zA-Z0-9.%#:-"} for next
delete, yank or put (uppercase to append)
({.%#:} only work with put)
|%| % 1 find the next (curly/square) bracket on
this line and go to its match, or go to
matching comment bracket, or go to matching
preprocessor directive.
|/| /{pattern}<CR> 1 search forward for the Nth occurrence of
{pattern}
|count| 0 1 cursor to the first char of the line
|count| 1 prepend to command to give a count
|count| 2 "
|count| 3 "
|count| 4 "
|count| 5 "
|count| 6 "
|count| 7 "
|count| 8 "
|count| 9 "
|F| F{char} 1 cursor to the Nth occurrence of {char} to
the left
|O| O 2 begin a new line above the cursor and
insert text, repeat N times
|P| ["x]P 2 put the text [from buffer x] before the
cursor N times
|T| T{char} 1 cursor till after Nth occurrence of {char}
to the left
|Y| ["x]Y yank N lines [into buffer x]; synonym for
"yy"
|c| ["x]c{motion} 2 delete Nmove text [into buffer x] and start
insert
|cc| ["x]cc 2 delete N lines [into buffer x] and start
|d| ["x]d{motion} 2 delete Nmove text [into buffer x]
|f| f{char} 1 cursor to Nth occurrence of {char} to the
right
|i| i 2 insert text before the cursor N times
|p| ["x]p 2 put the text [from register x] after the
cursor N times
|q| q{0-9a-zA-Z"} record typed characters into named register
{0-9a-zA-Z"} (uppercase to append)
|q| q (while recording) stops recording
|t| t{char} 1 cursor till before Nth occurrence of {char}
to the right
|y| ["x]y{motion} yank Nmove text [into buffer x]
|yy| ["x]yy yank N lines [into buffer x]
|~| ~ 2 'tildeop' off: switch case of N characters
under cursor and move the cursor N
characters to the right
==============================================================================
2.1 Text objects *objects*
These can be used after an operator or in Visual mode to select an object.
tag command action in op-pending and Visual mode ~
------------------------------------------------------------------------------
|v_aquote| a" double quoted string
|v_a'| a' single quoted string
|v_a(| a( same as ab
|v_a)| a) same as ab
|v_a<| a< "a <>" from '<' to the matching '>'
|v_a>| a> same as a<
|v_aB| aB "a Block" from "[{" to "]}" (with brackets)
|v_aW| aW "a WORD" (with white space)
|v_a[| a[ "a []" from '[' to the matching ']'
|v_a]| a] same as a[
|v_a`| a` string in backticks
|v_ab| ab "a block" from "[(" to "])" (with braces)
|v_ap| ap "a paragraph" (with white space)
|v_as| as "a sentence" (with white space)
|v_aw| aw "a word" (with white space)
|v_a{| a{ same as aB
|v_a}| a} same as aB
|v_iquote| i" double quoted string without the quotes
|v_i'| i' single quoted string without the quotes
|v_i(| i( same as ib
|v_i)| i) same as ib
|v_i<| i< "inner <>" from '<' to the matching '>'
|v_i>| i> same as i<
|v_iB| iB "inner Block" from "[{" and "]}"
|v_iW| iW "inner WORD"
|v_i[| i[ "inner []" from '[' to the matching ']'
|v_i]| i] same as i[
|v_i`| i` string in backticks without the backticks
|v_ib| ib "inner block" from "[(" to "])"
|v_ip| ip "inner paragraph"
|v_is| is "inner sentence"
|v_iw| iw "inner word"
|v_i{| i{ same as iB
|v_i}| i} same as iB
==============================================================================
2.3 Square bracket commands *[* *]*
tag char note action in Normal mode ~
------------------------------------------------------------------------------
|[(| [( 1 cursor N times back to unmatched '('
|[{| [{ 1 cursor N times back to unmatched '{'
|])| ]) 1 cursor N times forward to unmatched ')'
|]}| ]} 1 cursor N times forward to unmatched '}'
==============================================================================
2.4 Commands starting with 'g' *g*
tag char note action in Normal mode ~
------------------------------------------------------------------------------
|gg| gg 1 cursor to line N, default first line
|gi| gi 2 like "i", but first move to the |'^| mark
==============================================================================
3. Visual mode *visual-index*
Most commands in Visual mode are the same as in Normal mode. The ones listed
here are those that are different.
tag command note action in Visual mode ~
------------------------------------------------------------------------------
|v_y| y yank the highlighted area
==============================================================================
4. Command-line editing *ex-edit-index*
Get to the command-line with the ':', '!', '/' or '?' commands.
Normal characters are inserted at the current cursor position.
"Completion" below refers to context-sensitive completion. It will complete
file names, tags, commands etc. as appropriate.
tag command action in Command-line editing mode ~
------------------------------------------------------------------------------
|c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A}
insert the contents of a register or object
under the cursor as if typed
==============================================================================
5. EX commands *ex-cmd-index*
This is a brief but complete listing of all the ":" commands, without
mentioning any arguments. The optional part of the command name is inside [].
The commands are sorted on the non-optional part of their name.
tag command action ~
------------------------------------------------------------------------------
|:display| :di[splay] display registers
|:registers| :reg[isters] display the contents of registers
|:substitute| :s[ubstitute] find and replace text

View File

@@ -2,34 +2,16 @@
<name>IdeaVim</name>
<id>IdeaVIM</id>
<change-notes><![CDATA[
<p>0.50:</p>
<ul>
<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.49:</p>
<ul>
<li>Enabled zero-latency typing for Vim emulation</li>
<li>Support for <code>iskeyword</code> option</li>
<li>Various bug fixes</li>
</ul>
<p>0.48:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.47:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.46:</p>
<ul>
<li>Support for <code>incsearch</code> option for showing search results while typing</li>
<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>Support select mode</li>
<li>Integration with templates & in-line refactorings using Select mode</li>
<li>Support "Extend selection" action in visual mode</li>
<li>Commentary extension</li>
<li>Add options to integrate paste/join/marks with the IDE</li>
<li>Support 'gn' commands</li>
<li>Support :command command</li>
<li>Support :shell command</li>
<li>Support :tabnext and :tabprevious commands</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>
@@ -46,7 +28,7 @@
<version>SNAPSHOT</version>
<vendor>JetBrains</vendor>
<idea-version since-build="181.0"/>
<idea-version since-build="183.2940.10"/>
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
<depends>com.intellij.modules.lang</depends>
@@ -56,7 +38,15 @@
<component>
<implementation-class>com.maddyhome.idea.vim.VimPlugin</implementation-class>
</component>
<component>
<implementation-class>com.maddyhome.idea.vim.VimLocalConfig</implementation-class>
</component>
</application-components>
<project-components>
<component>
<implementation-class>com.maddyhome.idea.vim.VimProjectComponent</implementation-class>
</component>
</project-components>
<extensionPoints>
<extensionPoint qualifiedName="IdeaVIM.vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
@@ -64,11 +54,15 @@
<extensions defaultExtensionNs="com.intellij">
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
</extensions>
<extensions defaultExtensionNs="IdeaVIM">
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.commentary.CommentaryExtension"/>
</extensions>
<actions>
@@ -83,33 +77,52 @@
<!-- Left/Right -->
<action id="VimMotionColumn" class="com.maddyhome.idea.vim.action.motion.leftright.MotionColumnAction" text="Move to Column"/>
<action id="VimMotionFirstColumn" class="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstColumnAction" text="Start of Line"/>
<action id="VimMotionFirstColumnInsertMode" class="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstColumnInsertModeAction" text="Start of Line"/>
<action id="VimMotionFirstScreenColumn" class="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstScreenColumnAction" text="Start of Screen Line"/>
<action id="VimMotionFirstNonSpace" class="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstNonSpaceAction" text="First Character of Line"/>
<action id="VimMotionFirstScreenNonSpace" class="com.maddyhome.idea.vim.action.motion.leftright.MotionFirstScreenNonSpaceAction" text="First Character of Screen Line"/>
<action id="VimMotionLastColumn" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLastColumnAction" text="End of Line"/>
<action id="VimMotionLastColumnInsert" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLastColumnInsertAction" text="End of Line"/>
<action id="VimMotionLastScreenColumn" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLastScreenColumnAction" text="End of Screen Line"/>
<action id="VimMotionLastMatchChar" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLastMatchCharAction" text="Repeat Last Character Match"/>
<action id="VimMotionLastMatchCharReverse" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLastMatchCharReverseAction" text="Repeat Last Character Match in Reverse"/>
<action id="VimMotionLastNonSpace" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLastNonSpaceAction" text="Last Character of Line"/>
<action id="VimMotionLeft" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftAction" text="Left"/>
<action id="VimMotionLeftInsert" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftInsertModeAction" text="Left"/>
<action id="VimMotionLeftWrap" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftWrapAction" text="Left"/>
<action id="VimMotionLeftMatchChar" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftMatchCharAction" text="Move Left to Character"/>
<action id="VimMotionLeftTillMatchChar" class="com.maddyhome.idea.vim.action.motion.leftright.MotionLeftTillMatchCharAction" text="Move Left till Character"/>
<action id="VimMotionMiddleColumn" class="com.maddyhome.idea.vim.action.motion.leftright.MotionMiddleColumnAction" text="Middle of Screen"/>
<action id="VimMotionRight" class="com.maddyhome.idea.vim.action.motion.leftright.MotionRightAction" text="Right"/>
<action id="VimMotionRightInsert" class="com.maddyhome.idea.vim.action.motion.leftright.MotionRightInsertAction" text="Right"/>
<action id="VimMotionRightWrap" class="com.maddyhome.idea.vim.action.motion.leftright.MotionRightWrapAction" text="Right"/>
<action id="VimMotionRightMatchChar" class="com.maddyhome.idea.vim.action.motion.leftright.MotionRightMatchCharAction" text="Move Right to Character"/>
<action id="VimMotionRightTillMatchChar" class="com.maddyhome.idea.vim.action.motion.leftright.MotionRightTillMatchCharAction" text="Move Right till Character"/>
<action id="VimMotionHome" class="com.maddyhome.idea.vim.action.motion.leftright.MotionHomeAction" text="Move Home Key"/>
<action id="VimMotionShiftHome" class="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftHomeAction" text="Move Shift Home"/>
<action id="VimMotionEnd" class="com.maddyhome.idea.vim.action.motion.leftright.MotionEndAction" text="Move End Key"/>
<action id="VimMotionShiftEnd" class="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftEndAction" text="Move Shift End Key"/>
<!-- Up/Down -->
<action id="VimMotionDown" class="com.maddyhome.idea.vim.action.motion.updown.MotionDownAction" text="Down"/>
<action id="VimMotionNotLineWiseDown" class="com.maddyhome.idea.vim.action.motion.updown.MotionDownNotLineWiseAction" text="Down"/>
<action id="VimMotionDownFirstNonSpace" class="com.maddyhome.idea.vim.action.motion.updown.MotionDownFirstNonSpaceAction" text="Down to First non-Space"/>
<action id="VimEnterNormalAction" class="com.maddyhome.idea.vim.action.motion.updown.EnterNormalAction" text="Down to First non-Space"/>
<action id="VimMotionDownLess1FirstNonSpace" class="com.maddyhome.idea.vim.action.motion.updown.MotionDownLess1FirstNonSpaceAction" text="Down to First non-Space"/>
<action id="VimMotionGotoLineFirst" class="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineFirstAction" text="Goto Line"/>
<action id="VimMotionGotoLineFirstInsertMode" class="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineFirstInsertAction" text="Goto Line"/>
<action id="VimMotionGotoLineLast" class="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastAction" text="Goto Line"/>
<action id="VimMotionGotoLineLastEnd" class="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndAction" text="Goto Line End"/>
<action id="VimMotionGotoLineLastEndInsert" class="com.maddyhome.idea.vim.action.motion.updown.MotionGotoLineLastEndInsertAction" text="Goto Line End"/>
<action id="VimMotionPercentOrMatch" class="com.maddyhome.idea.vim.action.motion.updown.MotionPercentOrMatchAction" text="Percent Down or Match"/>
<action id="VimMotionUp" class="com.maddyhome.idea.vim.action.motion.updown.MotionUpAction" text="Up"/>
<action id="VimMotionUpNotLineWise" class="com.maddyhome.idea.vim.action.motion.updown.MotionUpNotLineWiseAction" text="Up"/>
<action id="VimMotionUpFirstNonSpace" class="com.maddyhome.idea.vim.action.motion.updown.MotionUpFirstNonSpaceAction" text="Up to First non-Space"/>
<action id="VimArrowMotionDown" class="com.maddyhome.idea.vim.action.motion.updown.MotionArrowDownAction" text="Arrow Down"/>
<action id="VimArrowMotionUp" class="com.maddyhome.idea.vim.action.motion.updown.MotionArrowUpAction" text="Arrow Up"/>
<action id="VimArrowMotionLeft" class="com.maddyhome.idea.vim.action.motion.leftright.MotionArrowLeftAction" text="Arrow Left"/>
<action id="VimArrowMotionRight" class="com.maddyhome.idea.vim.action.motion.leftright.MotionArrowRightAction" text="Arrow Right"/>
<action id="VimLookupDown" class="com.maddyhome.idea.vim.action.window.LookupDownAction" text="Down"/>
<action id="VimLookupUp" class="com.maddyhome.idea.vim.action.window.LookupUpAction" text="Up"/>
<!-- Text -->
<action id="VimMotionCamelEndLeft" class="com.maddyhome.idea.vim.action.motion.text.MotionCamelEndLeftAction" text="Camel Word End Left"/>
<action id="VimMotionCamelEndRight" class="com.maddyhome.idea.vim.action.motion.text.MotionCamelEndRightAction" text="Camel Word End Right"/>
@@ -121,8 +134,10 @@
<action id="VimMotionWordEndRight" class="com.maddyhome.idea.vim.action.motion.text.MotionWordEndRightAction" text="Word End Right"/>
<action id="VimMotionBigWordEndRight" class="com.maddyhome.idea.vim.action.motion.text.MotionBigWordEndRightAction" text="BigWord End Right"/>
<action id="VimMotionWordLeft" class="com.maddyhome.idea.vim.action.motion.text.MotionWordLeftAction" text="Word Left"/>
<action id="VimMotionWordLeftInsert" class="com.maddyhome.idea.vim.action.motion.text.MotionWordLeftInsertAction" text="Word Left"/>
<action id="VimMotionBigWordLeft" class="com.maddyhome.idea.vim.action.motion.text.MotionBigWordLeftAction" text="BigWord Left"/>
<action id="VimMotionWordRight" class="com.maddyhome.idea.vim.action.motion.text.MotionWordRightAction" text="Word Right"/>
<action id="VimMotionWordRightInsert" class="com.maddyhome.idea.vim.action.motion.text.MotionWordRightInsertAction" text="Word Right"/>
<action id="VimMotionBigWordRight" class="com.maddyhome.idea.vim.action.motion.text.MotionBigWordRightAction" text="BigWord Right"/>
<action id="VimMotionSentenceStartNext" class="com.maddyhome.idea.vim.action.motion.text.MotionSentenceNextStartAction" text="Next Sentence Start"/>
<action id="VimMotionSentenceStartPrevious" class="com.maddyhome.idea.vim.action.motion.text.MotionSentencePreviousStartAction" text="Previous Sentence Start"/>
@@ -170,13 +185,15 @@
<!-- Marks -->
<action id="VimMotionMark" class="com.maddyhome.idea.vim.action.motion.mark.MotionMarkAction" text="Mark"/>
<action id="VimMotionGotoFileMark" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkAction" text="Goto Mark"/>
<action id="VimMotionGotoFileMarkNoSaveJump" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkNoSaveJumpAction" text="Goto Mark"/>
<action id="VimMotionGotoFileMarkLine" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkLineAction" text="Goto Mark Line"/>
<action id="VimMotionGotoFileMarkLineNoSaveJumo" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoFileMarkLineNoSaveJumpAction" text="Goto Mark Line"/>
<action id="VimMotionGotoMark" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkAction" text="Goto Mark"/>
<action id="VimMotionGotoMarkNoSaveJump" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkNoSaveJumpAction" text="Goto Mark"/>
<action id="VimMotionGotoMarkLine" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkLineAction" text="Goto Mark Line"/>
<action id="VimMotionGotoMarkLineNoSaveJump" class="com.maddyhome.idea.vim.action.motion.mark.MotionGotoMarkLineNoSaveJumpAction" text="Goto Mark Line"/>
<action id="VimMotionJumpNext" class="com.maddyhome.idea.vim.action.motion.mark.MotionJumpNextAction" text="Goto Next Jump"/>
<action id="VimMotionJumpPrevious" class="com.maddyhome.idea.vim.action.motion.mark.MotionJumpPreviousAction" text="Goto Previous Jump"/>
<action id="VimForward" class="com.maddyhome.idea.vim.action.motion.mark.MotionJumpNextAction" text="Forward"/>
<action id="VimBack" class="com.maddyhome.idea.vim.action.motion.mark.MotionJumpPreviousAction" text="Back"/>
<!-- 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"/>
@@ -195,11 +212,17 @@
<action id="VimMotionScrollMiddleScreenLine" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollMiddleScreenLineAction" text="Scroll Line to Middle"/>
<action id="VimMotionScrollMiddleScreenLineStart" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollMiddleScreenLineStartAction" text="Scroll Line to Middle"/>
<action id="VimMotionScrollPageDown" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownAction" text="Scroll Page Down"/>
<action id="VimMotionScrollPageDownInsertMode" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownInsertModeAction" text="Scroll Page Down"/>
<action id="VimMotionScrollPageUp" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpAction" text="Scroll Page Up"/>
<action id="VimMotionScrollPageUpInsertMode" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpInsertModeAction" text="Scroll Page Up"/>
<action id="VimMotionScrollFirstScreenColumn" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollFirstScreenColumnAction" text="Scroll Column to first column"/>
<action id="VimMotionScrollLastScreenColumn" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollLastScreenColumnAction" text="Scroll Column to last column"/>
<action id="VimMotionScrollColumnLeft" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnLeftAction" text="Scroll Column Left"/>
<action id="VimMotionScrollColumnRight" class="com.maddyhome.idea.vim.action.motion.scroll.MotionScrollColumnRightAction" text="Scroll Column Right"/>
<action id="VimMotionShiftDown" class="com.maddyhome.idea.vim.action.motion.updown.MotionShiftDownAction" text="Shift Down"/>
<action id="VimMotionShiftUp" class="com.maddyhome.idea.vim.action.motion.updown.MotionShiftUpAction" text="Shift Up"/>
<action id="VimMotionShiftRight" class="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftRightAction" text="Shift Right"/>
<action id="VimMotionShiftLeft" class="com.maddyhome.idea.vim.action.motion.leftright.MotionShiftLeftAction" text="Shift Left"/>
<!-- Visual -->
<action id="VimVisualExitMode" class="com.maddyhome.idea.vim.action.motion.visual.VisualExitModeAction" text="Exit Visual Mode"/>
<action id="VimVisualToggleCharacterMode" class="com.maddyhome.idea.vim.action.motion.visual.VisualToggleCharacterModeAction" text="Toggle Character Selection"/>
@@ -210,6 +233,28 @@
<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"/>
<!-- Select-->
<action id="VimSelectEnableCharacterMode"
class="com.maddyhome.idea.vim.action.motion.select.SelectEnableCharacterModeAction"
text="Enter Character Select Mode"/>
<action id="VimSelectEnableLineMode" class="com.maddyhome.idea.vim.action.motion.select.SelectEnableLineModeAction"
text="Enter Line Select Mode"/>
<action id="VimSelectEnableBlockMode"
class="com.maddyhome.idea.vim.action.motion.select.SelectEnableBlockModeAction"
text="Enter Block Select Mode"/>
<action id="VimSelectMotionRight" class="com.maddyhome.idea.vim.action.motion.select.motion.SelectMotionRightAction"
text="Move Right Select Mode"/>
<action id="VimSelectMotionLeft" class="com.maddyhome.idea.vim.action.motion.select.motion.SelectMotionLeftAction"
text="Move Left Select Mode"/>
<action id="VimToggleVisual" class="com.maddyhome.idea.vim.action.motion.select.SelectToggleVisualMode"
text="Toggle Select/Visual mode"/>
<action id="VimSelectInsert" class="com.maddyhome.idea.vim.action.motion.select.SelectEnterAction"
text="Select Enter Action"/>
<action id="VimEscapeSelect" class="com.maddyhome.idea.vim.action.motion.select.SelectEscapeAction"
text="Select Escape Action"/>
<action id="VimDeleteAction" class="com.maddyhome.idea.vim.action.motion.select.SelectDeleteAction"
text="Select Delete Action"/>
<!-- Insert -->
<action id="VimInsertAfterCursor" class="com.maddyhome.idea.vim.action.change.insert.InsertAfterCursorAction" text="Insert After Cursor"/>
<action id="VimInsertAfterLineEnd" class="com.maddyhome.idea.vim.action.change.insert.InsertAfterLineEndAction" text="Insert After Line End"/>
@@ -261,8 +306,12 @@
<action id="VimChangeEndOfLine" class="com.maddyhome.idea.vim.action.change.change.ChangeEndOfLineAction" text="Change to End-of-Line"/>
<action id="VimChangeLine" class="com.maddyhome.idea.vim.action.change.change.ChangeLineAction" text="Change Line"/>
<action id="VimChangeMotion" class="com.maddyhome.idea.vim.action.change.change.ChangeMotionAction" text="Change Motion"/>
<action id="VimChangeNumberInc" class="com.maddyhome.idea.vim.action.change.change.ChangeNumberIncAction" text="Increment Number"/>
<action id="VimChangeNumberDec" class="com.maddyhome.idea.vim.action.change.change.ChangeNumberDecAction" text="Decrement Number"/>
<action id="VimChangeNumberInc" class="com.maddyhome.idea.vim.action.change.change.number.ChangeNumberIncAction" text="Increment Number"/>
<action id="VimChangeNumberDec" class="com.maddyhome.idea.vim.action.change.change.number.ChangeNumberDecAction" text="Decrement Number"/>
<action id="VimChangeVisualNumberInc" class="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberIncAction" text="Increment Number"/>
<action id="VimChangeVisualNumberDec" class="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberDecAction" text="Decrement Number"/>
<action id="VimChangeVisualAvalancheNumberInc" class="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberAvalancheIncAction" text="Increment Number"/>
<action id="VimChangeVisualAvalancheNumberDec" class="com.maddyhome.idea.vim.action.change.change.number.ChangeVisualNumberAvalancheDecAction" text="Decrement Number"/>
<action id="VimChangeReplace" class="com.maddyhome.idea.vim.action.change.change.ChangeReplaceAction" text="Replace"/>
<action id="VimChangeVisual" class="com.maddyhome.idea.vim.action.change.change.ChangeVisualAction" text="Change Motion"/>
<action id="VimChangeVisualCharacter" class="com.maddyhome.idea.vim.action.change.change.ChangeVisualCharacterAction" text="Change Motion"/>
@@ -278,9 +327,11 @@
<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="VimShiftLeftLinesNormalMode" class="com.maddyhome.idea.vim.action.change.shift.ShiftLeftLinesNormalModeAction" 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"/>
<action id="VimShiftRightLines" class="com.maddyhome.idea.vim.action.change.shift.ShiftRightLinesAction" text="Shift Lines Right"/>
<action id="VimShiftRightLinesNormalMode" class="com.maddyhome.idea.vim.action.change.shift.ShiftRightLinesNormalModeAction" text="Shift Lines Right"/>
<action id="VimShiftRightMotion" class="com.maddyhome.idea.vim.action.change.shift.ShiftRightMotionAction" text="Shift Motion Right"/>
<action id="VimShiftRightVisual" class="com.maddyhome.idea.vim.action.change.shift.ShiftRightVisualAction" text="Shift Visual Right"/>
@@ -293,6 +344,7 @@
<action id="VimCopyPutTextBeforeCursorMoveCursor" class="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorActionMoveCursor" text="Put Text"/>
<action id="VimCopySelectRegister" class="com.maddyhome.idea.vim.action.copy.SelectRegisterAction" text="Select Register"/>
<action id="VimCopyYankLine" class="com.maddyhome.idea.vim.action.copy.YankLineAction" text="Yank Line"/>
<action id="VimCopyYankMidCountLine" class="com.maddyhome.idea.vim.action.copy.YankLineMidCountAction" text="Yank Line"/>
<action id="VimCopyYankMotion" class="com.maddyhome.idea.vim.action.copy.YankMotionAction" text="Yank Motion"/>
<action id="VimCopyYankVisual" class="com.maddyhome.idea.vim.action.copy.YankVisualAction" text="Yank Motion"/>
<action id="VimCopyYankVisualLines" class="com.maddyhome.idea.vim.action.copy.YankVisualLinesAction" text="Yank Motion"/>
@@ -337,10 +389,7 @@
<action id="VimPlaybackLastRegister" class="com.maddyhome.idea.vim.action.macro.PlaybackLastRegisterAction" text="Playback Last Register"/>
<!-- Command Line -->
<action id="VimExBackspace" class="com.maddyhome.idea.vim.action.ex.BackspaceAction" text="Backspace"/>
<action id="VimProcessExEntry" class="com.maddyhome.idea.vim.action.ex.ProcessExEntryAction" text="Process Ex Entry"/>
<action id="VimProcessExKey" class="com.maddyhome.idea.vim.action.ex.ProcessExKeyAction" text="Process Ex Key"/>
<action id="VimCancelExEntry" class="com.maddyhome.idea.vim.action.ex.CancelExEntryAction" text="Cancel Ex Entry"/>
<!-- Other -->
<action id="VimLastSearchReplace" class="com.maddyhome.idea.vim.action.change.change.ChangeLastSearchReplaceAction" text="Repeat Last :s"/>
@@ -352,8 +401,20 @@
<action id="VimRedo" class="com.maddyhome.idea.vim.action.change.RedoAction" text="Redo"/>
<action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/>
<!-- Internal -->
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Add test inlays | IdeaVim internal" internal="true"/>
<!-- Keys -->
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
<action id="VimOperatorAction" class="com.maddyhome.idea.vim.action.change.OperatorAction" text="Operator"/>
<!-- Visual Selection of last Search Pattern (gn) -->
<action id="VimVisualSelectNextSearch" class="com.maddyhome.idea.vim.action.motion.gn.VisualSelectNextSearch" text="Visual Select Next Search"/>
<action id="VimVisualSelectPreviousSearch" class="com.maddyhome.idea.vim.action.motion.gn.VisualSelectPreviousSearch" text="Visual Select Previous Search"/>
<action id="VimGnNextTextObject" class="com.maddyhome.idea.vim.action.motion.gn.GnNextTextObject" text="Gn Next Text Object"/>
<action id="VimGnPreviousTextObject" class="com.maddyhome.idea.vim.action.motion.gn.GnPreviousTextObject" text="Gn Previous Text Object"/>
<action id="VimCtrlDownAction" class="com.maddyhome.idea.vim.action.motion.scroll.CtrlDownAction" text="Ctrl down"/>
<action id="VimCtrlUpAction" class="com.maddyhome.idea.vim.action.motion.scroll.CtrlUpAction" text="Ctrl up"/>
</actions>
</idea-plugin>

View File

@@ -1,8 +1,27 @@
#
# IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
# Copyright (C) 2003-2019 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/>.
#
notexcmd=Not an editor command: {0}
intbadcmd=Internal error - invalid command: {0}
e_backslash=E10: \\ should be followed by /, ? or &
e_badrange=Unexpected character ''{0}'' in range
e_norange=No range allowed
e_rangereq=Range required
e_argreq=Argument required
e_noprev=E34: No previous command
e_nopresub=E33: No previous substitute regular expression

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,15 +16,4 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.common;
import com.intellij.openapi.editor.LogicalPosition;
/**
*
*/
public class CharacterPosition extends LogicalPosition {
public CharacterPosition(int line, int col) {
super(line, col);
}
}
rootProject.name = 'IdeaVIM'

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,9 +18,16 @@
package com.maddyhome.idea.vim;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.TemplateManagerListener;
import com.intellij.find.FindManager;
import com.intellij.find.FindModelListener;
import com.intellij.ide.bookmarks.BookmarksListener;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.actionSystem.ex.AnActionListener;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
@@ -30,13 +37,17 @@ 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.openapi.util.Disposer;
import com.intellij.util.messages.MessageBusConnection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Map;
/**
* @author vlan
@@ -45,6 +56,7 @@ public class EventFacade {
@NotNull private static final EventFacade ourInstance = new EventFacade();
@Nullable private TypedActionHandler myOriginalTypedActionHandler;
private Map<Project, MessageBusConnection> connections = new HashMap<>();
private EventFacade() {
}
@@ -54,13 +66,10 @@ public class EventFacade {
return ourInstance;
}
public void addProjectManagerListener(@NotNull ProjectManagerListener listener) {
ProjectManager.getInstance().addProjectManagerListener(listener);
}
public void setupTypedActionHandler(@NotNull TypedActionHandler handler) {
public void setupTypedActionHandler(@NotNull VimTypedActionHandler handler) {
final TypedAction typedAction = getTypedAction();
myOriginalTypedActionHandler = typedAction.getRawHandler();
typedAction.setupRawHandler(handler);
}
@@ -75,15 +84,40 @@ public class EventFacade {
action.registerCustomShortcutSet(shortcutSet, component);
}
public void registerCustomShortcutSet(@NotNull AnAction action, @NotNull ShortcutSet shortcutSet,
@Nullable JComponent component, @NotNull Disposable disposable) {
action.registerCustomShortcutSet(shortcutSet, component, disposable);
}
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();
public void connectFileEditorManagerListener(@NotNull Project project, @NotNull FileEditorManagerListener listener) {
final MessageBusConnection connection = getConnection(project);
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener);
}
public void connectAnActionListener(@NotNull Project project, @NotNull AnActionListener listener) {
final MessageBusConnection connection = getConnection(project);
connection.subscribe(AnActionListener.TOPIC, listener);
}
public void connectTemplateStartedListener(@NotNull Project project, @NotNull TemplateManagerListener listener) {
final MessageBusConnection connection = getConnection(project);
connection.subscribe(TemplateManager.TEMPLATE_STARTED_TOPIC, listener);
}
public void connectBookmarkListener(@NotNull Project project, @NotNull BookmarksListener bookmarksListener) {
final MessageBusConnection connection = getConnection(project);
connection.subscribe(BookmarksListener.TOPIC, bookmarksListener);
}
public void connectFindModelListener(@NotNull Project project, @NotNull FindModelListener findModelListener) {
final MessageBusConnection connection = getConnection(project);
connection.subscribe(FindManager.FIND_MODEL_TOPIC, findModelListener);
}
public void addDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
document.addDocumentListener(listener);
}
@@ -96,6 +130,12 @@ public class EventFacade {
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
}
public void removeEditorFactoryListener(@NotNull EditorFactoryListener listener) {
// Listener is removed not only if application is disposed
//noinspection deprecation
EditorFactory.getInstance().removeEditorFactoryListener(listener);
}
public void addEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
editor.addEditorMouseListener(listener);
}
@@ -104,6 +144,14 @@ public class EventFacade {
editor.removeEditorMouseListener(listener);
}
public void addComponentMouseListener(@NotNull Component component, @NotNull MouseListener mouseListener) {
component.addMouseListener(mouseListener);
}
public void removeComponentMouseListener(@NotNull Component component, @NotNull MouseListener mouseListener) {
component.removeMouseListener(mouseListener);
}
public void addEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
editor.addEditorMouseMotionListener(listener);
}
@@ -120,6 +168,31 @@ public class EventFacade {
editor.getSelectionModel().removeSelectionListener(listener);
}
public void registerLookupListener(@NotNull Project project, @NotNull PropertyChangeListener propertyChangeListener) {
LookupManager.getInstance(project).addPropertyChangeListener(propertyChangeListener, project);
}
public void removeLookupListener(@NotNull Project project, @NotNull PropertyChangeListener propertyChangeListener) {
LookupManager.getInstance(project).removePropertyChangeListener(propertyChangeListener);
}
public void disableBusConnection() {
connections.values().forEach(MessageBusConnection::disconnect);
connections.clear();
}
private MessageBusConnection getConnection(Project project) {
if (!connections.containsKey(project)) {
final MessageBusConnection connection = project.getMessageBus().connect();
connections.put(project, connection);
Disposer.register(project, () -> {
connection.disconnect();
connections.remove(project);
});
}
return connections.get(project);
}
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,10 +18,8 @@
package com.maddyhome.idea.vim;
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.ide.IdeEventQueue;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -30,19 +28,14 @@ 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.command.MappingMode;
import com.maddyhome.idea.vim.action.MotionEditorAction;
import com.maddyhome.idea.vim.action.TextObjectAction;
import com.maddyhome.idea.vim.command.*;
import com.maddyhome.idea.vim.extension.VimExtensionHandler;
import com.maddyhome.idea.vim.group.RegisterGroup;
import com.maddyhome.idea.vim.helper.DigraphSequence;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.helper.RunnableHelper;
import com.maddyhome.idea.vim.helper.StringHelper;
import com.maddyhome.idea.vim.helper.*;
import com.maddyhome.idea.vim.key.*;
import com.maddyhome.idea.vim.option.Options;
import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -96,23 +89,25 @@ public class KeyHandler {
}
/**
* Invoked before acquiring a write lock and actually handling the keystroke.
* Execute an action
*
* 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
* @param action The action to execute
* @param context The context to run it in
*/
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);
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?
final AnActionEvent event =
new AnActionEvent(null, context, ActionPlaces.ACTION_SEARCH, action.getTemplatePresentation(), ActionManager.getInstance(), 0);
action.update(event);
if (event.getPresentation().isEnabled()) {
action.actionPerformed(event);
return true;
}
return false;
}
/**
@@ -127,12 +122,36 @@ public class KeyHandler {
handleKey(editor, key, context, true);
}
public void handleKey(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
/**
* Invoked before acquiring a write lock and actually handling the keystroke.
* <p>
* 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);
}
}
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);
editor = HelperKt.getTopLevelEditor(editor);
final CommandState editorState = CommandState.getInstance(editor);
// If this is a "regular" character keystroke, get the character
@@ -171,7 +190,7 @@ public class KeyHandler {
// Ask the key/action tree if this is an appropriate key at this point in the command and if so,
// return the node matching this keystroke
final Node node = editorState.getCurrentNode().getChild(key);
final Node node = editorState.getCurrentNode().getChildOrArgument(key);
if (handleDigraph(editor, key, context, node)) {
return;
@@ -183,7 +202,7 @@ public class KeyHandler {
}
// If this is a command node the user has entered a valid key sequence of a known command
else if (node instanceof CommandNode) {
handleCommandNode(editor, context, (CommandNode)node);
handleCommandNode(editor, (CommandNode)node);
}
// 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
@@ -191,7 +210,7 @@ public class KeyHandler {
shouldRecord = handleArgumentNode(editor, key, context, editorState, (ArgumentNode)node);
}
else {
if (lastWasBS && lastChar != 0 && Options.getInstance().isSet("digraph")) {
if (lastWasBS && lastChar != 0 && OptionsManager.INSTANCE.getDigraph().isSet()) {
char dig = VimPlugin.getDigraph().getDigraph(lastChar, key.getKeyChar());
key = KeyStroke.getKeyStroke(dig);
}
@@ -202,6 +221,11 @@ public class KeyHandler {
shouldRecord = false;
}
}
else if (editorState.getMode() == CommandState.Mode.SELECT) {
if (!VimPlugin.getChange().processKeyInSelectMode(editor, context, key)) {
shouldRecord = false;
}
}
else if (editorState.getMappingMode() == MappingMode.CMD_LINE) {
if (!VimPlugin.getProcess().processExKey(editor, key)) {
shouldRecord = false;
@@ -212,7 +236,8 @@ public class KeyHandler {
state = State.BAD_COMMAND;
}
lastChar = key.getKeyChar();
lastChar = lastWasBS && lastChar != 0 ? 0 : key.getKeyChar();
lastWasBS = false;
partialReset(editor);
}
}
@@ -240,92 +265,6 @@ public class KeyHandler {
}
}
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;
@@ -343,12 +282,8 @@ public class KeyHandler {
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("EditorEscape", context);
}
}, "", null);
CommandProcessor.getInstance().executeCommand(editor.getProject(),
() -> KeyHandler.executeAction("EditorEscape", context), "", null);
}
VimPlugin.indicateError();
}
@@ -356,17 +291,110 @@ public class KeyHandler {
reset(editor);
}
private boolean isDeleteCommandCount(@NotNull KeyStroke key, @NotNull CommandState editorState) {
return (editorState.getMode() == CommandState.Mode.COMMAND || editorState.getMode() == CommandState.Mode.VISUAL) &&
state == State.NEW_COMMAND && currentArg != Argument.Type.CHARACTER && currentArg != Argument.Type.DIGRAPH &&
key.getKeyCode() == KeyEvent.VK_DELETE && count != 0;
private boolean handleKeyMapping(@NotNull final Editor editor,
@NotNull final KeyStroke key,
@NotNull final DataContext context) {
final CommandState commandState = CommandState.getInstance(editor);
commandState.stopMappingTimer();
final MappingMode mappingMode = commandState.getMappingMode();
if (MappingMode.NVO.contains(mappingMode) && (state != State.NEW_COMMAND || currentArg != Argument.Type.NONE)) {
return false;
}
private boolean isCommandCount(@NotNull CommandState editorState, char chKey) {
final List<KeyStroke> mappingKeys = commandState.getMappingKeys();
final List<KeyStroke> fromKeys = new ArrayList<>(mappingKeys);
fromKeys.add(key);
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() && OptionsManager.INSTANCE.getTimeout().isSet()) {
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 = () -> {
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);
}
// NB: mappingInfo MUST be non-null here, so if equal
// then prevMappingInfo is also non-null; this also
// means that the prev mapping was a prefix, but the
// next key typed (`key`) was not part of that
if (prevMappingInfo == mappingInfo) {
// post to end of queue so it's handled AFTER
// an <Plug> mapping is invoked (since that
// will also get posted)
Runnable handleRemainingKey = () -> handleKey(editor, key, currentContext);
if (application.isUnitTestMode()) {
handleRemainingKey.run();
}
else {
application.invokeLater(handleRemainingKey);
}
}
};
if (application.isUnitTestMode()) {
handleMappedKeys.run();
}
else {
application.invokeLater(handleMappedKeys);
}
return true;
}
else {
final List<KeyStroke> unhandledKeys = new ArrayList<>(mappingKeys);
mappingKeys.clear();
for (KeyStroke keyStroke : unhandledKeys) {
handleKey(editor, keyStroke, context, false);
}
return false;
}
}
private boolean isDeleteCommandCount(@NotNull KeyStroke key, @NotNull CommandState editorState) {
return (editorState.getMode() == CommandState.Mode.COMMAND || editorState.getMode() == CommandState.Mode.VISUAL) &&
state == State.NEW_COMMAND && currentArg != Argument.Type.CHARACTER && currentArg != Argument.Type.DIGRAPH &&
Character.isDigit(chKey) &&
(count != 0 || chKey != '0');
state == State.NEW_COMMAND &&
currentArg != Argument.Type.CHARACTER &&
currentArg != Argument.Type.DIGRAPH &&
key.getKeyCode() == KeyEvent.VK_DELETE &&
count != 0;
}
private boolean isEditorReset(@NotNull KeyStroke key, @NotNull CommandState editorState) {
@@ -402,7 +430,18 @@ public class KeyHandler {
}
}
private boolean handleDigraph(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
private boolean isCommandCount(@NotNull CommandState editorState, char chKey) {
return (editorState.getMode() == CommandState.Mode.COMMAND || editorState.getMode() == CommandState.Mode.VISUAL) &&
state == State.NEW_COMMAND &&
currentArg != Argument.Type.CHARACTER &&
currentArg != Argument.Type.DIGRAPH &&
Character.isDigit(chKey) &&
(count != 0 || chKey != '0');
}
private boolean handleDigraph(@NotNull Editor editor,
@NotNull KeyStroke key,
@NotNull DataContext context,
@Nullable Node node) {
if (digraph == null && !(node instanceof CommandNode) && DigraphSequence.isDigraphStart(key)) {
digraph = new DigraphSequence();
@@ -431,7 +470,9 @@ public class KeyHandler {
return false;
}
private void executeCommand(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
private void executeCommand(@NotNull Editor editor,
@NotNull KeyStroke key,
@NotNull DataContext context,
@NotNull CommandState editorState) {
// 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
@@ -466,7 +507,12 @@ public class KeyHandler {
// Save off the command we are about to execute
editorState.setCommand(cmd);
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
if (lastChar != 0 && !lastWasBS) {
lastWasBS = key.equals(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
}
else {
lastChar = 0;
}
Project project = editor.getProject();
final Command.Type type = cmd.getType();
@@ -474,6 +520,11 @@ public class KeyHandler {
VimPlugin.indicateError();
reset(editor);
}
if (!cmd.getFlags().contains(CommandFlags.FLAG_TYPEAHEAD_SELF_MANAGE)) {
IdeEventQueue.getInstance().flushDelayedKeyEvents();
}
if (ApplicationManager.getApplication().isDispatchThread()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
String name = cmd.getAction().getTemplatePresentation().getText();
@@ -490,8 +541,60 @@ public class KeyHandler {
}
}
private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,
@NotNull CommandState editorState, @NotNull ArgumentNode node) {
private void handleCommandNode(@NotNull Editor editor, @NotNull CommandNode node) {
// If all does well we are ready to process this command
state = State.READY;
// Did we just get the completed sequence for a motion command argument?
if (currentArg == Argument.Type.MOTION) {
// We have been expecting a motion argument - is this one?
if (node.getCmdType() == Command.Type.MOTION) {
if (!(node.getAction() instanceof MotionEditorAction) && !(node.getAction() instanceof TextObjectAction)) {
throw new RuntimeException("MOTION cmd type can be used only with MotionEditorAction or TextObjectAction - " +
node.getAction().getClass().getName());
}
// Create the motion command and add it to the stack
Command cmd = new Command(count, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd);
}
else if (node.getCmdType() == Command.Type.RESET) {
currentCmd.clear();
Command cmd = new Command(1, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd);
}
else {
// Oops - this wasn't a motion command. The user goofed and typed something else
state = State.BAD_COMMAND;
}
}
else if (currentArg == Argument.Type.EX_STRING && node.getFlags().contains(CommandFlags.FLAG_COMPLETE_EX)) {
String text = VimPlugin.getProcess().endSearchCommand(editor);
Argument arg = new Argument(text);
Command cmd = currentCmd.peek();
cmd.setArgument(arg);
CommandState.getInstance(editor).popState();
}
// The user entered a valid command that doesn't take any arguments
else {
// Create the command and add it to the stack
Command cmd = new Command(count, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd);
// This is a sanity check that the command has a valid action. This should only fail if the
// programmer made a typo or forgot to add the action to the plugin.xml file
if (cmd.getAction() == null) {
state = State.ERROR;
}
}
}
private boolean handleArgumentNode(@NotNull Editor editor,
@NotNull KeyStroke key,
@NotNull DataContext context,
@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);
@@ -508,7 +611,7 @@ public class KeyHandler {
currentArg = node.getArgType();
// 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) {
if (node.getFlags().contains(CommandFlags.FLAG_OP_PEND)) {
editorState.pushState(editorState.getMode(), editorState.getSubMode(), MappingMode.OP_PENDING);
}
break;
@@ -530,55 +633,25 @@ public class KeyHandler {
return true;
}
private void handleCommandNode(@NotNull Editor editor, @NotNull DataContext context, @NotNull CommandNode node) {
// If all does well we are ready to process this command
state = State.READY;
// Did we just get the completed sequence for a motion command argument?
if (currentArg == Argument.Type.MOTION) {
// We have been expecting a motion argument - is this one?
if (node.getCmdType() == Command.Type.MOTION) {
// Create the motion command and add it to the stack
Command cmd = new Command(count, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd);
}
else if (node.getCmdType() == Command.Type.RESET) {
currentCmd.clear();
Command cmd = new Command(1, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd);
}
else {
// Oops - this wasn't a motion command. The user goofed and typed something else
state = State.BAD_COMMAND;
}
}
else if (currentArg == Argument.Type.EX_STRING && (node.getFlags() & Command.FLAG_COMPLETE_EX) != 0) {
String text = VimPlugin.getProcess().endSearchCommand(editor, context);
Argument arg = new Argument(text);
Command cmd = currentCmd.peek();
cmd.setArgument(arg);
CommandState.getInstance(editor).popState();
}
// The user entered a valid command that doesn't take any arguments
else {
// Create the command and add it to the stack
Command cmd = new Command(count, node.getActionId(), node.getAction(), node.getCmdType(), node.getFlags());
cmd.setKeys(keys);
currentCmd.push(cmd);
// This is a sanity check that the command has a valid action. This should only fail if the
// programmer made a typo or forgot to add the action to the plugin.xml file
if (cmd.getAction() == null) {
state = State.ERROR;
}
}
/**
* Execute an action by name
*
* @param name The name of the action to execute
* @param context The context to run it in
*/
public static boolean executeAction(@NotNull String name, @NotNull DataContext context) {
ActionManager aMgr = ActionManager.getInstance();
AnAction action = aMgr.getAction(name);
return action != null && executeAction(action, context);
}
private void handleBranchNode(@NotNull Editor editor, @NotNull DataContext context, @NotNull CommandState editorState,
char key, @NotNull BranchNode node) {
private void handleBranchNode(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull CommandState editorState,
char key,
@NotNull BranchNode node) {
// Flag that we aren't allowing any more count digits (unless it's OK)
if ((node.getFlags() & Command.FLAG_ALLOW_MID_COUNT) == 0) {
if (!node.getFlags().contains(CommandFlags.FLAG_ALLOW_MID_COUNT)) {
state = State.COMMAND;
}
editorState.setCurrentNode(node);
@@ -590,7 +663,7 @@ public class KeyHandler {
state = State.BAD_COMMAND;
return;
}
if (editorState.isRecording() && (arg.getFlags() & Command.FLAG_NO_ARG_RECORDING) != 0) {
if (editorState.isRecording() && arg.getFlags().contains(CommandFlags.FLAG_NO_ARG_RECORDING)) {
handleKey(editor, KeyStroke.getKeyStroke(' '), context);
}
@@ -603,40 +676,6 @@ public class KeyHandler {
}
}
/**
* Execute an action by name
*
* @param name The name of the action to execute
* @param context The context to run it in
*/
public static boolean executeAction(@NotNull String name, @NotNull DataContext context) {
ActionManager aMgr = ActionManager.getInstance();
AnAction action = aMgr.getAction(name);
return action != null && executeAction(action, context);
}
/**
* Execute an action
*
* @param action The action to execute
* @param context The context to run it in
*/
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?
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;
}
/**
* Partially resets the state of this handler. Resets the command count, clears the key list, resets the key tree
* node to the root for the current mode we are in.
@@ -645,7 +684,7 @@ public class KeyHandler {
*/
private void partialReset(@Nullable Editor editor) {
count = 0;
keys = new ArrayList<KeyStroke>();
keys = new ArrayList<>();
CommandState editorState = CommandState.getInstance(editor);
editorState.stopMappingTimer();
editorState.getMappingKeys().clear();
@@ -691,6 +730,7 @@ public class KeyHandler {
this.key = key;
}
@Override
public void run() {
CommandState editorState = CommandState.getInstance(editor);
boolean wasRecording = editorState.isRecording();
@@ -713,7 +753,7 @@ public class KeyHandler {
// mode commands. An exception is if this command should leave us in the temporary mode such as
// "select register"
if (editorState.getSubMode() == CommandState.SubMode.SINGLE_COMMAND &&
(cmd.getFlags() & Command.FLAG_EXPECT_MORE) == 0) {
(!cmd.getFlags().contains(CommandFlags.FLAG_EXPECT_MORE))) {
editorState.popState();
}
@@ -730,18 +770,14 @@ public class KeyHandler {
private final KeyStroke key;
}
private static enum State {
NEW_COMMAND,
COMMAND,
READY,
ERROR,
BAD_COMMAND
private enum State {
NEW_COMMAND, COMMAND, READY, ERROR, BAD_COMMAND
}
private int count;
private List<KeyStroke> keys;
private State state;
@NotNull private final Stack<Command> currentCmd = new Stack<Command>();
@NotNull private final Stack<Command> currentCmd = new Stack<>();
@NotNull private Argument.Type currentArg;
private TypedActionHandler origHandler;
@Nullable private DigraphSequence digraph = null;

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,754 +19,68 @@ package com.maddyhome.idea.vim;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.action.VimCommandActionBase;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.group.KeyGroup;
import com.maddyhome.idea.vim.key.Shortcut;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.util.EnumSet;
public class RegisterActions {
class RegisterActions {
/**
* Register all the key/action mappings for the plugin.
*/
public static void registerActions() {
static void registerActions() {
registerVimCommandActions();
registerInsertModeActions();
registerNormalModeActions();
registerNVOModesActions();
registerCommandLineActions();
registerVariousModesActions();
registerSystemMappings();
}
private static void registerVimCommandActions() {
final ActionManagerEx manager = ActionManagerEx.getInstanceEx();
for (String actionId : manager.getPluginActions(VimPlugin.getPluginId())) {
final AnAction action = manager.getAction(actionId);
if (action instanceof VimCommandAction) {
VimPlugin.getKey().registerCommandAction((VimCommandAction)action, actionId);
if (action instanceof VimCommandActionBase) {
VimPlugin.getKey().registerCommandAction((VimCommandActionBase)action, actionId);
}
}
}
private static void registerVariousModesActions() {
private static void registerSystemMappings() {
final KeyGroup parser = VimPlugin.getKey();
parser.registerAction(MappingMode.NV, "VimVisualToggleLineMode", Command.Type.OTHER_READONLY, Command.FLAG_MOT_LINEWISE,
new Shortcut('V'));
parser.registerAction(MappingMode.NV, "VimVisualToggleBlockMode", Command.Type.OTHER_READONLY,
Command.FLAG_MOT_BLOCKWISE,
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_MASK))}
);
parser.registerAction(MappingMode.NV, "VimMotionMark", Command.Type.OTHER_READONLY, new Shortcut('m'),
Argument.Type.CHARACTER);
parser.registerAction(MappingMode.NV, "VimGotoDeclaration", Command.Type.OTHER_READONLY, Command.FLAG_SAVE_JUMP,
new Shortcut[]{new Shortcut("gD"), new Shortcut("gd"),
// TODO: <C-]> is a tag command similar to gD, the tag stack is not implemented
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, KeyEvent.CTRL_MASK)),}
);
parser.registerAction(MappingMode.NV, "VimFileGetLocationInfo", Command.Type.OTHER_READONLY, new Shortcut(
new KeyStroke[]{KeyStroke.getKeyStroke('g'),
KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK)})
);
parser.registerAction(MappingMode.NV, "CollapseAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zM"));
parser.registerAction(MappingMode.NV, "CollapseRegion", Command.Type.OTHER_READONLY, new Shortcut("zc"));
parser.registerAction(MappingMode.NV, "CollapseRegionRecursively", Command.Type.OTHER_READONLY, new Shortcut("zC"));
parser.registerAction(MappingMode.NV, "ExpandAllRegions", Command.Type.OTHER_READONLY, new Shortcut("zR"));
parser.registerAction(MappingMode.NV, "ExpandRegion", Command.Type.OTHER_READONLY, new Shortcut("zo"));
parser.registerAction(MappingMode.NV, "ExpandRegionRecursively", Command.Type.OTHER_READONLY, new Shortcut("zO"));
parser.registerAction(MappingMode.NV, "VimToggleRecording",
Command.Type.OTHER_READONLY,
Command.FLAG_NO_ARG_RECORDING,
new Shortcut('q'), Argument.Type.CHARACTER);
// Text Object Actions for Visual and Operator Pending Modes
parser.registerAction(MappingMode.VO, "VimMotionGotoFileMark", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP, new Shortcut('`'),
Argument.Type.CHARACTER);
parser.registerAction(MappingMode.VO, "VimMotionGotoFileMarkLine", Command.Type.MOTION,
Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP, new Shortcut('\''),
Argument.Type.CHARACTER);
parser.registerAction(MappingMode.VO, "VimMotionGotoFileMark", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE,
new Shortcut("g`"), Argument.Type.CHARACTER);
parser.registerAction(MappingMode.VO, "VimMotionGotoFileMarkLine", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE,
new Shortcut("g'"), Argument.Type.CHARACTER);
parser.registerAction(MappingMode.VO, "VimMotionTextOuterWord", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE, new Shortcut("aw"));
parser.registerAction(MappingMode.VO, "VimMotionTextOuterBigWord", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE, new Shortcut("aW"));
parser.registerAction(MappingMode.VO, "VimMotionTextInnerWord", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE, new Shortcut("iw"));
parser.registerAction(MappingMode.VO, "VimMotionTextInnerBigWord", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE, new Shortcut("iW"));
parser.registerAction(MappingMode.VO, "VimMotionInnerParagraph", Command.Type.MOTION,
Command.FLAG_MOT_LINEWISE | Command.FLAG_TEXT_BLOCK, new Shortcut("ip"));
parser.registerAction(MappingMode.VO, "VimMotionOuterParagraph", Command.Type.MOTION,
Command.FLAG_MOT_LINEWISE | Command.FLAG_TEXT_BLOCK, new Shortcut("ap"));
parser.registerAction(MappingMode.VO, "VimMotionInnerSentence",
Command.Type.MOTION,
Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut("is"));
parser.registerAction(MappingMode.VO, "VimMotionOuterSentence", Command.Type.MOTION,
Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut("as"));
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockAngle", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("i<"), new Shortcut("i>")}
);
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockBrace", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("iB"), new Shortcut("i{"), new Shortcut("i}")}
);
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockBracket", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("i["), new Shortcut("i]")}
);
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockParen", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("ib"), new Shortcut("i("), new Shortcut("i)")}
);
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockDoubleQuote", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("i\""),}
);
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockSingleQuote", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("i'"),}
);
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockBackQuote", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("i`"),}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockAngle",
Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut[]{
new Shortcut("a<"),
new Shortcut("a>")
});
parser.registerAction(MappingMode.VO, "VimMotionInnerBlockTag", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("it")}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBrace", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("aB"), new Shortcut("a{"), new Shortcut("a}")}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBracket", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("a["), new Shortcut("a]")}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockParen", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("ab"), new Shortcut("a("), new Shortcut("a)")}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockDoubleQuote", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("a\""),}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockSingleQuote", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("a'"),}
);
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockBackQuote", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK, new Shortcut[]{
new Shortcut("a`"),
});
parser.registerAction(MappingMode.VO, "VimMotionOuterBlockTag", Command.Type.MOTION,
Command.FLAG_MOT_CHARACTERWISE | Command.FLAG_MOT_INCLUSIVE | Command.FLAG_TEXT_BLOCK,
new Shortcut[]{new Shortcut("at")}
);
parser.registerAction(MappingMode.NO, "VimResetMode", Command.Type.RESET, new Shortcut(new KeyStroke[]{
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, KeyEvent.CTRL_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)
}));
}
private static void registerCommandLineActions() {
final KeyGroup parser = VimPlugin.getKey();
parser
.registerAction(MappingMode.C, "VimProcessExEntry", Command.Type.OTHER_READ_WRITE, Command.FLAG_COMPLETE_EX,
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke((char)0x0a)),
new Shortcut(KeyStroke.getKeyStroke((char)0x0d))});
}
/**
* Register normal, visual, operator pending modes actions.
*/
private static void registerNVOModesActions() {
final KeyGroup parser = VimPlugin.getKey();
parser.registerAction(MappingMode.NVO, "VimCopySelectRegister", Command.Type.SELECT_REGISTER, Command.FLAG_EXPECT_MORE,
new Shortcut('"'), Argument.Type.CHARACTER);
// Motion Actions
// TODO - add ['
// TODO - add [`
// TODO - add ]'
// TODO - add ]`
// TODO - add zj
// TODO - add zk
parser.registerAction(MappingMode.NVO, "VimMotionNextTab", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("gt"));
parser.registerAction(MappingMode.NVO, "VimMotionPreviousTab", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("gT"));
parser.registerAction(MappingMode.NVO, "VimMotionCamelEndLeft", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("]b"));
parser.registerAction(MappingMode.NVO, "VimMotionCamelEndRight", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("]w"));
parser.registerAction(MappingMode.NVO, "VimMotionCamelLeft", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE,
new Shortcut("[b"));
parser.registerAction(MappingMode.NVO, "VimMotionCamelRight", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE,
new Shortcut("[w"));
parser.registerAction(MappingMode.NVO, "VimMotionColumn", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE,
new Shortcut('|'));
parser.registerAction(MappingMode.NVO, "VimMotionDown", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE, new Shortcut[]{
new Shortcut('j'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)),
});
parser.registerAction(MappingMode.NVO, "VimMotionDown", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut("gj"),
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('g'), KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionDownFirstNonSpace", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE, new Shortcut[]{
new Shortcut('+'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionDownLess1FirstNonSpace", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE,
new Shortcut('_'));
parser.registerAction(MappingMode.NVO, "VimMotionFirstColumn", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('0'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0))
});
parser.registerAction(MappingMode.NVO, "VimMotionFirstScreenColumn", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut("g0"),
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('g'), KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionFirstNonSpace", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('^')
});
parser.registerAction(MappingMode.NVO, "VimMotionFirstScreenNonSpace", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut("g^")
});
parser
.registerAction(MappingMode.NVO, "VimMotionFirstScreenLine", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut[]{
new Shortcut('H')
});
parser
.registerAction(MappingMode.NVO, "VimMotionGotoLineFirst", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut[]{
new Shortcut("gg"),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, KeyEvent.CTRL_MASK))
});
parser
.registerAction(MappingMode.NVO, "VimMotionGotoLineLast", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut('G'));
parser
.registerAction(MappingMode.NVO, "VimMotionGotoLineLastEnd", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_END, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.NVO, "VimMotionLastColumn", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE, new Shortcut[]{
new Shortcut('$'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0))
});
parser.registerAction(MappingMode.NVO, "VimMotionLastScreenColumn", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE, new Shortcut[]{
new Shortcut("g$"),
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('g'), KeyStroke.getKeyStroke(KeyEvent.VK_END, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionLastMatchChar", Command.Type.MOTION,
new Shortcut(';'));
parser.registerAction(MappingMode.NVO, "VimMotionLastMatchCharReverse", Command.Type.MOTION,
new Shortcut(','));
parser.registerAction(MappingMode.NVO, "VimMotionLastNonSpace", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("g_"));
parser
.registerAction(MappingMode.NVO, "VimMotionLastScreenLine", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut('L'));
parser.registerAction(MappingMode.NVO, "VimMotionLeft", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('h'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0))
});
parser.registerAction(MappingMode.NVO, "VimMotionLeftMatchChar", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_ALLOW_DIGRAPH,
new Shortcut('F'), Argument.Type.DIGRAPH);
parser.registerAction(MappingMode.NVO, "VimMotionLeftTillMatchChar", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_ALLOW_DIGRAPH,
new Shortcut('T'), Argument.Type.DIGRAPH);
parser.registerAction(MappingMode.NVO, "VimMotionLeftWrap", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionMiddleColumn", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("gm"));
parser.registerAction(MappingMode.NVO, "VimMotionMiddleScreenLine", Command.Type.MOTION,
Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut('M'));
parser
.registerAction(MappingMode.NVO, "VimMotionNthCharacter", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("go"));
// This represents two commands and one is linewise and the other is inclusive - the handler will fix it
parser.registerAction(MappingMode.NVO, "VimMotionPercentOrMatch", Command.Type.MOTION, Command.FLAG_SAVE_JUMP,
new Shortcut('%'));
parser.registerAction(MappingMode.NVO, "VimMotionRight", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('l'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0))
});
parser.registerAction(MappingMode.NVO, "VimMotionRightMatchChar", Command.Type.MOTION,
Command.FLAG_MOT_INCLUSIVE | Command.FLAG_ALLOW_DIGRAPH,
new Shortcut('f'), Argument.Type.DIGRAPH);
parser.registerAction(MappingMode.NVO, "VimMotionRightTillMatchChar", Command.Type.MOTION,
Command.FLAG_MOT_INCLUSIVE | Command.FLAG_ALLOW_DIGRAPH,
new Shortcut('t'), Argument.Type.DIGRAPH);
parser.registerAction(MappingMode.NVO, "VimMotionRightWrap", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE,
new Shortcut(' '));
parser.registerAction(MappingMode.NVO, "VimMotionScrollFirstScreenLine", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("zt")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollFirstScreenColumn", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("zs")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollFirstScreenLineStart", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('z'), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollFirstScreenLinePageStart", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("z+")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollHalfPageDown", Command.Type.OTHER_READONLY, Command.FLAG_IGNORE_SCROLL_JUMP,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.NVO, "VimMotionScrollHalfPageUp", Command.Type.OTHER_READONLY, Command.FLAG_IGNORE_SCROLL_JUMP,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.NVO, "VimMotionScrollLastScreenLine", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("zb")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollLastScreenColumn", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("ze")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollLastScreenLineStart", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("z-")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollLastScreenLinePageStart", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("z^")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollLineDown", Command.Type.OTHER_READONLY,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.NVO, "VimMotionScrollLineUp", Command.Type.OTHER_READONLY,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.NVO, "VimMotionScrollMiddleScreenLine", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("zz")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollMiddleScreenLineStart", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut("z.")
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollColumnLeft", Command.Type.OTHER_READONLY, Command.FLAG_IGNORE_SIDE_SCROLL_JUMP,
new Shortcut[]{
new Shortcut("zl"),
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('z'), KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollColumnRight", Command.Type.OTHER_READONLY, Command.FLAG_IGNORE_SIDE_SCROLL_JUMP,
new Shortcut[]{
new Shortcut("zh"),
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('z'), KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollPageDown", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0))
});
parser.registerAction(MappingMode.NVO, "VimMotionScrollPageUp", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionUp", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE, new Shortcut[]{
new Shortcut('k'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)),
});
parser.registerAction(MappingMode.NVO, "VimMotionUp", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut("gk"),
new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke('g'), KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)})
});
parser.registerAction(MappingMode.NVO, "VimMotionUpFirstNonSpace", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE,
new Shortcut('-'));
parser.registerAction(MappingMode.NVO, "VimMotionWordEndLeft", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("ge"));
parser.registerAction(MappingMode.NVO, "VimMotionWordEndRight", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut('e'));
parser.registerAction(MappingMode.NVO, "VimMotionWordLeft", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('b'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionWordRight", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('w'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionBigWordEndLeft", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut("gE"));
parser.registerAction(MappingMode.NVO, "VimMotionBigWordEndRight", Command.Type.MOTION, Command.FLAG_MOT_INCLUSIVE,
new Shortcut('E'));
parser.registerAction(MappingMode.NVO, "VimMotionBigWordLeft", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('B'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionBigWordRight", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE, new Shortcut[]{
new Shortcut('W'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_MASK))
});
parser.registerAction(MappingMode.NVO, "VimMotionSentenceStartPrevious", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('('));
parser.registerAction(MappingMode.NVO, "VimMotionSentenceStartNext", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut(')'));
parser.registerAction(MappingMode.NVO, "VimMotionSentenceEndPrevious", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("g("));
parser.registerAction(MappingMode.NVO, "VimMotionSentenceEndNext", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("g)"));
parser.registerAction(MappingMode.NVO, "VimMotionParagraphPrevious", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('{'));
parser
.registerAction(MappingMode.NVO, "VimMotionParagraphNext", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('}'));
parser.registerAction(MappingMode.NVO, "VimMotionUnmatchedBraceOpen", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("[{"));
parser.registerAction(MappingMode.NVO, "VimMotionUnmatchedBraceClose", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("]}"));
parser.registerAction(MappingMode.NVO, "VimMotionUnmatchedParenOpen", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("[("));
parser.registerAction(MappingMode.NVO, "VimMotionUnmatchedParenClose", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("])"));
parser.registerAction(MappingMode.NVO, "VimMotionSectionBackwardEnd", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("[]"));
parser.registerAction(MappingMode.NVO, "VimMotionSectionBackwardStart", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("[["));
parser.registerAction(MappingMode.NVO, "VimMotionSectionForwardEnd", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("]]"));
parser.registerAction(MappingMode.NVO, "VimMotionSectionForwardStart", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("]["));
parser.registerAction(MappingMode.NVO, "VimMotionMethodBackwardEnd", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("[M"));
parser.registerAction(MappingMode.NVO, "VimMotionMethodBackwardStart", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("[m"));
parser.registerAction(MappingMode.NVO, "VimMotionMethodForwardEnd", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("]M"));
parser.registerAction(MappingMode.NVO, "VimMotionMethodForwardStart", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("]m"));
// Misc Actions
parser.registerAction(MappingMode.NVO, "VimSearchFwdEntry", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SEARCH_FWD | Command.FLAG_SAVE_JUMP,
new Shortcut('/'), Argument.Type.EX_STRING);
parser.registerAction(MappingMode.NVO, "VimSearchRevEntry", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SEARCH_REV | Command.FLAG_SAVE_JUMP,
new Shortcut('?'), Argument.Type.EX_STRING);
parser.registerAction(MappingMode.NVO, "VimSearchAgainNext", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('n'));
parser
.registerAction(MappingMode.NVO, "VimSearchAgainPrevious", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('N'));
parser.registerAction(MappingMode.NVO, "VimExEntry", Command.Type.OTHER_READ_WRITE,
new Shortcut(':'));
parser.registerAction(MappingMode.NVO, "VimSearchWholeWordForward", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('*'));
parser.registerAction(MappingMode.NVO, "VimSearchWholeWordBackward", Command.Type.MOTION,
Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('#'));
parser
.registerAction(MappingMode.NVO, "VimSearchWordForward", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("g*"));
parser
.registerAction(MappingMode.NVO, "VimSearchWordBackward", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut("g#"));
}
private static void registerNormalModeActions() {
final KeyGroup parser = VimPlugin.getKey();
// Copy/Paste Actions
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursor", Command.Type.PASTE,
new Shortcut('P'));
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursor", Command.Type.PASTE,
new Shortcut('p'));
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorMoveCursor", Command.Type.PASTE,
new Shortcut("gP"));
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorMoveCursor", Command.Type.PASTE,
new Shortcut("gp"));
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
new Shortcut("[P"),
new Shortcut("]P"),
new Shortcut("[p")
});
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
new Shortcut("]p")
});
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY,
new Shortcut('Y'));
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY, Command.FLAG_ALLOW_MID_COUNT,
new Shortcut("yy"));
parser.registerAction(MappingMode.N, "VimCopyYankMotion", Command.Type.COPY, Command.FLAG_OP_PEND,
new Shortcut('y'), Argument.Type.MOTION);
// Insert/Replace/Change Actions
parser.registerAction(MappingMode.N, "VimChangeCaseLowerMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut("gu"), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimChangeCaseToggleCharacter", Command.Type.CHANGE,
new Shortcut('~'));
parser.registerAction(MappingMode.N, "VimChangeCaseToggleMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut("g~"), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimChangeCaseUpperMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut("gU"), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimChangeCharacter", Command.Type.CHANGE, Command.FLAG_ALLOW_DIGRAPH,
new Shortcut('r'), Argument.Type.DIGRAPH);
parser
.registerAction(MappingMode.N, "VimChangeCharacters", Command.Type.CHANGE, Command.FLAG_NO_REPEAT | Command.FLAG_MULTIKEY_UNDO,
new Shortcut('s'));
parser
.registerAction(MappingMode.N, "VimChangeEndOfLine", Command.Type.CHANGE, Command.FLAG_NO_REPEAT | Command.FLAG_MULTIKEY_UNDO,
new Shortcut('C'));
parser.registerAction(MappingMode.N, "VimChangeLine", Command.Type.CHANGE,
Command.FLAG_NO_REPEAT | Command.FLAG_ALLOW_MID_COUNT | Command.FLAG_MULTIKEY_UNDO, new Shortcut[]{
new Shortcut("cc"),
new Shortcut('S')
});
parser.registerAction(MappingMode.N, "VimChangeNumberInc", Command.Type.CHANGE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.N, "VimChangeNumberDec", Command.Type.CHANGE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.N, "VimChangeMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND | Command.FLAG_MULTIKEY_UNDO,
new Shortcut('c'), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimChangeReplace", Command.Type.CHANGE, Command.FLAG_MULTIKEY_UNDO,
new Shortcut('R'));
parser.registerAction(MappingMode.N, "VimDeleteCharacter", Command.Type.DELETE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)));
parser.registerAction(MappingMode.N, "VimDeleteCharacterLeft", Command.Type.DELETE,
new Shortcut('X'));
parser.registerAction(MappingMode.N, "VimDeleteCharacterRight", Command.Type.DELETE,
new Shortcut('x'));
parser.registerAction(MappingMode.N, "VimDeleteEndOfLine", Command.Type.DELETE,
new Shortcut('D'));
parser.registerAction(MappingMode.N, "VimDeleteJoinLines", Command.Type.DELETE,
new Shortcut("gJ"));
parser.registerAction(MappingMode.N, "VimDeleteJoinLinesSpaces", Command.Type.DELETE,
new Shortcut('J'));
parser.registerAction(MappingMode.N, "VimDeleteLine", Command.Type.DELETE, Command.FLAG_ALLOW_MID_COUNT,
new Shortcut("dd"));
parser.registerAction(MappingMode.N, "VimDeleteMotion", Command.Type.DELETE, Command.FLAG_OP_PEND,
new Shortcut('d'), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimFilterCountLines", Command.Type.CHANGE,
new Shortcut("!!"));
parser.registerAction(MappingMode.N, "VimFilterMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut('!'), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimInsertAfterCursor", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut('a'));
parser.registerAction(MappingMode.N, "VimInsertAfterLineEnd", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut('A'));
parser.registerAction(MappingMode.N, "VimInsertAtPreviousInsert", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut("gi"));
parser.registerAction(MappingMode.N, "VimInsertBeforeFirstNonBlank", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut('I'));
parser.registerAction(MappingMode.N, "VimInsertLineStart", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut("gI"));
parser.registerAction(MappingMode.N, "VimInsertNewLineAbove", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut('O'));
parser.registerAction(MappingMode.N, "VimInsertNewLineBelow", Command.Type.INSERT, Command.FLAG_MULTIKEY_UNDO,
new Shortcut('o'));
// Motion Actions
parser
.registerAction(MappingMode.N, "VimMotionGotoMark", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE | Command.FLAG_SAVE_JUMP,
new Shortcut('`'), Argument.Type.CHARACTER);
parser
.registerAction(MappingMode.N, "VimMotionGotoMarkLine", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE | Command.FLAG_SAVE_JUMP,
new Shortcut('\''), Argument.Type.CHARACTER);
parser.registerAction(MappingMode.N, "VimMotionGotoMark", Command.Type.MOTION, Command.FLAG_MOT_EXCLUSIVE,
new Shortcut("g`"), Argument.Type.CHARACTER);
parser.registerAction(MappingMode.N, "VimMotionGotoMarkLine", Command.Type.MOTION, Command.FLAG_MOT_LINEWISE,
new Shortcut("g'"), Argument.Type.CHARACTER);
// Misc Actions
parser.registerAction(MappingMode.N, "VimLastSearchReplace", Command.Type.OTHER_WRITABLE,
new Shortcut('&'));
parser.registerAction(MappingMode.N, "VimLastGlobalSearchReplace", Command.Type.OTHER_WRITABLE,
new Shortcut("g&"));
parser.registerAction(MappingMode.N, "VimRepeatChange", Command.Type.OTHER_WRITABLE,
new Shortcut('.'));
parser.registerAction(MappingMode.N, "VimRepeatExCommand", Command.Type.OTHER_WRITABLE,
new Shortcut("@:"));
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY,
new Shortcut('K'));
parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_SELF_SYNCHRONIZED,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_SELF_SYNCHRONIZED, new Shortcut[]{
new Shortcut('u'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
});
// File Actions
parser.registerAction(MappingMode.N, "VimFileSaveClose", Command.Type.OTHER_WRITABLE, new Shortcut[]{
new Shortcut("ZQ"),
new Shortcut("ZZ")
});
parser.registerAction(MappingMode.N, "VimFilePrevious", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_6, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_CIRCUMFLEX, KeyEvent.CTRL_MASK))
});
// Shift Actions
parser.registerAction(MappingMode.N, "VimAutoIndentLines", Command.Type.CHANGE,
new Shortcut("=="));
parser.registerAction(MappingMode.N, "VimAutoIndentMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut('='), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimShiftLeftLines", Command.Type.CHANGE,
new Shortcut("<<"));
parser.registerAction(MappingMode.N, "VimShiftLeftMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut('<'), Argument.Type.MOTION);
parser.registerAction(MappingMode.N, "VimShiftRightLines", Command.Type.CHANGE,
new Shortcut(">>"));
parser.registerAction(MappingMode.N, "VimShiftRightMotion", Command.Type.CHANGE, Command.FLAG_OP_PEND,
new Shortcut('>'), Argument.Type.MOTION);
// Jump Actions
parser.registerAction(MappingMode.N, "VimMotionJumpNext", Command.Type.OTHER_READONLY, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0))
});
parser.registerAction(MappingMode.N, "VimMotionJumpPrevious", Command.Type.OTHER_READONLY,
new Shortcut[] {
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK)),
// TODO: <C-T> is a tag command similar to <C-O>, the tag stack is not implemented
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK))
});
parser.registerAction(MappingMode.N, "VimFileGetAscii", Command.Type.OTHER_READONLY,
new Shortcut("ga"));
parser.registerAction(MappingMode.N, "VimFileGetHex", Command.Type.OTHER_READONLY,
new Shortcut("g8"));
parser.registerAction(MappingMode.N, "VimFileGetFileInfo", Command.Type.OTHER_READONLY,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK)));
// Macro Actions
parser.registerAction(MappingMode.N, "VimPlaybackLastRegister", Command.Type.OTHER_WRITABLE,
new Shortcut("@@"));
parser.registerAction(MappingMode.N, "VimPlaybackRegister", Command.Type.OTHER_WRITABLE,
new Shortcut('@'), Argument.Type.CHARACTER);
// TODO - support for :map macros
}
private static void registerInsertModeActions() {
final KeyGroup parser = VimPlugin.getKey();
// Other insert actions
parser
.registerAction(MappingMode.I, "EditorBackSpace", Command.Type.INSERT, Command.FLAG_IS_BACKSPACE,
parser.registerAction(MappingMode.I, "EditorBackSpace", Command.Type.INSERT, EnumSet.noneOf(CommandFlags.class),
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0))}
);
parser.registerAction(MappingMode.I, "EditorDelete", Command.Type.INSERT, Command.FLAG_SAVE_STROKE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)));
parser.registerAction(MappingMode.I, "EditorDown", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0))
});
parser.registerAction(MappingMode.I, "EditorTab", Command.Type.INSERT, Command.FLAG_SAVE_STROKE, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0))
});
parser.registerAction(MappingMode.I, "EditorUp", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, 0))
});
parser.registerAction(MappingMode.I, "VimInsertCharacterAboveCursor", Command.Type.INSERT,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimInsertCharacterBelowCursor", Command.Type.INSERT,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimInsertDeleteInsertedText", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimInsertDeletePreviousWord", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimInsertEnter", Command.Type.INSERT, Command.FLAG_SAVE_STROKE, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0))
});
parser.registerAction(MappingMode.I, "VimInsertPreviousInsert", Command.Type.INSERT,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimInsertPreviousInsertExit", Command.Type.INSERT, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_AT, KeyEvent.CTRL_MASK))
});
parser.registerAction(MappingMode.I, "VimInsertRegister", Command.Type.INSERT,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)),
Argument.Type.CHARACTER);
parser.registerAction(MappingMode.I, "VimInsertReplaceToggle", Command.Type.INSERT, Command.FLAG_SAVE_STROKE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0)));
parser.registerAction(MappingMode.I, "VimInsertSingleCommand", Command.Type.INSERT,
Command.FLAG_CLEAR_STROKES | Command.FLAG_EXPECT_MORE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimMotionFirstColumn", Command.Type.INSERT, Command.FLAG_SAVE_STROKE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0)));
parser.registerAction(MappingMode.I, "VimMotionGotoLineFirst", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimMotionGotoLineLastEnd", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_END, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimMotionLastColumn", Command.Type.INSERT, Command.FLAG_SAVE_STROKE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0)));
parser.registerAction(MappingMode.I, "VimMotionLeft", Command.Type.INSERT, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0))
});
parser.registerAction(MappingMode.I, "VimMotionRight", Command.Type.INSERT, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0))
});
parser.registerAction(MappingMode.I, "VimMotionScrollPageUp", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.I, "VimMotionScrollPageDown", Command.Type.INSERT, Command.FLAG_CLEAR_STROKES, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.I, "VimMotionWordLeft", Command.Type.INSERT, Command.FLAG_SAVE_STROKE, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.I, "VimMotionWordRight", Command.Type.INSERT, Command.FLAG_SAVE_STROKE, new Shortcut[]{
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, KeyEvent.SHIFT_MASK))
});
parser.registerAction(MappingMode.I, "VimShiftLeftLines", Command.Type.INSERT, Command.FLAG_SAVE_STROKE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.I, "VimShiftRightLines", Command.Type.INSERT, Command.FLAG_SAVE_STROKE,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK)));
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0))});
parser.registerAction(MappingMode.I, "EditorDelete", Command.Type.INSERT, EnumSet.of(CommandFlags.FLAG_SAVE_STROKE),
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0))});
parser.registerAction(MappingMode.I, "EditorDown", Command.Type.INSERT, EnumSet.of(CommandFlags.FLAG_CLEAR_STROKES),
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0))});
parser.registerAction(MappingMode.I, "EditorTab", Command.Type.INSERT, EnumSet.of(CommandFlags.FLAG_SAVE_STROKE),
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.CTRL_MASK)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0))});
parser.registerAction(MappingMode.I, "EditorUp", Command.Type.INSERT, EnumSet.of(CommandFlags.FLAG_CLEAR_STROKES),
new Shortcut[]{new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, 0))});
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY, new Shortcut('K'));
// Digraph shortcuts are handled directly by KeyHandler#handleKey, so they don't have an action. But we still need to
// register the shortcuts or the editor will swallow them. Technically, the shortcuts will be registered as part of
// other commands, but it's best to be explicit
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_MASK)));
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_MASK)));
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_MASK)));
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)));
}
}

View File

@@ -0,0 +1,56 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.configurationStore.APP_CONFIG
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.RoamingType
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.maddyhome.idea.vim.VimPlugin.STATE_VERSION
import org.jdom.Element
/**
* @author Alex Plate
*/
@State(name = "VimLocalSettings",
storages = [Storage("$APP_CONFIG$/vim_local_settings.xml", roamingType = RoamingType.DISABLED)])
class VimLocalConfig : PersistentStateComponent<Element> {
override fun getState(): Element {
val element = Element("ideavim-local")
val state = Element("state")
state.setAttribute("version", STATE_VERSION.toString())
element.addContent(state)
VimPlugin.getMark().saveData(element)
VimPlugin.getRegister().saveData(element)
VimPlugin.getSearch().saveData(element)
VimPlugin.getHistory().saveData(element)
return element
}
override fun loadState(state: Element) {
VimPlugin.getMark().readData(state)
VimPlugin.getRegister().readData(state)
VimPlugin.getSearch().readData(state)
VimPlugin.getHistory().readData(state)
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,19 +20,16 @@ package com.maddyhome.idea.vim;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.*;
import com.intellij.openapi.application.Application;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.Notifications;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
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.application.PermanentInstallationID;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
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.extensions.PluginId;
import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
@@ -40,9 +37,7 @@ 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;
@@ -52,9 +47,14 @@ 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.group.copy.PutGroup;
import com.maddyhome.idea.vim.group.copy.YankGroup;
import com.maddyhome.idea.vim.group.visual.VisualMotionGroup;
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.listener.VimListenerManager;
import com.maddyhome.idea.vim.option.OptionsManager;
import com.maddyhome.idea.vim.ui.ExEntryPanel;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import org.jdom.Element;
import org.jdom.JDOMException;
@@ -75,20 +75,15 @@ import java.util.concurrent.TimeUnit;
* <p/>
* This is an application level plugin meaning that all open projects will share a common instance of the plugin.
* Registers and marks are shared across open projects so you can copy and paste between files of different projects.
*
* @version 0.1
*/
@State(
name = "VimSettings",
storages = {@Storage(file = "$APP_CONFIG$/vim_settings.xml")})
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
@State(name = "VimSettings", storages = {@Storage("$APP_CONFIG$/vim_settings.xml")})
public class VimPlugin implements BaseComponent, PersistentStateComponent<Element>, Disposable {
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 = 4;
public static final int STATE_VERSION = 5;
private static long lastBeepTimeMillis;
private boolean error = false;
@@ -97,12 +92,13 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
// It is enabled by default to avoid any special configuration after plugin installation
private boolean enabled = true;
private boolean initialized = false;
private static final Logger LOG = Logger.getInstance(VimPlugin.class);
@NotNull private final MotionGroup motion;
@NotNull private final ChangeGroup change;
@NotNull private final CopyGroup copy;
@NotNull private final CommandGroup command;
@NotNull private final MarkGroup mark;
@NotNull private final RegisterGroup register;
@NotNull private final FileGroup file;
@@ -114,11 +110,16 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
@NotNull private final KeyGroup key;
@NotNull private final WindowGroup window;
@NotNull private final EditorGroup editor;
@NotNull private final VisualMotionGroup visualMotion;
@NotNull private final YankGroup yank;
@NotNull private final PutGroup put;
@NotNull private final VimState state;
public VimPlugin() {
motion = new MotionGroup();
change = new ChangeGroup();
copy = new CopyGroup();
command = new CommandGroup();
mark = new MarkGroup();
register = new RegisterGroup();
file = new FileGroup();
@@ -130,6 +131,11 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
key = new KeyGroup();
window = new WindowGroup();
editor = new EditorGroup();
visualMotion = new VisualMotionGroup();
yank = new YankGroup();
put = new PutGroup();
state = new VimState();
LOG.debug("VimPlugin ctr");
}
@@ -144,87 +150,81 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
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();
}
});
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);
}
}
if (isEnabled()) initializePlugin();
LOG.debug("done");
}
@Override
public void disposeComponent() {
public void dispose() {
LOG.debug("disposeComponent");
turnOffPlugin();
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;
/**
* @return NotificationService as applicationService if project is null and projectService otherwise
*/
@NotNull
public static NotificationService getNotifications(@Nullable Project project) {
if (project == null) {
return ServiceManager.getService(NotificationService.class);
} else {
return ServiceManager.getService(project, NotificationService.class);
}
}
@Override
public void loadState(@NotNull final Element element) {
LOG.debug("Loading state");
@NotNull
public static VimState getVimState() {
return getInstance().state;
}
// Restore whether the plugin is enabled or not
Element state = element.getChild("state");
if (state != null) {
/**
* Reports statistics about installed IdeaVim and enabled Vim emulation.
* <p>
* See https://github.com/go-lang-plugin-org/go-lang-idea-plugin/commit/5182ab4a1d01ad37f6786268a2fe5e908575a217
*/
public static void statisticReport() {
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()) {
ApplicationManager.getApplication().executeOnPooledThread(() -> {
try {
previousStateVersion = Integer.valueOf(state.getAttributeValue("version"));
final String buildNumber = ApplicationInfo.getInstance().getBuild().asString();
final String version = URLEncoder.encode(getVersion(), CharsetToolkit.UTF8);
final String os =
URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, CharsetToolkit.UTF8);
final String uid = PermanentInstallationID.get();
final String url = "https://plugins.jetbrains.com/plugins/list" +
"?pluginId=" + IDEAVIM_PLUGIN_ID +
"&build=" +
buildNumber +
"&pluginVersion=" +
version +
"&os=" +
os +
"&uuid=" +
uid;
PropertiesComponent.getInstance()
.setValue(IDEAVIM_STATISTICS_TIMESTAMP_KEY, String.valueOf(System.currentTimeMillis()));
HttpRequests.request(url).connect(request -> {
LOG.info("Sending statistics: " + url);
try {
JDOMUtil.load(request.getInputStream());
}
catch (NumberFormatException ignored) {
catch (JDOMException e) {
LOG.warn(e);
}
enabled = Boolean.valueOf(state.getAttributeValue("enabled"));
previousKeyMap = state.getAttributeValue("keymap");
return null;
});
}
catch (IOException e) {
LOG.warn(e);
}
});
}
mark.readData(element);
register.readData(element);
search.readData(element);
history.readData(element);
key.readData(element);
editor.readData(element);
}
@NotNull
@@ -238,8 +238,8 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
}
@NotNull
public static CopyGroup getCopy() {
return getInstance().copy;
public static CommandGroup getCommand() {
return getInstance().command;
}
@NotNull
@@ -297,6 +297,74 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
return getInstance().editor;
}
@NotNull
public static VisualMotionGroup getVisualMotion() {
return getInstance().visualMotion;
}
@NotNull
public static YankGroup getYank() {
return getInstance().yank;
}
@NotNull
public static PutGroup getPut() {
return getInstance().put;
}
@NotNull
private static NotificationService getNotifications() {
return getNotifications(null);
}
@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);
key.saveData(element);
editor.saveData(element);
this.state.saveData(element);
return element;
}
private void initializePlugin() {
if (initialized) return;
initialized = true;
Notifications.Bus.register(NotificationService.IDEAVIM_STICKY_NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON);
ApplicationManager.getApplication().invokeLater(this::updateState);
getEditor().turnOn();
getSearch().turnOn();
VimListenerManager.INSTANCE.turnOn();
// Register vim actions in command mode
RegisterActions.registerActions();
// Add some listeners so we can handle special events
DocumentManager.getInstance().addDocumentListener(MarkGroup.MarkUpdater.INSTANCE);
DocumentManager.getInstance().addDocumentListener(SearchGroup.DocumentSearchListener.INSTANCE);
// Register ex handlers
CommandParser.getInstance().registerHandlers();
if (!ApplicationManager.getApplication().isUnitTestMode()) {
final File ideaVimRc = VimScriptParser.findIdeaVimRc();
if (ideaVimRc != null) {
VimScriptParser.executeFile(ideaVimRc);
}
}
}
@NotNull
public static PluginId getPluginId() {
return PluginId.getId(IDEAVIM_PLUGIN_ID);
@@ -340,8 +408,13 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
if (ApplicationManager.getApplication().isUnitTestMode()) {
getInstance().error = true;
}
else if (!Options.getInstance().isSet("visualbell")) {
else if (!OptionsManager.INSTANCE.getVisualbell().isSet()) {
// Vim only allows a beep once every half second - :help 'visualbell'
final long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - lastBeepTimeMillis > 500) {
Toolkit.getDefaultToolkit().beep();
lastBeepTimeMillis = currentTimeMillis;
}
}
}
@@ -377,17 +450,24 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
}
private void turnOnPlugin() {
if (initialized) {
KeyHandler.getInstance().fullReset(null);
getEditor().turnOn();
getMotion().turnOn();
getSearch().turnOn();
VimListenerManager.INSTANCE.turnOn();
} else {
initializePlugin();
}
}
private void turnOffPlugin() {
KeyHandler.getInstance().fullReset(null);
getEditor().turnOff();
getMotion().turnOff();
getSearch().turnOff();
VimListenerManager.INSTANCE.turnOff();
ExEntryPanel.fullReset();
}
private void updateState() {
@@ -397,10 +477,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
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) {
if (VimPlugin.getNotifications().enableRepeatingMode() == Messages.YES) {
editor.setKeyRepeat(true);
keyRepeat.setEnabled(true);
}
@@ -419,115 +496,45 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
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() {
VimPlugin.getNotifications().specialKeymap(keymap, 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);
VimPlugin.getNotifications().noVimrcAsDefault();
}
}
}
/**
* 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());
}
});
}
public void loadState(@NotNull final Element element) {
LOG.debug("Loading state");
/**
* 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() {
// Restore whether the plugin is enabled or not
Element state = element.getChild("state");
if (state != null) {
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());
previousStateVersion = Integer.parseInt(state.getAttributeValue("version"));
}
catch (JDOMException e) {
LOG.warn(e);
catch (NumberFormatException ignored) {
}
return null;
enabled = Boolean.parseBoolean(state.getAttributeValue("enabled"));
previousKeyMap = state.getAttributeValue("keymap");
}
if (previousStateVersion > 0 && previousStateVersion < 5) {
// Migrate settings from 4 to 5 version
mark.readData(element);
register.readData(element);
search.readData(element);
history.readData(element);
}
);
}
catch (IOException e) {
LOG.warn(e);
}
}
});
}
}
}, application);
key.readData(element);
editor.readData(element);
this.state.readData(element);
}
}

View File

@@ -0,0 +1,34 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.components.ProjectComponent
import com.intellij.openapi.project.Project
import com.maddyhome.idea.vim.listener.VimListenerManager
/**
* @author Alex Plate
*/
class VimProjectComponent(private val project: Project) : ProjectComponent {
override fun projectOpened() {
if (!VimPlugin.isEnabled()) return
// Project listeners are self-disposable, so there is no need to unregister them on project close
VimListenerManager.ProjectListeners.add(project)
}
}

View File

@@ -0,0 +1,49 @@
package com.maddyhome.idea.vim
import org.jdom.Element
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
/**
* @author Alex Plate
*/
class VimState {
var isIdeaJoinNotified by StateProperty("idea-join")
var isIdeaPutNotified by StateProperty("idea-put")
var isTemplateInSelectModeNotified by StateProperty("template-selectmode")
fun readData(element: Element) {
val notifications = element.getChild("notifications")
map.keys.forEach { name ->
notifications?.getChild(name)?.getAttributeValue("enabled")?.let {
map[name] = it.toBoolean()
}
}
}
fun saveData(element: Element) {
val notifications = Element("notifications")
element.addContent(notifications)
map.forEach { (name, value) ->
val child = Element(name)
child.setAttribute("enabled", value.toString())
notifications.addContent(child)
}
}
}
val map by lazy { mutableMapOf<String, Boolean>() }
private class StateProperty(val xmlName: String) : ReadWriteProperty<VimState, Boolean> {
init {
map[xmlName] = false
}
override fun getValue(thisRef: VimState, property: KProperty<*>): Boolean = map.getOrPut(xmlName) { false }
override fun setValue(thisRef: VimState, property: KProperty<*>, value: Boolean) {
map[xmlName] = value
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,14 +22,17 @@ 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.ActionPlan;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.event.KeyEvent;
/**
* Accepts all regular keystrokes and passes them on to the Vim key handler.
@@ -39,11 +42,9 @@ import javax.swing.*;
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);
}
@@ -54,7 +55,7 @@ public class VimTypedActionHandler implements TypedActionHandlerEx {
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
}
else {
TypedActionHandler originalHandler = KeyHandler.getInstance().getOriginalHandler();
TypedActionHandler originalHandler = handler.getOriginalHandler();
if (originalHandler instanceof TypedActionHandlerEx) {
((TypedActionHandlerEx)originalHandler).beforeExecute(editor, charTyped, context, plan);
}
@@ -63,7 +64,7 @@ public class VimTypedActionHandler implements TypedActionHandlerEx {
@Override
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
if (isEnabled(editor)) {
if (isEnabled(editor) && charTyped != KeyEvent.CHAR_UNDEFINED) {
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
@@ -72,9 +73,12 @@ public class VimTypedActionHandler implements TypedActionHandlerEx {
}
}
else {
try (final VimListenerSuppressor ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) {
TypedActionHandler origHandler = handler.getOriginalHandler();
origHandler.execute(editor, charTyped, context);
}
}
}
private boolean isEnabled(@NotNull Editor editor) {
if (VimPlugin.isEnabled()) {

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,46 @@ 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.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
/**
*
*/
public class ExEntryAction extends EditorAction {
public ExEntryAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class ExEntryAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.NVO;
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet(":");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_READONLY;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getProcess().startExCommand(editor, context, cmd);
return true;
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,46 @@ 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.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.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.HelperKt;
import org.jetbrains.annotations.NotNull;
/**
*
*/
// TODO: Cannot find the corresponding Vim command. Remove it?
public class ResetModeAction extends EditorAction {
public ResetModeAction() {
super(new EditorActionHandler() {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
KeyHandler.getInstance().fullReset(InjectedLanguageUtil.getTopLevelEditor(editor));
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class ResetModeAction extends VimCommandAction {
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
KeyHandler.getInstance().fullReset(HelperKt.getTopLevelEditor(editor));
return true;
}
});
};
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.NO;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-\\><C-N>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.RESET;
}
}

View File

@@ -1,80 +0,0 @@
/*
* 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

@@ -0,0 +1,136 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.actionSystem.DataContext
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.actionSystem.EditorAction
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase
import com.maddyhome.idea.vim.handler.MotionActionHandler
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.StringHelper
import com.maddyhome.idea.vim.helper.noneOfEnum
import java.util.*
import javax.swing.KeyStroke
/**
* Structure of commands
*
* VimCommandActionBase
* (Can't be used directly)
* |
* -------------------------------------------------------------------------------------
* | | |
* MotionEditorAction TextObjectAction VimCommandAction
* (accepts MotionActionHandler) (accepts TextObjectActionHandler) (accepts VimActionHandler)
*
* See also EditorActionHandlerBase.kt for handlers structure
*/
/**
* Action that represents a Vim command.
*
* Actions should be registered in resources/META-INF/plugin.xml and in package-info.java
* inside [com.maddyhome.idea.vim.action].
*
* @author vlan
*/
sealed class VimCommandActionBase : EditorAction(null) {
init {
@Suppress("LeakingThis")
setupHandler(makeActionHandler())
}
protected abstract fun makeActionHandler(): EditorActionHandlerBase
abstract val mappingModes: Set<MappingMode>
abstract val keyStrokesSet: Set<List<KeyStroke>>
abstract val type: Command.Type
open val argumentType: Argument.Type = 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
*/
open val flags: EnumSet<CommandFlags> = noneOfEnum()
protected companion object {
@JvmStatic
fun parseKeysSet(vararg keyStrings: String): Set<List<KeyStroke>> {
val builder = ImmutableSet.builder<List<KeyStroke>>()
for (keyString in keyStrings) {
builder.add(StringHelper.parseKeys(keyString))
}
return builder.build()
}
}
}
abstract class VimCommandAction : VimCommandActionBase() {
abstract override fun makeActionHandler(): VimActionHandler
}
abstract class TextObjectAction : VimCommandActionBase() {
abstract override fun makeActionHandler(): TextObjectActionHandler
fun getRange(editor: Editor, caret: Caret, context: DataContext, count: Int, rawCount: Int, argument: Argument?): TextRange? {
val actionHandler = handler as? TextObjectActionHandler
?: throw RuntimeException("TextObjectAction works only with TextObjectActionHandler")
return actionHandler.getRange(editor, caret, context, count, rawCount, argument)
}
final override val type: Command.Type = Command.Type.MOTION
}
abstract class MotionEditorAction : VimCommandActionBase() {
abstract override fun makeActionHandler(): MotionActionHandler
fun getOffset(editor: Editor,
caret: Caret,
context: DataContext,
count: Int,
rawCount: Int,
argument: Argument?): Int {
val actionHandler = handler as? MotionActionHandler
?: throw RuntimeException("MotionAction works only with MotionHandler")
return when (actionHandler) {
is MotionActionHandler.SingleExecution -> actionHandler.getOffset(editor, context, count, rawCount, argument)
is MotionActionHandler.ForEachCaret -> actionHandler.getOffset(editor, caret, context, count, rawCount, argument)
}
}
final override val type: Command.Type = Command.Type.MOTION
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,6 +22,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.DumbAware;
import com.maddyhome.idea.vim.VimPlugin;
import org.jetbrains.annotations.NotNull;
/**
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
@@ -34,7 +35,8 @@ public class VimPluginToggleAction extends ToggleAction implements DumbAware {
* @param event The event that triggered the action
* @return true if the toggle is on, false if off
*/
public boolean isSelected(AnActionEvent event) {
@Override
public boolean isSelected(@NotNull AnActionEvent event) {
return VimPlugin.isEnabled();
}
@@ -44,7 +46,8 @@ public class VimPluginToggleAction extends ToggleAction implements DumbAware {
* @param event The event that triggered the action
* @param b The new state - true is on, false is off
*/
public void setSelected(AnActionEvent event, boolean b) {
@Override
public void setSelected(@NotNull AnActionEvent event, boolean b) {
VimPlugin.setEnabled(b);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,44 +20,38 @@ 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.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
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.CommandStateHelper;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.helper.EditorHelper;
import com.maddyhome.idea.vim.key.ShortcutOwner;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import one.util.streamex.StreamEx;
import com.maddyhome.idea.vim.option.ListOption;
import com.maddyhome.idea.vim.option.OptionsManager;
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 java.util.*;
import static java.awt.event.KeyEvent.*;
/**
* Handles Vim keys that are treated as action shortcuts by the IDE.
*
* <p>
* 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 {
@@ -98,12 +92,16 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
if (editor != null && keyStroke != null) {
final ShortcutOwner owner = VimPlugin.getKey().getSavedShortcutConflicts().get(keyStroke);
if (owner == ShortcutOwner.UNDEFINED) {
notifyAboutShortcutConflict(keyStroke);
VimPlugin.getNotifications(editor.getProject()).notifyAboutShortcutConflict(keyStroke);
}
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
// Should we use HelperKt.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (ProcessCanceledException ignored) {
// Control-flow exceptions (like ProcessCanceledException) should never be logged
// See {@link com.intellij.openapi.diagnostic.Logger.checkException}
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
@@ -124,53 +122,31 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
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()) {
if (!VimPlugin.isEnabled()) return false;
final Editor editor = getEditor(e);
final KeyStroke keyStroke = getKeyStroke(e);
if (editor != null && keyStroke != null) {
// Workaround for smart step into
final Key<?> SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA");
if (SMART_STEP_INPLACE_DATA != null && editor.getUserData(SMART_STEP_INPLACE_DATA) != null) return false;
final int keyCode = keyStroke.getKeyCode();
if (LookupManager.getActiveLookup(editor) != null) {
return isExitInsertMode(keyStroke);
if (LookupManager.getActiveLookup(editor) != null && !passCommandToVimWithLookup(keyStroke)) {
return isEnabledForLookup(keyStroke);
}
if (keyCode == VK_ESCAPE) {
return isEnabledForEscape(editor);
}
if (CommandState.inInsertMode(editor)) {
if (CommandStateHelper.inInsertMode(editor)) {
// XXX: <Tab> won't be recorded in macros
if (keyCode == VK_TAB) {
VimPlugin.getChange().tabAction = true;
return false;
}
// Debug watch, Python console, etc.
if (NON_FILE_EDITOR_KEYS.contains(keyStroke) && !EditorData.isFileEditor(editor)) {
if (NON_FILE_EDITOR_KEYS.contains(keyStroke) && !EditorHelper.isFileEditor(editor)) {
return false;
}
}
@@ -192,13 +168,25 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
return true;
}
}
}
return false;
}
private boolean passCommandToVimWithLookup(@NotNull KeyStroke keyStroke) {
final ListOption popupActions = OptionsManager.INSTANCE.getLookupActions();
final List<String> values = popupActions.values();
if (values == null) return false;
return values.stream().anyMatch(actionId -> {
final AnAction action = ActionManager.getInstance().getAction(actionId);
if (!(action instanceof VimCommandAction)) return false;
return ((VimCommandAction)action).getKeyStrokesSet().stream()
.anyMatch(ks -> !ks.isEmpty() && ks.get(0).equals(keyStroke));
});
}
private boolean isEnabledForEscape(@NotNull Editor editor) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
return isPrimaryEditor(editor) || (EditorData.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
return isPrimaryEditor(editor) || (EditorHelper.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
}
/**
@@ -208,17 +196,22 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
final Project project = editor.getProject();
if (project == null) return false;
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
return StreamEx.of(fileEditorManager.getAllEditors())
if (fileEditorManager == null) return false;
return Arrays.stream(fileEditorManager.getAllEditors())
.anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor)));
}
private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) {
private boolean isEnabledForLookup(@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;
}
}
//noinspection RedundantIfStatement
if (keyStroke.equals(KeyStroke.getKeyStroke(VK_BACK_SPACE, 0))) {
return true;
}
return false;
}
@@ -228,7 +221,7 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
@NotNull
private static List<KeyStroke> getKeyStrokes(int keyCode, @NotNull int... modifiers) {
final List<KeyStroke> keyStrokes = new ArrayList<KeyStroke>();
final List<KeyStroke> keyStrokes = new ArrayList<>();
for (int modifier : modifiers) {
keyStrokes.add(KeyStroke.getKeyStroke(keyCode, modifier));
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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
@@ -26,23 +26,28 @@ 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.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.MessageHelper;
import com.maddyhome.idea.vim.key.OperatorFunction;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class OperatorAction extends VimCommandAction {
protected OperatorAction() {
super(new EditorActionHandlerBase() {
final public class OperatorAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public 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();
@@ -65,35 +70,39 @@ public class OperatorAction extends VimCommandAction {
VimPlugin.showMessage(MessageHelper.message("E774"));
return false;
}
});
};
}
@Contract(pure = true)
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("g@");
}
@Contract(pure = true)
@NotNull
@Override
public Command.Type getType() {
final public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@Contract(pure = true)
@NotNull
@Override
public Argument.Type getArgumentType() {
final public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
public int getFlags() {
return Command.FLAG_OP_PEND;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,45 @@ package com.maddyhome.idea.vim.action.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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
import org.jetbrains.annotations.NotNull;
/**
*/
public class RedoAction extends EditorAction {
public RedoAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class RedoAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return UndoRedoHelper.redo(context);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-R>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return UndoRedoHelper.INSTANCE.redo(context);
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,45 @@ package com.maddyhome.idea.vim.action.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.KeyHandler;
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.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
/**
*/
public class RepeatChangeAction extends EditorAction {
public RepeatChangeAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class RepeatChangeAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends EditorActionHandlerBase {
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet(".");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_WRITABLE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand();
@@ -81,5 +102,6 @@ public class RepeatChangeAction extends EditorAction {
return false;
}
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,21 +20,43 @@ package com.maddyhome.idea.vim.action.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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.ex.CommandParser;
import com.maddyhome.idea.vim.ex.ExException;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
/**
*/
public class RepeatExCommandAction extends EditorAction {
public RepeatExCommandAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class RepeatExCommandAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends EditorActionHandlerBase {
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("@:");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
int count = command.getCount();
try {
@@ -44,5 +66,6 @@ public class RepeatExCommandAction extends EditorAction {
return false;
}
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,45 @@ package com.maddyhome.idea.vim.action.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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
import org.jetbrains.annotations.NotNull;
/**
*/
public class UndoAction extends EditorAction {
public UndoAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class UndoAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return UndoRedoHelper.undo(context);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("u", "<Undo>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return UndoRedoHelper.INSTANCE.undo(context);
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,51 +24,63 @@ 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.CommandFlags;
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.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
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;
}
});
}
final public class AutoIndentLinesVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
VimPlugin.getChange().autoIndentRange(editor, caret, context, range.toVimTextRange(true));
return true;
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("=");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@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;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,33 +21,70 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeCaseLowerMotionAction extends EditorAction {
public ChangeCaseLowerMotionAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeCaseLowerMotionAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gu");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,56 +21,69 @@ package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
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.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import com.maddyhome.idea.vim.helper.HelperKt;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeCaseLowerVisualAction extends VimCommandAction {
public ChangeCaseLowerVisualAction() {
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);
}
});
}
final public class ChangeCaseLowerVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
final Editor topLevelEditor = HelperKt.getTopLevelEditor(editor);
return VimPlugin.getChange()
.changeCaseRange(topLevelEditor, caret, range.toVimTextRange(false), CharacterHelper.CASE_LOWER);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("u");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,53 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeCaseToggleCharacterAction extends EditorAction {
public ChangeCaseToggleCharacterAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeCaseToggleCharacterAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("~");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,33 +21,70 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeCaseToggleMotionAction extends EditorAction {
public ChangeCaseToggleMotionAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeCaseToggleMotionAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
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.CHANGE;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,51 +24,64 @@ 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.CommandFlags;
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.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeCaseToggleVisualAction extends VimCommandAction {
public ChangeCaseToggleVisualAction() {
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);
}
});
}
final public class ChangeCaseToggleVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange()
.changeCaseRange(editor, caret, range.toVimTextRange(false), CharacterHelper.CASE_TOGGLE);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("~");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,32 +21,70 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeCaseUpperMotionAction extends EditorAction {
public ChangeCaseUpperMotionAction() {
super(new Handler());
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class ChangeCaseUpperMotionAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gU");
}
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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_UPPER, argument);
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,50 +24,64 @@ 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.CommandFlags;
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.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeCaseUpperVisualAction extends VimCommandAction {
public ChangeCaseUpperVisualAction() {
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);
}
});
}
final public class ChangeCaseUpperVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange()
.changeCaseRange(editor, caret, range.toVimTextRange(false), CharacterHelper.CASE_UPPER);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("U");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,67 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeCharacterAction extends EditorAction {
public ChangeCharacterAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeCharacterAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@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;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_ALLOW_DIGRAPH);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,61 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeCharactersAction extends EditorAction {
public ChangeCharactersAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeCharactersAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("s");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,61 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeEndOfLineAction extends EditorAction {
public ChangeEndOfLineAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeEndOfLineAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("C");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,26 +20,56 @@ 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.ex.LineRange;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
public ChangeLastGlobalSearchReplaceAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class ChangeLastGlobalSearchReplaceAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends ChangeEditorActionHandler {
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", "//~/&");
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("g&");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,50 @@ 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.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.ex.LineRange;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeLastSearchReplaceAction extends EditorAction {
public ChangeLastSearchReplaceAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class ChangeLastSearchReplaceAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("&");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
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()) {
@@ -49,5 +76,6 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
}
return result;
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,19 +21,52 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeLineAction extends EditorAction {
public ChangeLineAction() {
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class ChangeLineAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("cc", "S");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_NO_REPEAT, CommandFlags.FLAG_ALLOW_MID_COUNT, CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@@ -41,8 +74,8 @@ public class ChangeLineAction extends EditorAction {
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().changeLine(editor, caret, count);
return VimPlugin.getChange().changeLine(editor, caret, count, context);
}
});
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,68 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeMotionAction extends EditorAction {
public ChangeMotionAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class ChangeMotionAction extends VimCommandAction {
@NotNull
@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);
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("c");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND, CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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,50 +0,0 @@
/*
* 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.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeNumberDecAction extends EditorAction {
public ChangeNumberDecAction() {
super(new Handler());
}
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().changeNumber(editor, caret, -count);
}
}
}

View File

@@ -1,50 +0,0 @@
/*
* 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.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeNumberIncAction extends EditorAction {
public ChangeNumberIncAction() {
super(new Handler());
}
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().changeNumber(editor, caret, count);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,18 +20,52 @@ 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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class ChangeReplaceAction extends EditorAction {
public ChangeReplaceAction() {
super(new ChangeEditorActionHandler() {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class ChangeReplaceAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("R");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@@ -41,6 +75,6 @@ public class ChangeReplaceAction extends EditorAction {
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,55 +24,63 @@ 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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeVisualAction extends VimCommandAction {
public ChangeVisualAction() {
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);
}
});
}
final public class ChangeVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange().changeRange(editor, caret, range.toVimTextRange(false), range.getType(), context);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("c", "s");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MULTIKEY_UNDO | Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,60 +19,77 @@
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.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeVisualCharacterAction extends VimCommandAction {
public ChangeVisualCharacterAction() {
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());
}
});
}
final public class ChangeVisualCharacterAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
final Argument argument = cmd.getArgument();
return argument != null &&
VimPlugin.getChange().changeCharacterRange(editor, range.toVimTextRange(false), argument.getCharacter());
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("r");
}
@Contract(pure = true)
@NotNull
@Override
public Command.Type getType() {
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@Contract(pure = true)
@NotNull
@Override
public Argument.Type getArgumentType() {
final public Argument.Type getArgumentType() {
return Argument.Type.DIGRAPH;
}
@NotNull
@Override
public int getFlags() {
return Command.FLAG_ALLOW_DIGRAPH | Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_ALLOW_DIGRAPH, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,54 +24,69 @@ 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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class ChangeVisualLinesAction extends VimCommandAction {
public ChangeVisualLinesAction() {
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);
}
});
}
final public class ChangeVisualLinesAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
final TextRange textRange = range.toVimTextRange(true);
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, textRange.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, textRange.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE, context);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("R", "S");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@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;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,67 +24,81 @@ 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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
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.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @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();
final public class ChangeVisualLinesEndAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
TextRange vimTextRange = range.toVimTextRange(true);
if (range.getType() == SelectionType.BLOCK_WISE && vimTextRange.isMultiple()) {
final int[] starts = vimTextRange.getStartOffsets();
final int[] ends = vimTextRange.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
if (ends[i] > starts[i]) {
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
}
}
final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE);
return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE, context);
}
else {
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);
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, vimTextRange.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, vimTextRange.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE, context);
}
}
});
};
}
@Contract(pure = true)
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("C");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@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;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_MULTIKEY_UNDO, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,47 @@ 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.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
/**
*/
public class FilterCountLinesAction extends EditorAction {
public FilterCountLinesAction() {
super(new Handler());
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class FilterCountLinesAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("!!");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command 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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,24 +21,60 @@ 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.LogicalPosition;
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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
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.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
/**
*/
public class FilterMotionAction extends EditorAction {
public FilterMotionAction() {
super(new Handler());
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class FilterMotionAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("!");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final Argument argument = cmd.getArgument();
if (argument == null) {
return false;
@@ -65,10 +101,11 @@ public class FilterMotionAction extends EditorAction {
count = 1;
}
Command command = new Command(count, null, null, Command.Type.UNDEFINED, 0);
Command command = new Command(count, null, null, Command.Type.UNDEFINED, EnumSet.noneOf(CommandFlags.class));
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,48 +23,58 @@ 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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class FilterVisualLinesAction extends VimCommandAction {
public FilterVisualLinesAction() {
super(new EditorActionHandlerBase() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
VimPlugin.getMotion().resetVisual(editor, true);
return true;
}
});
}
final public class FilterVisualLinesAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getProcess().startFilterCommand(editor, context, cmd);
VimPlugin.getVisualMotion().resetVisual(editor);
return true;
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("!");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.CHANGE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,54 +19,68 @@
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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
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;
}
});
}
final public class ReformatCodeVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
VimPlugin.getChange().reformatCode(editor, range);
return true;
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gq");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@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;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,58 +16,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.motion.visual;
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
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.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class VisualSwapEndsAction extends VimCommandAction {
public VisualSwapEndsAction() {
super(new EditorActionHandlerBase() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
if (CommandState.inVisualBlockMode(editor)) {
return VimPlugin.getMotion().swapVisualBlockEnds(editor);
}
boolean ret = true;
for (Caret caret : editor.getCaretModel().getAllCarets()) {
ret = ret && VimPlugin.getMotion().swapVisualEnds(editor, caret);
}
return ret;
}
});
}
public class ChangeNumberDecAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("o");
return parseKeysSet("<C-X>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_READONLY;
return Command.Type.CHANGE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,60 +16,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.maddyhome.idea.vim.action.motion.visual;
package com.maddyhome.idea.vim.action.change.change.number;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
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.command.MappingMode;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class VisualSwapEndsBlockAction extends VimCommandAction {
public VisualSwapEndsBlockAction() {
super(new EditorActionHandlerBase() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
if (CommandState.inVisualBlockMode(editor)) {
return VimPlugin.getMotion().swapVisualBlockEnds(editor);
}
else {
boolean ret = true;
for (Caret caret : editor.getCaretModel().getAllCarets()) {
ret = ret && VimPlugin.getMotion().swapVisualEnds(editor, caret);
}
return ret;
}
}
});
}
public class ChangeNumberIncAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.V;
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("O");
return parseKeysSet("<C-A>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_READONLY;
return Command.Type.CHANGE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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

@@ -0,0 +1,83 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.number;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
final public class ChangeVisualNumberAvalancheDecAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.getCount(), true);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("g<C-X>");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -0,0 +1,83 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.number;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
final public class ChangeVisualNumberAvalancheIncAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.getCount(), true);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("g<C-A>");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -0,0 +1,83 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.number;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
final public class ChangeVisualNumberDecAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), -cmd.getCount(), false);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-X>");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -0,0 +1,83 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2019 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.number;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
final public class ChangeVisualNumberIncAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
return VimPlugin.getChange()
.changeNumberVisualMode(editor, caret, range.toVimTextRange(false), cmd.getCount(), false);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-A>");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.CHANGE;
}
@NotNull
@Override
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,53 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteCharacterAction extends EditorAction {
public DeleteCharacterAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class DeleteCharacterAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<DEL>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,53 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteCharacterLeftAction extends EditorAction {
public DeleteCharacterLeftAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
public class DeleteCharacterLeftAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("X");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,53 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteCharacterRightAction extends EditorAction {
public DeleteCharacterRightAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class DeleteCharacterRightAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("x");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,30 +21,53 @@ 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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteEndOfLineAction extends EditorAction {
public DeleteEndOfLineAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class DeleteEndOfLineAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("D");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,36 +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.intellij.openapi.util.Ref;
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.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteJoinLinesAction extends EditorAction {
public DeleteJoinLinesAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class DeleteJoinLinesAction extends VimCommandAction {
@NotNull
@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;
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, false);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gJ");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) return false;
if (OptionsManager.INSTANCE.getIdeajoin().isSet()) {
return VimPlugin.getChange().joinViaIdeaByCount(editor, context, count);
}
VimPlugin.getEditor().notifyIdeaJoin(editor.getProject());
Ref<Boolean> res = Ref.create(true);
editor.getCaretModel().runForEachCaret(caret -> {
if (!VimPlugin.getChange().deleteJoinLines(editor, caret, count, false)) res.set(false);
}, true);
return res.get();
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,36 +19,67 @@
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.intellij.openapi.util.Ref;
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.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteJoinLinesSpacesAction extends EditorAction {
public DeleteJoinLinesSpacesAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class DeleteJoinLinesSpacesAction extends VimCommandAction {
@NotNull
@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;
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, true);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("J");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) return false;
if (OptionsManager.INSTANCE.getIdeajoin().isSet()) {
return VimPlugin.getChange().joinViaIdeaByCount(editor, context, count);
}
VimPlugin.getEditor().notifyIdeaJoin(editor.getProject());
Ref<Boolean> res = Ref.create(true);
editor.getCaretModel().runForEachCaret(caret -> {
if (!VimPlugin.getChange().deleteJoinLines(editor, caret, count, true)) res.set(false);
}, true);
return res.get();
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,54 +21,85 @@ 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.util.Ref;
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.CommandFlags;
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.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteJoinVisualLinesAction extends VimCommandAction {
public DeleteJoinVisualLinesAction() {
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);
}
});
}
final public class DeleteJoinVisualLinesAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.SingleExecution() {
@Override
public boolean executeForAllCarets(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull Map<Caret, ? extends VimSelection> caretsAndSelections) {
if (editor.isOneLineMode()) return false;
if (OptionsManager.INSTANCE.getIdeajoin().isSet()) {
VimPlugin.getChange().joinViaIdeaBySelections(editor, context, caretsAndSelections);
return true;
}
Ref<Boolean> res = Ref.create(true);
editor.getCaretModel().runForEachCaret(caret -> {
if (!caret.isValid()) return;
final VimSelection range = caretsAndSelections.get(caret);
if (range == null) return;
if (!VimPlugin.getChange().deleteJoinRange(editor, caret, range.toVimTextRange(true).normalize(), false)) {
res.set(false);
}
}, true);
return res.get();
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gJ");
}
@Contract(pure = true)
@NotNull
@Override
public Command.Type getType() {
final public Command.Type getType() {
return Command.Type.DELETE;
}
@Contract(pure = true)
@NotNull
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,54 +21,85 @@ 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.util.Ref;
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.CommandFlags;
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.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.option.OptionsManager;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
public DeleteJoinVisualLinesSpacesAction() {
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);
}
});
}
final public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.SingleExecution() {
@Override
public boolean executeForAllCarets(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull Map<Caret, ? extends VimSelection> caretsAndSelections) {
if (editor.isOneLineMode()) return false;
if (OptionsManager.INSTANCE.getIdeajoin().isSet()) {
VimPlugin.getChange().joinViaIdeaBySelections(editor, context, caretsAndSelections);
return true;
}
Ref<Boolean> res = Ref.create(true);
editor.getCaretModel().runForEachCaret(caret -> {
if (!caret.isValid()) return;
final VimSelection range = caretsAndSelections.get(caret);
if (range == null) return;
if (!VimPlugin.getChange().deleteJoinRange(editor, caret, range.toVimTextRange(true).normalize(), true)) {
res.set(false);
}
}, true);
return res.get();
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("J");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,19 +21,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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteLineAction extends EditorAction {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class DeleteLineAction extends VimCommandAction {
public DeleteLineAction() {
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
super();
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("dd");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_ALLOW_MID_COUNT);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@@ -43,6 +80,6 @@ public class DeleteLineAction extends EditorAction {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,31 +21,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.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class DeleteMotionAction extends EditorAction {
public DeleteMotionAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class DeleteMotionAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("d");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
public Argument.Type getArgumentType() {
return Argument.Type.MOTION;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_OP_PEND);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,61 +24,64 @@ import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteVisualAction extends VimCommandAction {
public DeleteVisualAction() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_LINE) {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.fromSubMode(mode), false);
}
else {
return VimPlugin.getChange().deleteRange(editor, caret, range, SelectionType.fromSubMode(mode), false);
}
}
});
}
final public class DeleteVisualAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
SelectionType selectionType = range.getType();
return VimPlugin.getChange().deleteRange(editor, caret, range.toVimTextRange(false), selectionType, false);
}
};
}
@Contract(pure = true)
@NotNull
@Override
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("d", "x", "<Del>");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

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

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,31 +24,41 @@ import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.group.visual.VimSelection;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/**
* @author vlan
*/
public class DeleteVisualLinesEndAction extends VimCommandAction {
public DeleteVisualLinesEndAction() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
final public class DeleteVisualLinesEndAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@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();
final protected VimActionHandler makeActionHandler() {
return new VisualOperatorActionHandler.ForEachCaret() {
@Override
public boolean executeAction(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull VimSelection range) {
TextRange vimTextRange = range.toVimTextRange(true);
if (range.getType() == SelectionType.BLOCK_WISE) {
final int[] starts = vimTextRange.getStartOffsets();
final int[] ends = vimTextRange.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
if (ends[i] > starts[i]) {
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
@@ -59,34 +69,37 @@ public class DeleteVisualLinesEndAction extends VimCommandAction {
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), blockRange, SelectionType.BLOCK_WISE, false);
}
else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, vimTextRange.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, vimTextRange.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
}
}
});
};
}
@Contract(pure = true)
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final public Set<MappingMode> getMappingModes() {
return MappingMode.V;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("D");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.DELETE;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.DELETE;
}
@Override
public int getFlags() {
return Command.FLAG_MOT_LINEWISE | Command.FLAG_EXIT_VISUAL;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MOT_LINEWISE, CommandFlags.FLAG_EXIT_VISUAL);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,18 +20,52 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertAfterCursorAction extends EditorAction {
public InsertAfterCursorAction() {
super(new ChangeEditorActionHandler() {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertAfterCursorAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("a");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@@ -41,6 +75,6 @@ public class InsertAfterCursorAction extends EditorAction {
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,18 +20,52 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertAfterLineEndAction extends EditorAction {
public InsertAfterLineEndAction() {
super(new ChangeEditorActionHandler() {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertAfterLineEndAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("A");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@@ -41,6 +75,6 @@ public class InsertAfterLineEndAction extends EditorAction {
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,18 +20,52 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertAtPreviousInsertAction extends EditorAction {
public InsertAtPreviousInsertAction() {
super(new ChangeEditorActionHandler() {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertAtPreviousInsertAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gi");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@@ -41,6 +75,6 @@ public class InsertAtPreviousInsertAction extends EditorAction {
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,46 +24,57 @@ 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.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertBeforeCursorAction extends VimCommandAction {
public InsertBeforeCursorAction() {
super(new ChangeEditorActionHandler() {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
final public class InsertBeforeCursorAction extends VimCommandAction {
@Contract(" -> new")
@NotNull
@Override
final protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
final public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertBeforeCursor(editor, context);
return true;
}
});
};
}
@Contract(pure = true)
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("i", "<Insert>");
}
@Contract(pure = true)
@NotNull
@Override
final public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@Override
public int getFlags() {
return Command.FLAG_MULTIKEY_UNDO;
final public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,18 +20,52 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertBeforeFirstNonBlankAction extends EditorAction {
public InsertBeforeFirstNonBlankAction() {
super(new ChangeEditorActionHandler() {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertBeforeFirstNonBlankAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("I");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@@ -41,6 +75,6 @@ public class InsertBeforeFirstNonBlankAction extends EditorAction {
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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,34 +21,57 @@ 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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertCharacterAboveCursorAction extends EditorAction {
public InsertCharacterAboveCursorAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
public class InsertCharacterAboveCursorAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-Y>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, -1);
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,34 +21,57 @@ 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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertCharacterBelowCursorAction extends EditorAction {
public InsertCharacterBelowCursorAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class InsertCharacterBelowCursorAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-E>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, 1);
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,32 +21,61 @@ 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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertDeleteInsertedTextAction extends EditorAction {
public InsertDeleteInsertedTextAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
public class InsertDeleteInsertedTextAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-U>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_CLEAR_STROKES);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,32 +21,61 @@ 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.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertDeletePreviousWordAction extends EditorAction {
public InsertDeletePreviousWordAction() {
super(new Handler());
}
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public class InsertDeletePreviousWordAction extends VimCommandAction {
@NotNull
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-W>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_CLEAR_STROKES);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.ForEachCaret() {
@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-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,55 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import com.maddyhome.idea.vim.helper.HelperKt;
import org.jetbrains.annotations.NotNull;
/**
*/
public class InsertEnterAction extends EditorAction {
public InsertEnterAction() {
super(new Handler());
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertEnterAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
VimPlugin.getChange().processEnter(InjectedLanguageUtil.getTopLevelEditor(editor), context);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-M>", "<CR>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_SAVE_STROKE);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEnter(HelperKt.getTopLevelEditor(editor), context);
return true;
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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
@@ -25,41 +25,47 @@ 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 com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
import java.util.Set;
public class InsertExitModeAction extends VimCommandAction {
final public class InsertExitModeAction extends VimCommandAction {
private static final String ACTION_ID = "VimInsertExitMode";
protected InsertExitModeAction() {
super(new EditorActionHandlerBase() {
@Contract(" -> new")
@NotNull
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEscape(editor, context);
return true;
}
});
};
}
@Contract(pure = true)
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
final public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
final public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<C-[>", "<C-C>", "<Esc>", "<C-\\><C-N>");
}
@Contract(pure = true)
@NotNull
@Override
public Command.Type getType() {
final public Command.Type getType() {
return Command.Type.INSERT;
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,54 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
/**
*/
public class InsertInsertAction extends EditorAction {
public InsertInsertAction() {
super(new Handler());
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertInsertAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.I;
}
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context);
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("<Ins>");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_SAVE_STROKE);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new VimActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processInsert(editor);
return true;
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,18 +20,52 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertLineStartAction extends EditorAction {
public InsertLineStartAction() {
super(new ChangeEditorActionHandler() {
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertLineStartAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("gI");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@@ -41,6 +75,6 @@ public class InsertLineStartAction extends EditorAction {
VimPlugin.getChange().insertLineStart(editor, context);
return true;
}
});
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,58 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertNewLineAboveAction extends EditorAction {
public InsertNewLineAboveAction() {
super(new Handler());
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertNewLineAboveAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("O");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
@@ -44,5 +80,6 @@ public class InsertNewLineAboveAction extends EditorAction {
return true;
}
};
}
}

View File

@@ -1,6 +1,6 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2016 The IdeaVim authors
* Copyright (C) 2003-2019 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,22 +20,57 @@ 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.command.Command;
import com.maddyhome.idea.vim.command.CommandFlags;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.VimActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertNewLineBelowAction extends EditorAction {
public InsertNewLineBelowAction() {
super(new Handler());
import javax.swing.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
public class InsertNewLineBelowAction extends VimCommandAction {
@NotNull
@Override
public Set<MappingMode> getMappingModes() {
return MappingMode.N;
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@NotNull
@Override
public Set<List<KeyStroke>> getKeyStrokesSet() {
return parseKeysSet("o");
}
@NotNull
@Override
public Command.Type getType() {
return Command.Type.INSERT;
}
@NotNull
@Override
public EnumSet<CommandFlags> getFlags() {
return EnumSet.of(CommandFlags.FLAG_MULTIKEY_UNDO);
}
@NotNull
@Override
protected VimActionHandler makeActionHandler() {
return new ChangeEditorActionHandler.SingleExecution() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
@@ -45,5 +80,6 @@ public class InsertNewLineBelowAction extends EditorAction {
return true;
}
};
}
}

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