mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
79 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
421ce832dd | ||
![]() |
987781f826 | ||
![]() |
d85a41ea98 | ||
![]() |
42f86a3f73 | ||
![]() |
0241b58777 | ||
![]() |
97a2c73efe | ||
![]() |
5f1e46ca82 | ||
![]() |
805779144e | ||
![]() |
c65e21708c | ||
![]() |
08e546b677 | ||
![]() |
11cf8454ad | ||
![]() |
c3494803dc | ||
![]() |
c84496b942 | ||
![]() |
c4eb8e5752 | ||
![]() |
7702d3a695 | ||
![]() |
fbff8ed2c0 | ||
![]() |
5b5b6188da | ||
![]() |
6a1707a7e6 | ||
![]() |
b625fd3df9 | ||
![]() |
ffaf2cc451 | ||
![]() |
dcc9b5a37e | ||
![]() |
1b4a51f770 | ||
![]() |
f8d2ee2dd7 | ||
![]() |
348d88d543 | ||
![]() |
38b859e555 | ||
![]() |
ca8026f612 | ||
![]() |
befcf4298f | ||
![]() |
2e0bbcc75d | ||
![]() |
2204fe6451 | ||
![]() |
12bc68bc02 | ||
![]() |
290370f744 | ||
![]() |
79acef46ce | ||
![]() |
0054eb5279 | ||
![]() |
e0eb919e51 | ||
![]() |
7c3d5a7946 | ||
![]() |
38cb20d1bd | ||
![]() |
505fcf5b31 | ||
![]() |
d744d45ccd | ||
![]() |
2e2e7a7df6 | ||
![]() |
db5ff05bb3 | ||
![]() |
566273fe83 | ||
![]() |
decb17e665 | ||
![]() |
46c27bbd10 | ||
![]() |
72f98cef14 | ||
![]() |
0f8cfa289d | ||
![]() |
0cb420c557 | ||
![]() |
79df0b0594 | ||
![]() |
dfbddb4050 | ||
![]() |
0f88495f29 | ||
![]() |
2b31ef3f16 | ||
![]() |
8fa6bc1b69 | ||
![]() |
f485b1eb50 | ||
![]() |
8515eac900 | ||
![]() |
d9e068f794 | ||
![]() |
ed5358a6d6 | ||
![]() |
7b6163c968 | ||
![]() |
c4927372ec | ||
![]() |
f3cd21009b | ||
![]() |
a71c75b53e | ||
![]() |
d95f67748c | ||
![]() |
e11bf264b5 | ||
![]() |
db382816f5 | ||
![]() |
01732eb443 | ||
![]() |
fc9605565a | ||
![]() |
7d018760ca | ||
![]() |
d52679eae8 | ||
![]() |
aa9c317831 | ||
![]() |
44b280962f | ||
![]() |
6a90f95712 | ||
![]() |
910c51004d | ||
![]() |
bdb05d1dee | ||
![]() |
abc68eb900 | ||
![]() |
5a50c9e5ac | ||
![]() |
1d15417a83 | ||
![]() |
233d318e48 | ||
![]() |
a0c52f017c | ||
![]() |
f89d824367 | ||
![]() |
d5daf5de67 | ||
![]() |
49459b2d81 |
19
AUTHORS.md
19
AUTHORS.md
@@ -3,24 +3,25 @@ IdeaVim Authors
|
||||
|
||||
The original author:
|
||||
|
||||
* Rick Maddy <rmaddy@maddyhome.com>
|
||||
* [Rick Maddy](mailto:rmaddy@maddyhome.com)
|
||||
|
||||
The current maintainer:
|
||||
|
||||
* Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
|
||||
* [Andrey Vlasovskikh](mailto:andrey.vlasovskikh@gmail.com)
|
||||
|
||||
Previous maintainers:
|
||||
|
||||
* Oleg Shpynov <oleg.shpynov@jetbrains.com>
|
||||
* [Oleg Shpynov](mailto:oleg.shpynov@jetbrains.com)
|
||||
|
||||
Contributors:
|
||||
|
||||
* Dmitry Jemerov <yole@jetbrains.com>
|
||||
* Marquis Wang <marquis@marquiswang.com>
|
||||
* Julien Hoarau <madgnome@gmail.com>
|
||||
* Masanobu Imai <masanobu.imai@gmail.com>
|
||||
* poxu <poxvuibr@gmail.com>
|
||||
* Alexander Zolotov <alexander.zolotov@jetbrains.com>
|
||||
* [Dmitry Jemerov](mailto:yole@jetbrains.com)
|
||||
* [Marquis Wang](mailto:marquis@marquiswang.com)
|
||||
* [Julien Hoarau](mailto:madgnome@gmail.com)
|
||||
* [Masanobu Imai](mailto:masanobu.imai@gmail.com)
|
||||
* [poxu](mailto:poxvuibr@gmail.com)
|
||||
* [Alexander Zolotov](mailto:alexander.zolotov@jetbrains.com)
|
||||
* [John Lindquist](mailto:johnlindquist@gmail.com)
|
||||
|
||||
If you are a contributor and your name is not listed here, feel free to
|
||||
contact the maintainer.
|
||||
|
76
CHANGES.md
76
CHANGES.md
@@ -3,6 +3,82 @@ The Changelog
|
||||
|
||||
History of changes in IdeaVim for the IntelliJ platform.
|
||||
|
||||
|
||||
0.29, TBD
|
||||
---------
|
||||
|
||||
A bugfix release.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* VIM-482 Fixed repeat buffer limits
|
||||
* VIM-91 Enable normal `<Enter>` handling for one-line editors
|
||||
* VIM-121 Don't move cursor while scrolling
|
||||
|
||||
|
||||
0.28, 2013-04-06
|
||||
----------------
|
||||
|
||||
A bugfix release.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* VIM-478 Fixed reconfigure Vim keymap for user-defined base keymaps
|
||||
* VIM-479 Don't try to activate insert mode for diff view
|
||||
|
||||
|
||||
0.27, 2013-04-03
|
||||
----------------
|
||||
|
||||
New Vim keymap generator creates better keymaps, especially for Mac OS X.
|
||||
Restart after reconfiguring the keymap is no longer required.
|
||||
|
||||
Features:
|
||||
|
||||
* VIM-92 Better Vim keymaps for Mac OS X
|
||||
* VIM-286 Ask if the plugin should enable repeating keys in Mac OS X
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* VIM-42 Fixed code completion for the `.` command
|
||||
* VIM-421 Fixed `cw` on the last character in line
|
||||
* VIM-419 Fixed resetting cursor position after 'gt' and 'gT'
|
||||
* VIM-233 Fixed code completion for edits in visual block mode
|
||||
* VIM-404 Fixed `O` command at the first line
|
||||
* VIM-472 Fixed right selection in visual mode to be one char more
|
||||
* Fixed command window font size to match editor font size
|
||||
|
||||
|
||||
0.26, 2012-12-26
|
||||
----------------
|
||||
|
||||
Added support for paste in the command mode: from a register using `<C-R>`,
|
||||
from the clipboard using `<S-Insert>` or `<M-V>`. Added support for the last
|
||||
change position mark (the dot `.` mark). New shortcuts for Go to declaration
|
||||
`<C-]>` and Navigate back `<C-T>`. Various bug fixes.
|
||||
|
||||
Features:
|
||||
|
||||
* VIM-262 Support for paste from register in command mode
|
||||
* VIM-214 Key bindings for paste into command line
|
||||
* VIM-43 Added support for the last change position mark
|
||||
* VIM-177 Added `<C-]>` and `<C-T>` to the keymap
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* VIM-302 Fixed tab switching order for `gt` and `gT`
|
||||
|
||||
|
||||
0.25, 2012-12-19
|
||||
----------------
|
||||
|
||||
A bugfix release.
|
||||
|
||||
* VIM-400 Fixed saving characters with key modifiers in plugin settings
|
||||
* VIM-319 Fixed saving plugin settings when registers contain the null
|
||||
character
|
||||
|
||||
|
||||
0.24, 2012-12-03
|
||||
----------------
|
||||
|
||||
|
33
README.md
33
README.md
@@ -9,7 +9,9 @@ Resources:
|
||||
|
||||
* [Plugin homepage](http://plugins.intellij.net/plugin/?id=164)
|
||||
* [Changelog](https://github.com/JetBrains/ideavim/blob/master/CHANGES.md)
|
||||
* [Bug tracker](http://youtrack.jetbrains.com/issues/VIM)
|
||||
* [Continuous integration builds](http://teamcity.jetbrains.com/project.html?projectId=project55)
|
||||
* [@IdeaVim](http://twitter.com/ideavim) in Twitter
|
||||
|
||||
|
||||
Installation
|
||||
@@ -127,6 +129,37 @@ keyboard shortcuts, and their new VIM keystrokes.
|
||||
Check In Project Ctrl-K <None>
|
||||
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
### Development Environment
|
||||
|
||||
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
|
||||
|
||||
2. Open the project in IntelliJ IDEA 11+ (Community or Ultimate) using "File |
|
||||
Open... | /path/to/ideavim".
|
||||
|
||||
3. Set up a JDK if you haven't got it yet. Use "File | Project Structure | SDKs
|
||||
| Add new JDK".
|
||||
|
||||
4. Set up an IntelliJ plugin SDK using "File | Project Structure | SDKs | Add
|
||||
new IntelliJ IDEA Plugin SDK". The correct path to your current installation
|
||||
of IntelliJ will be suggested automatically. You will be prompted to select a
|
||||
JDK for your plugin SDK. Select the JDK from the previous step. You
|
||||
**should** name your plugin SDK `IntelliJ Plugin SDK` in order to match the
|
||||
name in the project settings stored in the Git repository.
|
||||
|
||||
5. Select a project SDK for your project using "File | Project Structure |
|
||||
Project | Project SDK". Choose the plugin SDK you have created at the
|
||||
previous step.
|
||||
|
||||
6. Build IdeaVim and run IntelliJ with IdeaVim enabled using the "IdeaVim" run
|
||||
configuration (use "Run | Run... | IdeaVim").
|
||||
|
||||
7. In order to be able to run tests in your IntelliJ edition uncomment the
|
||||
appropriate lines in the constructor of the `VimTestCase` class.
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
version-id:0.24
|
||||
version-id:0.29
|
||||
platform-version:110.0
|
||||
idea.download.url=http://download.jetbrains.com/idea/ideaIU-11.zip
|
||||
idea.download.url=http://download.jetbrains.com/idea/ideaIU-12.1.zip
|
||||
build.number=x
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<property name="idea.home" value="${idea}/unzip"/>
|
||||
<property environment="env"/>
|
||||
<property name="tools.jar" value="${env.JAVA_HOME}/lib/tools.jar"/>
|
||||
<property name="version" value="${version-id}-${build.number}"/>
|
||||
<property name="version" value="${version-id}"/>
|
||||
<property name="filename" value="ideavim-${version}"/>
|
||||
|
||||
<!--Output-->
|
||||
|
18
index.txt
18
index.txt
@@ -26,6 +26,8 @@ tag char action in Insert mode ~
|
||||
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
|
||||
|
||||
==============================================================================
|
||||
@@ -63,6 +65,8 @@ tag char note action in Normal mode ~
|
||||
|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}
|
||||
@@ -159,6 +163,20 @@ 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*
|
||||
|
||||
|
@@ -1,7 +1,37 @@
|
||||
<idea-plugin url="http://plugins.intellij.net/plugin/?id=164">
|
||||
<name>IdeaVIM</name>
|
||||
<name>IdeaVim</name>
|
||||
<id>IdeaVIM</id>
|
||||
<description><![CDATA[
|
||||
<change-notes>
|
||||
<![CDATA[
|
||||
<p>0.29:</p>
|
||||
<ul>
|
||||
<li>Fixed repeat buffer limits</li>
|
||||
<li>Enable normal <code><Enter></code> handling for one-line editors</li>
|
||||
<li>Don't move cursor while scrolling</li>
|
||||
</ul>
|
||||
<p>0.28:</p>
|
||||
<ul>
|
||||
<li>Fixed reconfigure Vim keymap for user-defined base keymaps</li>
|
||||
</ul>
|
||||
<p>0.27:</p>
|
||||
<ul>
|
||||
<li>Better Vim keymaps for Mac OS X</li>
|
||||
<li>Ask if the plugin should enable repeating keys in Mac OS X</li>
|
||||
<li>Fixed a long-standing bug with code completion and repeat last change command ('<code>.</code>')</li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>0.26:</p>
|
||||
<ul>
|
||||
<li>Added support for paste in the command mode: from a register using <code><C-R></code>, from the clipboard using <code><S-Insert></code> or <code><M-V></code></li>
|
||||
<li>Added support for the last change position mark (the dot <code>.</code> mark)</li>
|
||||
<li>New shortcuts for Go to declaration <code><C-]></code> and Navigate back <code><C-T></code></li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
|
||||
]]>
|
||||
</change-notes>
|
||||
<description>
|
||||
<![CDATA[
|
||||
<p>Vim emulation plug-in for IDEs based on the IntelliJ platform. IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm and AppCode.</p>
|
||||
<p>Supported functionality:</p>
|
||||
<ul>
|
||||
@@ -20,11 +50,11 @@
|
||||
<li>Command line and search history</li>
|
||||
<li>Vim web help</li>
|
||||
</ul>
|
||||
]]></description>
|
||||
]]>
|
||||
</description>
|
||||
<version>@VERSION@</version>
|
||||
<vendor logo="/icons/vim16x16.png">Rick Maddy, JetBrains</vendor>
|
||||
<vendor logo="/icons/vim16x16.png">JetBrains</vendor>
|
||||
|
||||
<helpset file="help.jar" path="/VimHelp.hs"/>
|
||||
<idea-version since-build="@SINCE-VERSION@"/>
|
||||
|
||||
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
|
||||
@@ -42,12 +72,12 @@
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.VimPluginToggleAction" text="VIM Emulator" description="Toggle the Vim Plugin On/Off">
|
||||
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.VimPluginToggleAction" text="Vim Emulator" description="Toggle the Vim Plugin On/Off">
|
||||
<keyboard-shortcut first-keystroke="control alt V" keymap="$default"/>
|
||||
<add-to-group group-id="ToolsMenu" anchor="last"/>
|
||||
</action>
|
||||
<action id="VimReconfigureKeymap" class="com.maddyhome.idea.vim.VimReconfigureKeymapAction" text="Reconfigure VIM Keymap" description="Reconfigure VIM keymap">
|
||||
<add-to-group group-id="ToolsMenu" order="after VimPluginToggle"/>
|
||||
<action id="VimReconfigureKeymap" class="com.maddyhome.idea.vim.VimReconfigureKeymapAction" text="Reconfigure Vim Keymap" description="Reconfigure Vim keymap">
|
||||
<add-to-group group-id="ToolsMenu" relative-to-action="after VimPluginToggle"/>
|
||||
</action>
|
||||
|
||||
<!-- Motions -->
|
||||
|
@@ -1,129 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<keymap version="1" name="Vim" disable-mnemonics="false" parent="$default">
|
||||
<action id="$Copy">
|
||||
<keyboard-shortcut first-keystroke="control INSERT" />
|
||||
<keyboard-shortcut first-keystroke="meta C" />
|
||||
</action>
|
||||
<action id="$Cut">
|
||||
<keyboard-shortcut first-keystroke="shift DELETE" />
|
||||
<keyboard-shortcut first-keystroke="meta X" />
|
||||
</action>
|
||||
<action id="$Paste">
|
||||
<keyboard-shortcut first-keystroke="shift INSERT" />
|
||||
<keyboard-shortcut first-keystroke="meta V" />
|
||||
</action>
|
||||
<action id="$Redo">
|
||||
<keyboard-shortcut first-keystroke="shift alt BACK_SPACE" />
|
||||
</action>
|
||||
<action id="$SelectAll" />
|
||||
<action id="$Undo">
|
||||
<keyboard-shortcut first-keystroke="alt BACK_SPACE" />
|
||||
</action>
|
||||
<action id="CheckinProject" />
|
||||
<action id="ClassNameCompletion" />
|
||||
<action id="ClearCase.CheckInProject" />
|
||||
<action id="CodeCompletion" />
|
||||
<action id="CommanderSwapPanels" />
|
||||
<action id="ContextHelp" />
|
||||
<action id="EditorBackSpace">
|
||||
<keyboard-shortcut first-keystroke="BACK_SPACE" />
|
||||
</action>
|
||||
<action id="EditorCodeBlockEnd" />
|
||||
<action id="EditorCodeBlockStart" />
|
||||
<action id="EditorCopy">
|
||||
<keyboard-shortcut first-keystroke="control INSERT" />
|
||||
<keyboard-shortcut first-keystroke="meta C" />
|
||||
</action>
|
||||
<action id="EditorCut">
|
||||
<keyboard-shortcut first-keystroke="shift DELETE" />
|
||||
<keyboard-shortcut first-keystroke="meta X" />
|
||||
</action>
|
||||
<action id="EditorDeleteLine" />
|
||||
<action id="EditorDeleteToWordEnd" />
|
||||
<action id="EditorDeleteToWordStart" />
|
||||
<action id="EditorDownWithSelection" />
|
||||
<action id="EditorDuplicate" />
|
||||
<action id="EditorIndentSelection" />
|
||||
<action id="EditorJoinLines" />
|
||||
<action id="EditorLeftWithSelection" />
|
||||
<action id="EditorLineEndWithSelection" />
|
||||
<action id="EditorLineStartWithSelection" />
|
||||
<action id="EditorMoveToPageBottom" />
|
||||
<action id="EditorMoveToPageBottomWithSelection" />
|
||||
<action id="EditorMoveToPageTop" />
|
||||
<action id="EditorMoveToPageTopWithSelection" />
|
||||
<action id="EditorNextWord" />
|
||||
<action id="EditorNextWordWithSelection" />
|
||||
<action id="EditorPageDownWithSelection" />
|
||||
<action id="EditorPageUpWithSelection" />
|
||||
<action id="EditorPaste">
|
||||
<keyboard-shortcut first-keystroke="shift INSERT" />
|
||||
<keyboard-shortcut first-keystroke="meta V" />
|
||||
</action>
|
||||
<action id="EditorPreviousWord" />
|
||||
<action id="EditorPreviousWordWithSelection" />
|
||||
<action id="EditorRedo" />
|
||||
<action id="EditorRightWithSelection" />
|
||||
<action id="EditorScrollDown" />
|
||||
<action id="EditorScrollToCenter" />
|
||||
<action id="EditorScrollUp" />
|
||||
<action id="EditorSelectAll" />
|
||||
<action id="EditorSelectWord" />
|
||||
<action id="EditorSplitLine" />
|
||||
<action id="EditorStartNewLine" />
|
||||
<action id="EditorTextEnd" />
|
||||
<action id="EditorTextEndWithSelection" />
|
||||
<action id="EditorTextStart" />
|
||||
<action id="EditorTextStartWithSelection" />
|
||||
<action id="EditorToggleCase" />
|
||||
<action id="EditorUnSelectWord" />
|
||||
<action id="EditorUndo" />
|
||||
<action id="EditorUnindentSelection" />
|
||||
<action id="EditorUpWithSelection" />
|
||||
<action id="Find" />
|
||||
<action id="FindNext">
|
||||
<keyboard-shortcut first-keystroke="F3" />
|
||||
</action>
|
||||
<action id="FindPrevious">
|
||||
<keyboard-shortcut first-keystroke="shift F3" />
|
||||
</action>
|
||||
<action id="GotoBookmark2" />
|
||||
<action id="GotoClass">
|
||||
<keyboard-shortcut first-keystroke="shift alt N" />
|
||||
</action>
|
||||
<action id="GotoDeclaration">
|
||||
<mouse-shortcut keystroke="control button1" />
|
||||
<mouse-shortcut keystroke="button2" />
|
||||
</action>
|
||||
<action id="GotoLine" />
|
||||
<action id="GotoSuperMethod">
|
||||
<keyboard-shortcut first-keystroke="shift control U" />
|
||||
</action>
|
||||
<action id="ImplementMethods">
|
||||
<keyboard-shortcut first-keystroke="shift control I" />
|
||||
</action>
|
||||
<action id="InsertLiveTemplate" />
|
||||
<action id="MethodHierarchy.ImplementMethodAction" />
|
||||
<action id="MethodHierarchy.OverrideMethodAction" />
|
||||
<action id="OverrideMethods">
|
||||
<keyboard-shortcut first-keystroke="shift control O" />
|
||||
</action>
|
||||
<action id="ParameterInfo">
|
||||
<keyboard-shortcut first-keystroke="shift control P" />
|
||||
</action>
|
||||
<action id="QuickJavaDoc">
|
||||
<mouse-shortcut keystroke="alt button2" />
|
||||
</action>
|
||||
<action id="RecentFiles" />
|
||||
<action id="Replace" />
|
||||
<action id="SaveAll" />
|
||||
<action id="SmartTypeCompletion" />
|
||||
<action id="Starteam.CheckinProject" />
|
||||
<action id="Subversion.CommitProject" />
|
||||
<action id="ToggleBookmark2" />
|
||||
<action id="TypeHierarchy">
|
||||
<keyboard-shortcut first-keystroke="shift control alt H" />
|
||||
</action>
|
||||
<action id="VimKeyHandler">
|
||||
<keyboard-shortcut first-keystroke="control 2" />
|
||||
<keyboard-shortcut first-keystroke="control A" />
|
||||
@@ -145,7 +21,6 @@
|
||||
<keyboard-shortcut first-keystroke="control L" />
|
||||
<keyboard-shortcut first-keystroke="control LEFT" />
|
||||
<keyboard-shortcut first-keystroke="control M" />
|
||||
<keyboard-shortcut first-keystroke="control N" />
|
||||
<keyboard-shortcut first-keystroke="control O" />
|
||||
<keyboard-shortcut first-keystroke="control OPEN_BRACKET" />
|
||||
<keyboard-shortcut first-keystroke="control P" />
|
||||
|
@@ -214,7 +214,7 @@ public class KeyHandler {
|
||||
fullReset(editor);
|
||||
}
|
||||
else if (isRecording && shouldRecord) {
|
||||
CommandGroups.getInstance().getRegister().addKeyStroke(key);
|
||||
CommandGroups.getInstance().getRegister().recordKeyStroke(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ public class KeyHandler {
|
||||
* @param name The name of the action to execute
|
||||
* @param context The context to run it in
|
||||
*/
|
||||
public static void executeAction(String name, DataContext context) {
|
||||
public static void executeAction(@NotNull String name, @NotNull DataContext context) {
|
||||
logger.debug("executing action " + name);
|
||||
ActionManager aMgr = ActionManager.getInstance();
|
||||
AnAction action = aMgr.getAction(name);
|
||||
@@ -523,7 +523,7 @@ public class KeyHandler {
|
||||
* @param action The action to execute
|
||||
* @param context The context to run it in
|
||||
*/
|
||||
public static void executeAction(AnAction action, DataContext context) {
|
||||
public static void executeAction(@NotNull AnAction action, @NotNull DataContext context) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("executing action " + action);
|
||||
}
|
||||
@@ -604,7 +604,7 @@ public class KeyHandler {
|
||||
executeAction(cmd.getAction(), context);
|
||||
if (editorState.getMode() == CommandState.Mode.INSERT ||
|
||||
editorState.getMode() == CommandState.Mode.REPLACE) {
|
||||
CommandGroups.getInstance().getChange().processCommand(editor, context, cmd);
|
||||
CommandGroups.getInstance().getChange().processCommand(editor, cmd);
|
||||
}
|
||||
|
||||
// Now that the command has been executed let's clean up a few things.
|
||||
@@ -627,7 +627,7 @@ public class KeyHandler {
|
||||
KeyHandler.getInstance().reset(editor);
|
||||
|
||||
if (wasRecording && editorState.isRecording()) {
|
||||
CommandGroups.getInstance().getRegister().addKeyStroke(key);
|
||||
CommandGroups.getInstance().getRegister().recordKeyStroke(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,10 +648,10 @@ public class KeyHandler {
|
||||
private int count;
|
||||
private List<KeyStroke> keys;
|
||||
private State state;
|
||||
private Stack<Command> currentCmd = new Stack<Command>();
|
||||
@NotNull private Stack<Command> currentCmd = new Stack<Command>();
|
||||
@NotNull private Argument.Type currentArg;
|
||||
private TypedActionHandler origHandler;
|
||||
private DigraphSequence digraph = null;
|
||||
@Nullable private DigraphSequence digraph = null;
|
||||
private char lastChar;
|
||||
private boolean lastWasBS;
|
||||
|
||||
|
@@ -6,24 +6,19 @@ import com.google.common.io.Resources;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.actionSystem.Shortcut;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.impl.stores.StorageUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.impl.KeymapImpl;
|
||||
import com.intellij.openapi.keymap.impl.KeymapManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.maddyhome.idea.vim.ui.VimKeymapDialog;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
@@ -31,6 +26,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.io.ByteStreams.toByteArray;
|
||||
|
||||
@@ -56,10 +54,6 @@ public class VimKeyMapUtil {
|
||||
*/
|
||||
public static boolean installKeyBoardBindings() {
|
||||
LOG.debug("Check for keyboard bindings");
|
||||
if (isVimKeymapInstalled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
|
||||
if (localFileSystem.refreshAndFindFileByPath(KEYMAPS_PATH) == null) {
|
||||
reportError("Failed to install vim keymap. Empty keymaps folder");
|
||||
@@ -71,9 +65,11 @@ public class VimKeyMapUtil {
|
||||
final byte[] bytes = toByteArray(retrieveSourceKeymapStream());
|
||||
Files.write(bytes, new File(INSTALLED_VIM_KEYMAP_PATH));
|
||||
final Document document = StorageUtil.loadDocument(bytes);
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
if (document != null && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
// Prompt user to select the parent for the Vim keyboard
|
||||
configureVimParentKeymap(INSTALLED_VIM_KEYMAP_PATH, document, false);
|
||||
if (!configureVimParentKeymap(INSTALLED_VIM_KEYMAP_PATH, document, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
installKeymap(document);
|
||||
} catch (IOException e) {
|
||||
@@ -90,7 +86,7 @@ public class VimKeyMapUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void installKeymap(Document document) throws InvalidDataException {
|
||||
private static void installKeymap(@Nullable Document document) throws InvalidDataException {
|
||||
if (document == null) {
|
||||
throw new InvalidDataException();
|
||||
}
|
||||
@@ -101,47 +97,53 @@ public class VimKeyMapUtil {
|
||||
keymapManager.addKeymap(vimKeyMap);
|
||||
}
|
||||
|
||||
private static void requestRestartOrShutdown(final Project project) {
|
||||
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
||||
if (app.isRestartCapable()) {
|
||||
if (Messages.showDialog(project, "Restart " + ApplicationNamesInfo.getInstance().getProductName() + " to activate changes?",
|
||||
VimPlugin.IDEAVIM_NOTIFICATION_TITLE, new String[]{"&Restart", "&Postpone"}, 0,
|
||||
Messages.getQuestionIcon()) == 0) {
|
||||
app.restart();
|
||||
}
|
||||
} else {
|
||||
if (Messages.showDialog(project, "Shut down " + ApplicationNamesInfo.getInstance().getProductName() + " to activate changes?",
|
||||
VimPlugin.IDEAVIM_NOTIFICATION_TITLE, new String[]{"&Shut Down", "&Postpone"}, 0,
|
||||
Messages.getQuestionIcon()) == 0) {
|
||||
app.exit(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes parent keymap for the Vim
|
||||
*
|
||||
* @return true if document was changed successfully
|
||||
*/
|
||||
private static boolean configureVimParentKeymap(final String path, final Document document, final boolean showNotification) throws IOException {
|
||||
private static boolean configureVimParentKeymap(final String path, @NotNull final Document document,
|
||||
final boolean showNotification)
|
||||
throws IOException, InvalidDataException {
|
||||
final Element rootElement = document.getRootElement();
|
||||
final String parentKeymap = rootElement.getAttributeValue("parent");
|
||||
final VimKeymapDialog vimKeymapDialog = new VimKeymapDialog(parentKeymap);
|
||||
final String parentKeymapName = rootElement.getAttributeValue("parent");
|
||||
final VimKeymapDialog vimKeymapDialog = new VimKeymapDialog(parentKeymapName);
|
||||
vimKeymapDialog.show();
|
||||
if (vimKeymapDialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
|
||||
return false;
|
||||
}
|
||||
rootElement.removeAttribute("parent");
|
||||
final Keymap selectedKeymap = vimKeymapDialog.getSelectedKeymap();
|
||||
final String keymapName = selectedKeymap.getName();
|
||||
final Keymap parentKeymap = vimKeymapDialog.getSelectedKeymap();
|
||||
final String keymapName = parentKeymap.getName();
|
||||
VimKeymapConflictResolveUtil.resolveConflicts(rootElement, parentKeymap);
|
||||
// We cannot set a user-defined modifiable keymap as the parent of our Vim keymap so we have to copy its shortcuts
|
||||
if (parentKeymap.canModify()) {
|
||||
final KeymapImpl vimKeyMap = new KeymapImpl();
|
||||
final KeymapManager keymapManager = KeymapManager.getInstance();
|
||||
final KeymapManagerImpl keymapManagerImpl = (KeymapManagerImpl)keymapManager;
|
||||
final Keymap[] allKeymaps = keymapManagerImpl.getAllKeymaps();
|
||||
vimKeyMap.readExternal(rootElement, allKeymaps);
|
||||
final HashSet<String> ownActions = new HashSet<String>(Arrays.asList(vimKeyMap.getOwnActionIds()));
|
||||
final KeymapImpl parentKeymapImpl = (KeymapImpl)parentKeymap;
|
||||
for (String parentAction : parentKeymapImpl.getOwnActionIds()) {
|
||||
if (!ownActions.contains(parentAction)) {
|
||||
final List<Shortcut> shortcuts = Arrays.asList(parentKeymap.getShortcuts(parentAction));
|
||||
rootElement.addContent(VimKeymapConflictResolveUtil.createActionElement(parentAction, shortcuts));
|
||||
}
|
||||
}
|
||||
final Keymap grandParentKeymap = parentKeymap.getParent();
|
||||
rootElement.setAttribute("parent", grandParentKeymap.getName());
|
||||
}
|
||||
else {
|
||||
rootElement.setAttribute("parent", keymapName);
|
||||
|
||||
}
|
||||
VimPlugin.getInstance().setPreviousKeyMap(keymapName);
|
||||
// Save modified keymap to the file
|
||||
JDOMUtil.writeDocument(document, path, "\n");
|
||||
if (showNotification) {
|
||||
Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
|
||||
"Successfully configured vim keymap to be based on " +
|
||||
selectedKeymap.getPresentableName(),
|
||||
parentKeymap.getPresentableName(),
|
||||
NotificationType.INFORMATION));
|
||||
}
|
||||
|
||||
@@ -194,30 +196,6 @@ public class VimKeyMapUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static void reconfigureParentKeymap(final Project project) {
|
||||
final VirtualFile vimKeymapFile = getVimKeymapFile();
|
||||
if (vimKeymapFile == null) {
|
||||
reportError("Failed to find Vim keymap");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final Document document = StorageUtil.loadDocument(new FileInputStream(vimKeymapFile.getPath()));
|
||||
// Prompt user to select the parent for the Vim keyboard
|
||||
if (configureVimParentKeymap(vimKeymapFile.getPath(), document, true)) {
|
||||
installKeymap(document);
|
||||
requestRestartOrShutdown(project);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
reportError("Failed to install vim keymap.", e);
|
||||
} catch (IOException e) {
|
||||
reportError("Failed to install vim keymap.", e);
|
||||
} catch (InvalidDataException e) {
|
||||
reportError("Failed to install vim keymap. Vim.xml file is corrupted", e);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static InputStream retrieveSourceKeymapStream() throws IOException {
|
||||
String keymapPath = PATH_JOINER.join(PathManager.getPluginsPath(), VimPlugin.IDEAVIM_NOTIFICATION_TITLE, VIM_XML);
|
||||
@@ -241,9 +219,4 @@ public class VimKeyMapUtil {
|
||||
Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE,
|
||||
message + String.valueOf(e), NotificationType.ERROR));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile getVimKeymapFile() {
|
||||
return LocalFileSystem.getInstance().refreshAndFindFileByPath(INSTALLED_VIM_KEYMAP_PATH);
|
||||
}
|
||||
}
|
224
src/com/maddyhome/idea/vim/VimKeymapConflictResolveUtil.java
Normal file
224
src/com/maddyhome/idea/vim/VimKeymapConflictResolveUtil.java
Normal file
@@ -0,0 +1,224 @@
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut;
|
||||
import com.intellij.openapi.actionSystem.MouseShortcut;
|
||||
import com.intellij.openapi.actionSystem.Shortcut;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.impl.KeymapImpl;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.common.collect.Lists.newLinkedList;
|
||||
import static com.google.common.collect.Maps.newHashMap;
|
||||
|
||||
/**
|
||||
* User: zolotov
|
||||
* Date: 1/8/13
|
||||
*/
|
||||
public class VimKeymapConflictResolveUtil {
|
||||
private static final String SHIFT = "shift";
|
||||
private static final String CONTROL = "control";
|
||||
private static final String META = "meta";
|
||||
private static final String ALT = "alt";
|
||||
private static final String ALT_GRAPH = "altGraph";
|
||||
private static final String DOUBLE_CLICK = "doubleClick";
|
||||
|
||||
private static final String VIM_KEY_HANDLER_ACTION_ID = "VimKeyHandler";
|
||||
private static final String ACTION_TAG = "action";
|
||||
private static final String KEYBOARD_SHORTCUT_TAG = "keyboard-shortcut";
|
||||
private static final String MOUSE_SHORTCUT_TAG = "mouse-shortcut";
|
||||
private static final String ID_ATTRIBUTE = "id";
|
||||
private static final String FIRST_KEYSTROKE_ATTRIBUTE = "first-keystroke";
|
||||
private static final String KEYSTROKE_ATTRIBUTE = "keystroke";
|
||||
private static final String SECOND_KEYSTROKE_ATTRIBUTE = "second-keystroke";
|
||||
|
||||
private static final List<Integer> ALTERNATIVE_MODIFIERS = ImmutableList.of(
|
||||
InputEvent.ALT_DOWN_MASK,
|
||||
InputEvent.CTRL_DOWN_MASK,
|
||||
InputEvent.SHIFT_DOWN_MASK,
|
||||
InputEvent.META_DOWN_MASK,
|
||||
InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK,
|
||||
InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK,
|
||||
InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK,
|
||||
InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK,
|
||||
InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
|
||||
|
||||
public static void resolveConflicts(Element targetKeymapRoot, Keymap parentKeymap) {
|
||||
final Collection<String> vimHandlingShortcuts = getVimHandlingShortcuts(targetKeymapRoot);
|
||||
final Map<String, List<Shortcut>> shortcutsToOverride = retrieveShortcutsToOverride(vimHandlingShortcuts, parentKeymap);
|
||||
overrideShortcuts(targetKeymapRoot, shortcutsToOverride);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetKeymapRoot root element of Vim keymap
|
||||
* @return all shortcuts in string representation that should be handled by Vim plugin
|
||||
*/
|
||||
private static Collection<String> getVimHandlingShortcuts(Element targetKeymapRoot) {
|
||||
Element vimKeyHandlerAction = retrieveActionElement(targetKeymapRoot);
|
||||
if (vimKeyHandlerAction != null) {
|
||||
Collection<String> result = newLinkedList();
|
||||
for (Object childAction : vimKeyHandlerAction.getChildren()) {
|
||||
if (childAction instanceof Element) {
|
||||
Element shortcut = (Element)childAction;
|
||||
result.add(shortcut.getAttributeValue(FIRST_KEYSTROKE_ATTRIBUTE));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetKeymapRoot root element of Vim keymap
|
||||
* @return Retrieve VimKeyHandler action element
|
||||
*/
|
||||
@Nullable
|
||||
private static Element retrieveActionElement(Element targetKeymapRoot) {
|
||||
Element vimKeyHandlerAction = null;
|
||||
for (Object child : targetKeymapRoot.getChildren(ACTION_TAG)) {
|
||||
if (child instanceof Element) {
|
||||
Element action = (Element)child;
|
||||
if (VIM_KEY_HANDLER_ACTION_ID.equals(action.getAttributeValue(ID_ATTRIBUTE))) {
|
||||
vimKeyHandlerAction = action;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return vimKeyHandlerAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vimHandlingShortcuts collection of shortcuts that should be handled by Vim plugin
|
||||
* @param parentKeymap selected parent keymap for vim keymap
|
||||
* @return mapping of action names to its shortcuts that we should save in Vim-keymap
|
||||
* (or empty list of shortcuts if action just should be disabled)
|
||||
*/
|
||||
private static Map<String, List<Shortcut>> retrieveShortcutsToOverride(Collection<String> vimHandlingShortcuts, Keymap parentKeymap) {
|
||||
Map<String, List<Shortcut>> result = newHashMap();
|
||||
for (String shortcut : vimHandlingShortcuts) {
|
||||
final Map<String, ArrayList<KeyboardShortcut>> conflicts = parentKeymap.getConflicts("", KeyboardShortcut.fromString(shortcut));
|
||||
for (Map.Entry<String, ArrayList<KeyboardShortcut>> conflict : conflicts.entrySet()) {
|
||||
String actionName = conflict.getKey();
|
||||
final ArrayList<KeyboardShortcut> conflictedShortcuts = conflict.getValue();
|
||||
if (result.containsKey(actionName)) {
|
||||
// found another conflict for already overridden action
|
||||
List<Shortcut> overridesShortcuts = result.get(actionName);
|
||||
for (KeyboardShortcut conflictedShortcut : conflictedShortcuts) {
|
||||
overridesShortcuts.remove(conflictedShortcut);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// let's override action with all non-conflict shortcuts
|
||||
List<Shortcut> overriddenShortcuts = newLinkedList();
|
||||
for (Shortcut actionShortcut : parentKeymap.getShortcuts(actionName)) {
|
||||
if (!(actionShortcut instanceof KeyboardShortcut) || !conflictedShortcuts.contains(actionShortcut)) {
|
||||
overriddenShortcuts.add(actionShortcut);
|
||||
}
|
||||
}
|
||||
if (overriddenShortcuts.isEmpty()) {
|
||||
for (Integer modifier : ALTERNATIVE_MODIFIERS) {
|
||||
if (!SystemInfo.isMac && (modifier & InputEvent.META_DOWN_MASK) != 0) {
|
||||
continue;
|
||||
}
|
||||
final KeyStroke originalStroke = KeyStroke.getKeyStroke(shortcut);
|
||||
final int modifiers = originalStroke.getModifiers() | modifier;
|
||||
//noinspection MagicConstant
|
||||
final KeyStroke stroke = KeyStroke.getKeyStroke(originalStroke.getKeyCode(), modifiers);
|
||||
final KeyboardShortcut alternativeShortcut = new KeyboardShortcut(stroke, null);
|
||||
if (parentKeymap.getConflicts("", alternativeShortcut).isEmpty()) {
|
||||
overriddenShortcuts.add(alternativeShortcut);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
result.put(actionName, overriddenShortcuts);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill vim keymap with overridden actions.
|
||||
* Only keyboard and mouse shortcuts will be overridden.
|
||||
*
|
||||
* @param targetKeymapRoot root element of Vim keymap
|
||||
* @param shortcutsToOverride overriding mapping: actions -> shortcuts_should_be_saved
|
||||
*/
|
||||
|
||||
private static void overrideShortcuts(Element targetKeymapRoot, Map<String, List<Shortcut>> shortcutsToOverride) {
|
||||
for (Map.Entry<String, List<Shortcut>> action : shortcutsToOverride.entrySet()) {
|
||||
targetKeymapRoot.addContent(createActionElement(action.getKey(), action.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public static Element createActionElement(String actionName, List<Shortcut> shortcuts) {
|
||||
final Element overridesAction = new Element(ACTION_TAG);
|
||||
overridesAction.setAttribute(ID_ATTRIBUTE, actionName);
|
||||
for (Shortcut shortcut : shortcuts) {
|
||||
if (shortcut instanceof KeyboardShortcut) {
|
||||
KeyboardShortcut keyboardShortcut = (KeyboardShortcut)shortcut;
|
||||
final String firstShortcutString = KeymapImpl.getKeyShortcutString(keyboardShortcut.getFirstKeyStroke());
|
||||
final Element shortcutElement = createShortcutElement(KEYBOARD_SHORTCUT_TAG, FIRST_KEYSTROKE_ATTRIBUTE,
|
||||
firstShortcutString);
|
||||
overridesAction.addContent(shortcutElement);
|
||||
final KeyStroke secondKeyStroke = keyboardShortcut.getSecondKeyStroke();
|
||||
if (secondKeyStroke != null) {
|
||||
final String secondShortcutString = KeymapImpl.getKeyShortcutString(secondKeyStroke);
|
||||
shortcutElement.setAttribute(SECOND_KEYSTROKE_ATTRIBUTE, secondShortcutString);
|
||||
}
|
||||
}
|
||||
else if (shortcut instanceof MouseShortcut) {
|
||||
overridesAction.addContent(createShortcutElement(MOUSE_SHORTCUT_TAG, KEYSTROKE_ATTRIBUTE, getMouseShortcutString((MouseShortcut)shortcut)));
|
||||
}
|
||||
}
|
||||
return overridesAction;
|
||||
}
|
||||
|
||||
private static Element createShortcutElement(String elementName, String shortcutAttributeName, String shortcut) {
|
||||
final Element shortcutElement = new Element(elementName);
|
||||
shortcutElement.setAttribute(shortcutAttributeName, shortcut);
|
||||
return shortcutElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create string representation of mouse shortcut
|
||||
* KeymapImpl has implementation for mouse shortcut marshaling, but it is private :-(
|
||||
*
|
||||
* @param shortcut mouse shortcut
|
||||
* @return string representation of mouse shortcut
|
||||
*/
|
||||
private static String getMouseShortcutString(MouseShortcut shortcut) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
int modifiers = shortcut.getModifiers();
|
||||
if ((MouseEvent.SHIFT_DOWN_MASK & modifiers) > 0) {
|
||||
builder.append(SHIFT).append(' ');
|
||||
}
|
||||
if ((MouseEvent.CTRL_DOWN_MASK & modifiers) > 0) {
|
||||
builder.append(CONTROL).append(' ');
|
||||
}
|
||||
if ((MouseEvent.META_DOWN_MASK & modifiers) > 0) {
|
||||
builder.append(META).append(' ');
|
||||
}
|
||||
if ((MouseEvent.ALT_DOWN_MASK & modifiers) > 0) {
|
||||
builder.append(ALT).append(' ');
|
||||
}
|
||||
if ((MouseEvent.ALT_GRAPH_DOWN_MASK & modifiers) > 0) {
|
||||
builder.append(ALT_GRAPH).append(' ');
|
||||
}
|
||||
builder.append("button").append(shortcut.getButton()).append(' ');
|
||||
if (shortcut.getClickCount() > 1) {
|
||||
builder.append(DOUBLE_CLICK);
|
||||
}
|
||||
return builder.toString().trim();
|
||||
}
|
||||
|
||||
}
|
@@ -18,8 +18,10 @@ package com.maddyhome.idea.vim;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
@@ -39,19 +41,18 @@ 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.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.ex.CommandParser;
|
||||
import com.maddyhome.idea.vim.group.*;
|
||||
import com.maddyhome.idea.vim.helper.DelegateCommandListener;
|
||||
import com.maddyhome.idea.vim.helper.DocumentManager;
|
||||
import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||
import com.maddyhome.idea.vim.helper.*;
|
||||
import com.maddyhome.idea.vim.key.RegisterActions;
|
||||
import com.maddyhome.idea.vim.option.Options;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -80,6 +81,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
|
||||
public static final String IDEAVIM_NOTIFICATION_ID = "ideavim";
|
||||
public static final String IDEAVIM_NOTIFICATION_TITLE = "IdeaVim";
|
||||
public static final int STATE_VERSION = 2;
|
||||
|
||||
private static final boolean BLOCK_CURSOR_VIM_VALUE = true;
|
||||
private static final boolean ANIMATED_SCROLLING_VIM_VALUE = false;
|
||||
@@ -92,6 +94,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
private boolean isRefrainFromScrolling = false;
|
||||
private boolean error = false;
|
||||
|
||||
private int previousStateVersion = 0;
|
||||
private String previousKeyMap = "";
|
||||
|
||||
// It is enabled by default to avoid any special configuration after plugin installation
|
||||
@@ -110,6 +113,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
LOG.debug("VimPlugin ctr");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VimPlugin getInstance() {
|
||||
return (VimPlugin)ApplicationManager.getApplication().getComponent(IDEAVIM_COMPONENT_NAME);
|
||||
}
|
||||
@@ -140,6 +144,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
updateState();
|
||||
checkAndInstallKeymap();
|
||||
}
|
||||
});
|
||||
@@ -159,6 +164,41 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
LOG.debug("done");
|
||||
}
|
||||
|
||||
private void updateState() {
|
||||
if (isEnabled() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
boolean requiresRestart = false;
|
||||
if (previousStateVersion < 1 && SystemInfo.isMac && VimKeyMapUtil.isVimKeymapInstalled()) {
|
||||
if (Messages.showYesNoDialog("Vim keymap generator has been updated to create keymaps more compatible " +
|
||||
"with base keymaps.\n\nDo you want to reconfigure your Vim keymap?\n\n" +
|
||||
"Warning: Any custom shortcuts will be lost!\n\n" +
|
||||
"(You can do it later using Tools | Reconfigure Vim Keymap).",
|
||||
IDEAVIM_NOTIFICATION_TITLE,
|
||||
Messages.getQuestionIcon()) == Messages.YES) {
|
||||
KeyHandler.executeAction("VimReconfigureKeymap", SimpleDataContext.getProjectContext(null));
|
||||
}
|
||||
}
|
||||
if (previousStateVersion < 2 && SystemInfo.isMac) {
|
||||
final MacKeyRepeat keyRepeat = MacKeyRepeat.getInstance();
|
||||
final Boolean enabled = keyRepeat.isEnabled();
|
||||
if (enabled == null || !enabled) {
|
||||
if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold " +
|
||||
"(requires restart)?\n\n" +
|
||||
"(You can do it manually by running 'defaults write -g " +
|
||||
"ApplePressAndHoldEnabled 0' in the console).",
|
||||
IDEAVIM_NOTIFICATION_TITLE,
|
||||
Messages.getQuestionIcon()) == Messages.YES) {
|
||||
keyRepeat.setEnabled(true);
|
||||
requiresRestart = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requiresRestart) {
|
||||
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
||||
app.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkAndInstallKeymap() {
|
||||
// Ensure that Vim keymap is installed and install if not.
|
||||
// Moreover we can use installed keymap as indicator of the first time installed plugin
|
||||
@@ -210,7 +250,8 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
|
||||
if (VimPlugin.isEnabled()) {
|
||||
// Turn on insert mode if editor doesn't have any file
|
||||
if (!EditorData.isFileEditor(editor) && !CommandState.inInsertMode(editor)) {
|
||||
if (!EditorData.isFileEditor(editor) && editor.getDocument().isWritable() &&
|
||||
!CommandState.inInsertMode(editor)) {
|
||||
KeyHandler.getInstance().handleKey(editor, KeyStroke.getKeyStroke('i'), new EditorDataContext(editor));
|
||||
}
|
||||
editor.getSettings().setBlockCursor(!CommandState.inInsertMode(editor));
|
||||
@@ -230,7 +271,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
// Since the Vim plugin custom actions aren't available to the call to <code>initComponent()</code>
|
||||
// we need to force the generation of the key map when the first project is opened.
|
||||
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
|
||||
public void projectOpened(final Project project) {
|
||||
public void projectOpened(@NotNull final Project project) {
|
||||
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MotionGroup.MotionEditorChange());
|
||||
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileGroup.SelectionCheck());
|
||||
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new SearchGroup.EditorSelectionCheck());
|
||||
@@ -256,12 +297,17 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(final Element element) {
|
||||
public void loadState(@NotNull final Element element) {
|
||||
LOG.debug("Loading state");
|
||||
|
||||
// Restore whether the plugin is enabled or not
|
||||
Element state = element.getChild("state");
|
||||
if (state != null) {
|
||||
try {
|
||||
previousStateVersion = Integer.valueOf(state.getAttributeValue("version"));
|
||||
}
|
||||
catch (NumberFormatException ignored) {
|
||||
}
|
||||
enabled = Boolean.valueOf(state.getAttributeValue("enabled"));
|
||||
previousKeyMap = state.getAttributeValue("keymap");
|
||||
}
|
||||
@@ -276,6 +322,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
final Element element = new Element("ideavim");
|
||||
// Save whether the plugin is enabled or not
|
||||
final Element state = new Element("state");
|
||||
state.setAttribute("version", Integer.toString(STATE_VERSION));
|
||||
state.setAttribute("enabled", Boolean.toString(enabled));
|
||||
state.setAttribute("keymap", previousKeyMap);
|
||||
element.addContent(state);
|
||||
@@ -323,7 +370,7 @@ public class VimPlugin implements ApplicationComponent, PersistentStateComponent
|
||||
showMessage(msg);
|
||||
}
|
||||
|
||||
public static void showMessage(String msg) {
|
||||
public static void showMessage(@Nullable String msg) {
|
||||
ProjectManager pm = ProjectManager.getInstance();
|
||||
Project[] projs = pm.getOpenProjects();
|
||||
for (Project proj : projs) {
|
||||
|
@@ -3,7 +3,7 @@ package com.maddyhome.idea.vim;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This action allows to reconfigure base parent keymap for the Vim keymap
|
||||
@@ -11,12 +11,13 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
*/
|
||||
public class VimReconfigureKeymapAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(VimPlugin.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
VimKeyMapUtil.reconfigureParentKeymap(e.getData(PlatformDataKeys.PROJECT));
|
||||
public void actionPerformed(@NotNull final AnActionEvent e) {
|
||||
VimKeyMapUtil.installKeyBoardBindings();
|
||||
VimKeyMapUtil.switchKeymapBindings(true);
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,9 @@ package com.maddyhome.idea.vim;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class VimSettings {
|
||||
@@ -38,7 +41,7 @@ public class VimSettings {
|
||||
this.choices = choices;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
@@ -62,6 +65,7 @@ public class VimSettings {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append("VimSettings");
|
||||
|
@@ -21,16 +21,17 @@ package com.maddyhome.idea.vim.action;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractDelegateAction extends AnAction implements DelegateAction {
|
||||
protected AbstractDelegateAction() {
|
||||
}
|
||||
|
||||
protected AbstractDelegateAction(AnAction origAction) {
|
||||
protected AbstractDelegateAction(@NotNull AnAction origAction) {
|
||||
setOrigAction(origAction);
|
||||
}
|
||||
|
||||
public void setOrigAction(AnAction origAction) {
|
||||
public void setOrigAction(@NotNull AnAction origAction) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("origAction=" + origAction);
|
||||
}
|
||||
|
@@ -22,18 +22,19 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractDelegateEditorAction extends EditorAction implements DelegateAction {
|
||||
protected AbstractDelegateEditorAction(EditorActionHandler handler) {
|
||||
super(handler);
|
||||
}
|
||||
|
||||
protected AbstractDelegateEditorAction(EditorActionHandler handler, EditorAction origAction) {
|
||||
protected AbstractDelegateEditorAction(EditorActionHandler handler, @NotNull EditorAction origAction) {
|
||||
this(handler);
|
||||
setOrigAction(origAction);
|
||||
}
|
||||
|
||||
public void setOrigAction(AnAction origAction) {
|
||||
public void setOrigAction(@NotNull AnAction origAction) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("origAction=" + origAction);
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -35,7 +36,7 @@ public class ExEntryAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
|
||||
CommandGroups.getInstance().getProcess().startExCommand(editor, context, cmd);
|
||||
|
||||
return true;
|
||||
|
@@ -22,9 +22,10 @@ package com.maddyhome.idea.vim.action;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class OriginalDelegateAction extends AbstractDelegateAction {
|
||||
public void actionPerformed(AnActionEvent event) {
|
||||
public void actionPerformed(@NotNull AnActionEvent event) {
|
||||
Editor editor = event.getData(PlatformDataKeys.EDITOR);
|
||||
if (editor != null) {
|
||||
getOrigAction().actionPerformed(event);
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.KeyHandler;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
@@ -34,7 +35,7 @@ public class PassThruDelegateAction extends AbstractDelegateAction {
|
||||
this.stroke = stroke;
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent event) {
|
||||
public void actionPerformed(@NotNull AnActionEvent event) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("actionPerformed key=" + stroke);
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class RedoAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(Editor editor, @NotNull DataContext context, Command cmd) {
|
||||
return UndoRedoHelper.redo(context);
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.key.KeyParser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -38,7 +39,7 @@ public class RepeatChangeAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, Command command) {
|
||||
public boolean execute(Editor editor, @NotNull DataContext context, @NotNull Command command) {
|
||||
CommandState state = CommandState.getInstance(editor);
|
||||
Command cmd = state.getLastChangeCommand();
|
||||
if (cmd != null) {
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.ex.CommandParser;
|
||||
import com.maddyhome.idea.vim.ex.ExException;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class RepeatExCommandAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, Command command) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command command) {
|
||||
int count = command.getCount();
|
||||
try {
|
||||
return CommandParser.getInstance().processLastCommand(editor, context, count);
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.UndoRedoHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class UndoAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(Editor editor, @NotNull DataContext context, Command cmd) {
|
||||
return UndoRedoHelper.undo(context);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class ChangeCaseLowerMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_LOWER, argument);
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -37,8 +38,9 @@ public class ChangeCaseLowerVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(InjectedLanguageUtil.getTopLevelEditor(editor), context, range, CharacterHelper.CASE_LOWER);
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(InjectedLanguageUtil.getTopLevelEditor(editor),
|
||||
range, CharacterHelper.CASE_LOWER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class ChangeCaseToggleCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseToggleCharacter(editor, context, count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseToggleCharacter(editor, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class ChangeCaseToggleMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_TOGGLE, argument);
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -36,8 +37,8 @@ public class ChangeCaseToggleVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_TOGGLE);
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, range, CharacterHelper.CASE_TOGGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class ChangeCaseUpperMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_UPPER, argument);
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -36,8 +37,8 @@ public class ChangeCaseUpperVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_UPPER);
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, range, CharacterHelper.CASE_UPPER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class ChangeCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCharacter(editor, context, count, argument.getCharacter());
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCharacter(editor, count, argument.getCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ChangeCharactersAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeCharacters(editor, context, count);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ChangeEndOfLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeEndOfLine(editor, context, count);
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import com.maddyhome.idea.vim.ex.LineRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -36,7 +37,7 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
|
||||
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/&");
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.ex.LineRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
int line = editor.getCaretModel().getLogicalPosition().line;
|
||||
LineRange range = new LineRange(line, line);
|
||||
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/");
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ChangeLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeLine(editor, context, count);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ChangeMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeMotion(editor, context, count, rawCount, argument);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class ChangeNumberDecAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeNumber(editor, context, -count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeNumber(editor, -count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class ChangeNumberIncAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeNumber(editor, context, count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeNumber(editor, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ChangeReplaceAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().changeReplace(editor, context);
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import com.maddyhome.idea.vim.command.SelectionType;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -36,7 +37,7 @@ public class ChangeVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
final SelectionType type = range.isMultiple() ? SelectionType.BLOCK_WISE : SelectionType.CHARACTER_WISE;
|
||||
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, type);
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,8 +36,8 @@ public class ChangeVisualCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCharacterRange(editor, context, range,
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd, @NotNull TextRange range) {
|
||||
return CommandGroups.getInstance().getChange().changeCharacterRange(editor, range,
|
||||
cmd.getArgument().getCharacter());
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class ChangeVisualLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd, TextRange range) {
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
|
@@ -28,6 +28,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class ChangeVisualLinesEndAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
if (range.isMultiple()) {
|
||||
int[] starts = range.getStartOffsets();
|
||||
int[] ends = range.getEndOffsets();
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class FilterCountLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
|
||||
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
|
||||
|
||||
return true;
|
||||
|
@@ -28,6 +28,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.group.MotionGroup;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class FilterMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
|
||||
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
|
||||
cmd.getArgument(), false, false);
|
||||
if (range == null) {
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class FilterVisualLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
|
||||
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
|
||||
CommandGroups.getInstance().getMotion().resetVisual(editor, true);
|
||||
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class DeleteCharacterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, 1);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class DeleteCharacterLeftAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, -count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, -count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class DeleteCharacterRightAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class DeleteEndOfLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteEndOfLine(editor, context, count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteEndOfLine(editor, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,12 +35,12 @@ public class DeleteJoinLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, false);
|
||||
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,12 +35,12 @@ public class DeleteJoinLinesSpacesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, true);
|
||||
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, count, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,12 +36,12 @@ public class DeleteJoinVisualLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, false);
|
||||
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, range, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,12 +36,12 @@ public class DeleteJoinVisualLinesSpacesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, true);
|
||||
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, range, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class DeleteLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteLine(editor, context, count);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteLine(editor, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class DeleteMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
return CommandGroups.getInstance().getChange().deleteMotion(editor, context, count, rawCount, argument, false);
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -38,15 +39,15 @@ public class DeleteVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
|
||||
if (mode == CommandState.SubMode.VISUAL_LINE) {
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
SelectionType.fromSubMode(mode));
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
|
||||
SelectionType.fromSubMode(mode), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -38,17 +39,17 @@ public class DeleteVisualLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
|
||||
if (mode == CommandState.SubMode.VISUAL_BLOCK) {
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
SelectionType.fromSubMode(mode));
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
|
||||
SelectionType.fromSubMode(mode), false);
|
||||
}
|
||||
else {
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, SelectionType.LINE_WISE);
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, range, SelectionType.LINE_WISE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class DeleteVisualLinesEndAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
if (range.isMultiple()) {
|
||||
int[] starts = range.getStartOffsets();
|
||||
int[] ends = range.getEndOffsets();
|
||||
@@ -48,15 +49,15 @@ public class DeleteVisualLinesEndAction extends EditorAction {
|
||||
}
|
||||
|
||||
range = new TextRange(starts, ends);
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
SelectionType.BLOCK_WISE);
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
|
||||
SelectionType.BLOCK_WISE, false);
|
||||
}
|
||||
else {
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
SelectionType.LINE_WISE);
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, range,
|
||||
SelectionType.LINE_WISE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertAfterCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().insertAfterCursor(editor, context);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertAfterLineEndAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().insertAfterLineEnd(editor, context);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertAtPreviousInsertAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().insertAtPreviousInsert(editor, context);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertBeforeCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().insertBeforeCursor(editor, context);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertBeforeFirstNonBlankAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().insertBeforeFirstNonBlank(editor, context);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertCharacterAboveCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertCharacterBelowCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class InsertDeleteInsertedTextAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
return CommandGroups.getInstance().getChange().insertDeleteInsertedText(editor, context);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, Command cmd) {
|
||||
return CommandGroups.getInstance().getChange().insertDeleteInsertedText(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class InsertDeletePreviousWordAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
return CommandGroups.getInstance().getChange().insertDeletePreviousWord(editor, context);
|
||||
public boolean execute(@NotNull Editor editor, DataContext context, Command cmd) {
|
||||
return CommandGroups.getInstance().getChange().insertDeletePreviousWord(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,13 +35,8 @@ public class InsertEnterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
editor = InjectedLanguageUtil.getTopLevelEditor(editor);
|
||||
if (editor.isOneLineMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandGroups.getInstance().getChange().processEnter(editor, context);
|
||||
public void execute(Editor editor, @NotNull DataContext context) {
|
||||
CommandGroups.getInstance().getChange().processEnter(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertExitModeAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
CommandGroups.getInstance().getChange().processEscape(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertHelpAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
CommandGroups.getInstance().getChange().insertHelp(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertInsertAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
CommandGroups.getInstance().getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertLineStartAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().insertLineStart(editor, context);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertNewLineAboveAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertNewLineBelowAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertPreviousInsertAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
CommandGroups.getInstance().getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, false);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertPreviousInsertExitAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
|
||||
CommandGroups.getInstance().getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, true);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class InsertRegisterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
|
||||
return CommandGroups.getInstance().getChange().insertRegister(editor, context, cmd.getArgument().getCharacter());
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class InsertSingleCommandAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext context) {
|
||||
CommandGroups.getInstance().getChange().processSingleCommand(InjectedLanguageUtil.getTopLevelEditor(editor), context);
|
||||
public void execute(@NotNull Editor editor, DataContext context) {
|
||||
CommandGroups.getInstance().getChange().processSingleCommand(InjectedLanguageUtil.getTopLevelEditor(editor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class VisualBlockAppendAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class VisualBlockInsertAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, Command cmd, @NotNull TextRange range) {
|
||||
if (editor.isOneLineMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class AutoIndentLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().autoIndentLines(editor, context, count);
|
||||
public boolean execute(Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().autoIndentLines(context);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ShiftLeftLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().indentLines(editor, context, count, -1);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ShiftLeftMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, -1);
|
||||
|
||||
return true;
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class ShiftLeftVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, TextRange range) {
|
||||
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), -1);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ShiftRightLinesAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
CommandGroups.getInstance().getChange().indentLines(editor, context, count, 1);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class ShiftRightMotionAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @NotNull Argument argument) {
|
||||
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, 1);
|
||||
|
||||
return true;
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class ShiftRightVisualAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, TextRange range) {
|
||||
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), 1);
|
||||
|
||||
return true;
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class PutTextAfterCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, false);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class PutTextAfterCursorActionMoveCursor extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, true);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class PutTextAfterCursorNoIndentAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, false, false);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class PutTextBeforeCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, false);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class PutTextBeforeCursorActionMoveCursor extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, true);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class PutTextBeforeCursorNoIndentAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler {
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
|
||||
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, Argument argument) {
|
||||
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, false, false);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class PutVisualTextAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @NotNull TextRange range) {
|
||||
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, false);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class PutVisualTextMoveCursorAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @NotNull TextRange range) {
|
||||
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, true);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public class PutVisualTextNoIndentAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @NotNull TextRange range) {
|
||||
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), false, false);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -36,7 +37,7 @@ public class SelectRegisterAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range) {
|
||||
protected boolean execute(Editor editor, DataContext context, @NotNull Command cmd, TextRange range) {
|
||||
return CommandGroups.getInstance().getRegister().selectRegister(cmd.getArgument().getCharacter());
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -34,8 +35,8 @@ public class YankLineAction extends EditorAction {
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler {
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd) {
|
||||
return CommandGroups.getInstance().getCopy().yankLine(editor, context, cmd.getCount());
|
||||
protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
|
||||
return CommandGroups.getInstance().getCopy().yankLine(editor, cmd.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user