mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-17 16:31:45 +02:00
Compare commits
202 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4b659fe643 | ||
![]() |
d5055506b0 | ||
![]() |
55f54b2e82 | ||
![]() |
1b18065e68 | ||
![]() |
053dc02152 | ||
![]() |
b8cb4a1295 | ||
![]() |
cd2cbf68a1 | ||
![]() |
73f3be8af0 | ||
![]() |
8cce059fb4 | ||
![]() |
db641ec6f6 | ||
![]() |
9d8239b68d | ||
![]() |
4ec0bac275 | ||
![]() |
613c234cfb | ||
![]() |
83dca71f69 | ||
![]() |
f7ea9cdb6e | ||
![]() |
762cb1804f | ||
![]() |
962cfb7ae2 | ||
![]() |
8415d104e9 | ||
![]() |
abd0f9b961 | ||
![]() |
0a4683d908 | ||
![]() |
4c280b0193 | ||
![]() |
e88a3deafd | ||
![]() |
bd172b3300 | ||
![]() |
95c7a13cb5 | ||
![]() |
b1ddf03385 | ||
![]() |
a83c326736 | ||
![]() |
b1acb56247 | ||
![]() |
caa4731a13 | ||
![]() |
5b0ece7a91 | ||
![]() |
c8d64e0a06 | ||
![]() |
1a3dea0de6 | ||
![]() |
17b642280e | ||
![]() |
1c1717b78b | ||
![]() |
4bbbdf8108 | ||
![]() |
04a193309d | ||
![]() |
f106ffa176 | ||
![]() |
8d5d099542 | ||
![]() |
4849992ca9 | ||
![]() |
623105650e | ||
![]() |
5e2c01daa6 | ||
![]() |
58bf3a4d30 | ||
![]() |
2d434c38b9 | ||
![]() |
246f5cd8cf | ||
![]() |
5a174d21f1 | ||
![]() |
e632c653f6 | ||
![]() |
174d17b088 | ||
![]() |
3a35c931e4 | ||
![]() |
b768b26c85 | ||
![]() |
123ce6ebaf | ||
![]() |
276c8db512 | ||
![]() |
f898b8d181 | ||
![]() |
e9f9e531e4 | ||
![]() |
a7d813cb86 | ||
![]() |
75b6eedb12 | ||
![]() |
ec6860aa90 | ||
![]() |
5cf661c6ae | ||
![]() |
8c62caae7c | ||
![]() |
cc6fe21af6 | ||
![]() |
1902151efa | ||
![]() |
b7af1e6289 | ||
![]() |
0c77b320db | ||
![]() |
ee41adc4e9 | ||
![]() |
93462d7505 | ||
![]() |
2f5946640e | ||
![]() |
7cdb7dc308 | ||
![]() |
c0038d0373 | ||
![]() |
2820decb5e | ||
![]() |
c64f368e6a | ||
![]() |
b7c8e84f5e | ||
![]() |
5acf6c9158 | ||
![]() |
a8197b0c84 | ||
![]() |
2e03062c24 | ||
![]() |
7fb60a185b | ||
![]() |
0327ea972b | ||
![]() |
561cc77ecc | ||
![]() |
a1ab4acd14 | ||
![]() |
d4939803da | ||
![]() |
730ce3aca9 | ||
![]() |
1893dc6afd | ||
![]() |
6ec39314ee | ||
![]() |
c87528939b | ||
![]() |
e56646105d | ||
![]() |
b8a40d93f7 | ||
![]() |
4bfc025248 | ||
![]() |
36f6027b0e | ||
![]() |
e032377e68 | ||
![]() |
929eee4a12 | ||
![]() |
61ce50264a | ||
![]() |
48927b1207 | ||
![]() |
0820893dc6 | ||
![]() |
dd6079cfa6 | ||
![]() |
3d7d75bae4 | ||
![]() |
6da4d0ce5e | ||
![]() |
4994d70b1a | ||
![]() |
c873081dc3 | ||
![]() |
070237f77f | ||
![]() |
eb01b25f35 | ||
![]() |
c0c9cfaf86 | ||
![]() |
304f860eb2 | ||
![]() |
2f18b25593 | ||
![]() |
14c8b6a248 | ||
![]() |
adaa683e58 | ||
![]() |
9b71215cde | ||
![]() |
8be572f976 | ||
![]() |
4f43bcffb9 | ||
![]() |
29e4dc5fb5 | ||
![]() |
0dc95cb13c | ||
![]() |
5ee0a93675 | ||
![]() |
767b3c4a39 | ||
![]() |
bb948a463c | ||
![]() |
e4e9a03d0a | ||
![]() |
50ba386f59 | ||
![]() |
79d0565c2d | ||
![]() |
bcc9b0a7b1 | ||
![]() |
2c8f4940b9 | ||
![]() |
41876cf8fd | ||
![]() |
f6fd0b52f0 | ||
![]() |
843faa7cc6 | ||
![]() |
a8af2c3242 | ||
![]() |
e5bfad974e | ||
![]() |
59d87e0c94 | ||
![]() |
50c2d04503 | ||
![]() |
480de62686 | ||
![]() |
955b501058 | ||
![]() |
d985527624 | ||
![]() |
afbe7f0e69 | ||
![]() |
94e65ddce6 | ||
![]() |
cb9f144255 | ||
![]() |
ac84624faa | ||
![]() |
c2196785e7 | ||
![]() |
30097fbae6 | ||
![]() |
c295dd5c62 | ||
![]() |
373fef2824 | ||
![]() |
cfc255bf2b | ||
![]() |
ea7e58535b | ||
![]() |
ea342a8e4f | ||
![]() |
0b67dd1d05 | ||
![]() |
1519faef81 | ||
![]() |
9fad4a74ed | ||
![]() |
24f023c8b3 | ||
![]() |
3eb46114f8 | ||
![]() |
6a5fd30531 | ||
![]() |
96e83150e5 | ||
![]() |
b2b65c65b9 | ||
![]() |
5b028b4fa3 | ||
![]() |
8f4e1b3409 | ||
![]() |
ff209d0120 | ||
![]() |
ea2fe618b5 | ||
![]() |
3403cdf84b | ||
![]() |
4f9a6f3a7b | ||
![]() |
c8d6d233e5 | ||
![]() |
0cfb65a19a | ||
![]() |
384d917021 | ||
![]() |
f1c8c67789 | ||
![]() |
75e8f4ec6d | ||
![]() |
d1d0323112 | ||
![]() |
ab31dae582 | ||
![]() |
64f176cedb | ||
![]() |
9e921d6621 | ||
![]() |
a4b98f2848 | ||
![]() |
0d190e4a63 | ||
![]() |
13cdb7cc35 | ||
![]() |
ca60c467f3 | ||
![]() |
01abba7d2c | ||
![]() |
80074177fc | ||
![]() |
bf67f8984a | ||
![]() |
b2267c4b6c | ||
![]() |
c80d69a31c | ||
![]() |
1b7c3f0da3 | ||
![]() |
7b225cb824 | ||
![]() |
562e0b06df | ||
![]() |
51ce064507 | ||
![]() |
ebaeff9b4d | ||
![]() |
8889e799ca | ||
![]() |
668705e475 | ||
![]() |
e428e909bf | ||
![]() |
d755c751c2 | ||
![]() |
312c547412 | ||
![]() |
48d30f2a3c | ||
![]() |
d8ed30df14 | ||
![]() |
50176cb267 | ||
![]() |
5898d21857 | ||
![]() |
e3839bc0b2 | ||
![]() |
f97555d4a8 | ||
![]() |
79bdca9769 | ||
![]() |
138c2956ac | ||
![]() |
ced457dd94 | ||
![]() |
784fc6c6fa | ||
![]() |
f817e6cb7f | ||
![]() |
6a622565ca | ||
![]() |
23126aeb6d | ||
![]() |
61fd67472b | ||
![]() |
105c073e1f | ||
![]() |
200f3484b6 | ||
![]() |
6a40eb48fe | ||
![]() |
fb3e9ce9f3 | ||
![]() |
91865460a2 | ||
![]() |
644afe541e | ||
![]() |
232303f06a | ||
![]() |
280845610b | ||
![]() |
6108c9d6d2 | ||
![]() |
ce04e995ee |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,6 +1,10 @@
|
||||
*.swp
|
||||
/.gradle/
|
||||
|
||||
/.idea/
|
||||
!/.idea/scopes
|
||||
!/.idea/copyright
|
||||
|
||||
/build/
|
||||
/out/
|
||||
/tmp/
|
6
.idea/copyright/IdeaVim.xml
generated
Normal file
6
.idea/copyright/IdeaVim.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="IdeaVim - Vim emulator for IDEs based on the IntelliJ platform Copyright (C) 2003-&#36;today.year The IdeaVim authors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>." />
|
||||
<option name="myName" value="IdeaVim" />
|
||||
</copyright>
|
||||
</component>
|
7
.idea/copyright/profiles_settings.xml
generated
Normal file
7
.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings>
|
||||
<module2copyright>
|
||||
<element module="Copyright" copyright="IdeaVim" />
|
||||
</module2copyright>
|
||||
</settings>
|
||||
</component>
|
3
.idea/scopes/Copyright.xml
generated
Normal file
3
.idea/scopes/Copyright.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="Copyright" pattern="file[IdeaVIM.main]:com//*||file[IdeaVIM.test]:*/" />
|
||||
</component>
|
20
AUTHORS.md
20
AUTHORS.md
@@ -271,6 +271,26 @@ Contributors:
|
||||
[![icon][github]](https://github.com/igrekster)
|
||||
|
||||
igrekster
|
||||
* [![icon][mail]](mailto:lokomot476@gmail.com)
|
||||
[![icon][github]](https://github.com/fan-tom)
|
||||
|
||||
Alexey Gerasimov
|
||||
* [![icon][mail]](mailto:a.grison+github@gmail.com)
|
||||
[![icon][github]](https://github.com/agrison)
|
||||
|
||||
Alexandre Grison
|
||||
* [![icon][mail]](mailto:angel@knight-industries.com)
|
||||
[![icon][github]](https://github.com/angelbot)
|
||||
|
||||
John Weigel
|
||||
* [![icon][mail]](mailto:kevinz@weghst.com)
|
||||
[![icon][github]](https://github.com/kevin70)
|
||||
|
||||
kk
|
||||
* [![icon][mail]](mailto:runforprogram@163.com)
|
||||
[![icon][github]](https://github.com/runforprogram)
|
||||
|
||||
runforprogram
|
||||
|
||||
If you are a contributor and your name is not listed here, feel free to
|
||||
contact the maintainers.
|
||||
|
46
CHANGES.md
46
CHANGES.md
@@ -3,6 +3,12 @@ The Changelog
|
||||
|
||||
History of changes in IdeaVim for the IntelliJ platform.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project DOES NOT adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
Stable versions use X.Y format.
|
||||
EAP versions use X.Y.Z format.
|
||||
|
||||
|
||||
Get an Early Access
|
||||
-------------------
|
||||
@@ -16,6 +22,45 @@ It is important to distinguish EAP from traditional pre-release software.
|
||||
Please note that the quality of EAP versions may at times be way below even
|
||||
usual beta standards.
|
||||
|
||||
0.57, 2020-04-28
|
||||
-------------
|
||||
|
||||
**Fixes:**
|
||||
* [VIM-1992](https://youtrack.jetbrains.com/issue/VIM-1992) Fix mappings to `<S-Letter>`
|
||||
* [VIM-1991](https://youtrack.jetbrains.com/issue/VIM-1991) Fix working with number registers
|
||||
|
||||
**Merged PRs:**
|
||||
* [234](https://github.com/JetBrains/ideavim/pull/234) by [runforprogram](https://github.com/runforprogram): [VIM-1991] fix >0 number register not work
|
||||
|
||||
0.56, 2020-04-09
|
||||
--------------
|
||||
|
||||
**Features:**
|
||||
* `ReplaceWithRegister` plugin emulation ([ReplaceWithRegister](https://www.vim.org/scripts/script.php?script_id=2703)).
|
||||
* `argtextobj.vim` plugin emulation ([argtextobj.vim](https://vim.sourceforge.io/scripts/script.php?script_id=2699)).
|
||||
* `vim-textobj-entire` plugin emulation ([vim-textobj-entire](https://github.com/kana/vim-textobj-entire)).
|
||||
* [VIM-434](https://youtrack.jetbrains.com/issue/VIM-434) Add `'showcmd'` support, on by default.
|
||||
* Support `ls/buffers/files` commands.
|
||||
|
||||
**Changes:**
|
||||
* Replace `ideastatusbar` option with `ideastatusicon`. Now you can make the icon gray.
|
||||
|
||||
**Deprecations:**
|
||||
* `ideastatusbar` option is deprecated now. See `ideastatusicon`.
|
||||
|
||||
**Fixes:**
|
||||
* [VIM-1284](https://youtrack.jetbrains.com/issue/VIM-1284) Fix mapping of digits.
|
||||
* Fix handling of counts on both operator and motion, e.g. `3d2w` deletes 6 words, instead of 32.
|
||||
* Allow mapping of `<C-K>` and `<C-V>`/`<C-Q>`.
|
||||
* [VIM-1899](https://youtrack.jetbrains.com/issue/VIM-1899) Add argument to `:registers` command.
|
||||
* [VIM-1835](https://youtrack.jetbrains.com/issue/VIM-1835) Macros record input keystrokes instead of mapped keystrokes.
|
||||
* [VIM-1900](https://youtrack.jetbrains.com/issue/VIM-1900) Ensure non-printable output for `:registers`, `:marks` and `:jumps` is encoded correctly.
|
||||
* [VIM-570](https://youtrack.jetbrains.com/issue/VIM-570) Print non-ascii characters in ex panel.
|
||||
* [VIM-926](https://youtrack.jetbrains.com/issue/VIM-926) Fix `<S-Space>` mapping.
|
||||
* [VIM-1958](https://youtrack.jetbrains.com/issue/VIM-1958) Fix `X` command for linewise selection.
|
||||
* [VIM-1911](https://youtrack.jetbrains.com/issue/VIM-1911) Lookup keys respect `IDE` handler.
|
||||
* [VIM-1008](https://youtrack.jetbrains.com/issue/VIM-1008) Correct `ci{` behavior.
|
||||
|
||||
0.55, 2020-01-20
|
||||
--------------
|
||||
|
||||
@@ -45,6 +90,7 @@ usual beta standards.
|
||||
* [VIM-1874](https://youtrack.jetbrains.com/issue/VIM-1874) Fix `set clipboard=unnamed` execution from `~/.ideavimrc`
|
||||
* [VIM-1878](https://youtrack.jetbrains.com/issue/VIM-1878) Fix `c` command after extract method action
|
||||
* [VIM-1884](https://youtrack.jetbrains.com/issue/VIM-1884) Show quickDoc during popup with `CTRL-J`
|
||||
* [VIM-987](https://youtrack.jetbrains.com/issue/VIM-987) Fix arrow keys for the NEO keyboard
|
||||
|
||||
0.54, 2019-11-20
|
||||
--------------
|
||||
|
@@ -16,6 +16,18 @@
|
||||
</a>
|
||||
<span>2019.2 Tests</span>
|
||||
</div>
|
||||
<div>
|
||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20193&guest=1">
|
||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20193)/statusIcon.svg?guest=1"/>
|
||||
</a>
|
||||
<span>2019.3 Tests</span>
|
||||
</div>
|
||||
<div>
|
||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20201&guest=1">
|
||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20201)/statusIcon.svg?guest=1"/>
|
||||
</a>
|
||||
<span>2020.1 Tests</span>
|
||||
</div>
|
||||
|
||||
|
||||
### Where to Start
|
||||
@@ -67,36 +79,6 @@ in the issue tracker.
|
||||
* You can install this file by selecting "Settings | Plugins | Install plugin
|
||||
from disk...".
|
||||
|
||||
### Copyright
|
||||
|
||||
1. Go to `Preferences | Appearance & Behavior | Scopes`, press "+" button, `Shared`.
|
||||
Name: Copyright scope
|
||||
Pattern: `file[IdeaVIM.main]:com//*||file[IdeaVIM.test]:*/`
|
||||
|
||||
2. Go to `Preferences | Editor | Copyright | Copyright Profiles` and click the "+" button.
|
||||
Name: IdeaVim
|
||||
Text:
|
||||
|
||||
IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
Copyright (C) 2003-$today.year The IdeaVim authors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
3. Go to `Preferences | Editor | Copyright`, click the "+" button.
|
||||
Scope: Copyright scope
|
||||
Copyright: IdeaVim
|
||||
|
||||
### Testing
|
||||
|
||||
1. Read about the `@VimBehaviorDiffers` annotation.
|
||||
|
105
README.md
105
README.md
@@ -7,8 +7,8 @@ IdeaVim
|
||||
<a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
|
||||
<img src="https://jb.gg/badges/official.svg" alt="official JetBrains project"/>
|
||||
</a>
|
||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20191&guest=1">
|
||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20191)/statusIcon.svg?guest=1"/>
|
||||
<a href="https://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20201&guest=1">
|
||||
<img src="https://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20201)/statusIcon.svg?guest=1" alt="TeamCity Build"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -25,23 +25,20 @@ Resources:
|
||||
* [@IdeaVim](https://twitter.com/ideavim) in Twitter
|
||||
|
||||
|
||||
Installation
|
||||
Setup
|
||||
------------
|
||||
|
||||
Use the IDE's plugin manager to install the latest version of the plugin.
|
||||
Start the IDE normally and enable the Vim emulation using "Tools | Vim
|
||||
Emulator" menu item. At this point you must use Vim keystrokes in all editors.
|
||||
- IdeaVim can be installed via `Settings | Plugins`.
|
||||
See [detailed instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#).
|
||||
|
||||
If you wish to disable the plugin, select the "Tools | Vim Emulator" menu so
|
||||
it is unchecked. At this point your IDE will work with its regular keyboard
|
||||
shortcuts.
|
||||
- Use `Tools | Vim Emulator` to enable or disable emulation.
|
||||
|
||||
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
|
||||
resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
|
||||
Keymap" on Linux & Windows, and via "Preferences | Editor | Vim Emulation",
|
||||
"Preferences | Keymap" on macOS. They can also be resolved by key-mapping
|
||||
commands in your ~/.ideavimrc file.
|
||||
- Use `~/.ideavimrc` file as an analog of `~/.vimrc` ([details](#Files)). XGD standard is supported as well.
|
||||
|
||||
- Shortcut conflicts can be resolved using:
|
||||
- Linux & Windows: `File | Settings | Editor | Vim Emulation` & `File | Settings | Keymap`,
|
||||
- macOS: `Preferences | Editor | Vim Emulation` & `Preferences | Keymap`,
|
||||
- regular vim mappings in the `~/.ideavimrc` file.
|
||||
|
||||
Get Early Access
|
||||
-------------------
|
||||
@@ -49,7 +46,9 @@ Get Early Access
|
||||
Would you like to try new features and fixes? Join the Early Access Program and
|
||||
receive EAP builds as updates!
|
||||
|
||||
1. Click the IdeaVim icon in the status bar | `EAP` | `Get Early Access...`
|
||||
1. Click the IdeaVim icon <img src="resources/META-INF/pluginIcon_noBorders.svg" width="16" height="16" alt="icon"/>
|
||||
in the status bar | `EAP` | `Get Early Access...`
|
||||
|
||||
|
||||
Or subscribe to EAP updates manually:
|
||||
|
||||
@@ -57,7 +56,7 @@ Or subscribe to EAP updates manually:
|
||||
2. Click the gear icon :gear:, select `Manage Plugin Repositories`, and add the following url:
|
||||
`https://plugins.jetbrains.com/plugins/eap/ideavim`
|
||||
|
||||
See [the changelog](CHANGES.md) for the list of hot unreleased features.
|
||||
See [the changelog](CHANGES.md) for the list of unreleased features.
|
||||
|
||||
It is important to distinguish EAP builds from traditional pre-release software.
|
||||
Please note that the quality of EAP versions may at times be way below even
|
||||
@@ -91,11 +90,15 @@ Supported:
|
||||
* Vim web help
|
||||
* Select mode
|
||||
|
||||
Emulated Vim plugins:
|
||||
[Emulated Vim plugins](doc/emulated-plugins.md):
|
||||
|
||||
* vim-easymotion
|
||||
* vim-surround
|
||||
* vim-multiple-cursors
|
||||
* vim-commentary
|
||||
* argtextobj.vim
|
||||
* vim-textobj-entire
|
||||
* ReplaceWithRegister
|
||||
|
||||
Not supported (yet):
|
||||
|
||||
@@ -111,19 +114,19 @@ See also:
|
||||
Files
|
||||
-----
|
||||
|
||||
* ~/.ideavimrc
|
||||
* `~/.ideavimrc`
|
||||
* Your IdeaVim-specific Vim initialization commands
|
||||
|
||||
You can read your ~/.vimrc file from ~/.ideavimrc with this command:
|
||||
You can read your `~/.vimrc` file from `~/.ideavimrc` with this command:
|
||||
|
||||
source ~/.vimrc
|
||||
|
||||
Note, that IdeaVim currently parses ~/.ideavimrc file via simple pattern matching.
|
||||
Note, that IdeaVim currently parses `~/.ideavimrc` file via simple pattern matching.
|
||||
See [VIM-669](https://youtrack.jetbrains.com/issue/VIM-669) for proper parsing
|
||||
of VimL files.
|
||||
|
||||
Also note that if you have overridden the `user.home` JVM option, this
|
||||
will affect where IdeaVim looks for your .ideavimrc file. For example, if you
|
||||
will affect where IdeaVim looks for your `.ideavimrc` file. For example, if you
|
||||
have `-Duser.home=/my/alternate/home` then IdeaVim will source
|
||||
`/my/alternate/home/.ideavimrc` instead of `~/.ideavimrc`.
|
||||
|
||||
@@ -134,40 +137,25 @@ Put your settings to `$XDG_CONFIG_HOME$/ideavim/ideavimrc` file.
|
||||
Emulated Vim Plugins
|
||||
--------------------
|
||||
|
||||
IdeaVim extensions emulate some plugins of the original Vim. In order to use
|
||||
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
|
||||
|
||||
set <extension-name>
|
||||
|
||||
Available extensions:
|
||||
|
||||
* easymotion
|
||||
* Setup:
|
||||
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
|
||||
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
|
||||
* `set easymotion`
|
||||
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
|
||||
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
|
||||
|
||||
* surround
|
||||
* Setup: `set surround`
|
||||
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
|
||||
* Commands: `ys`, `cs`, `ds`, `S`
|
||||
|
||||
* multiple-cursors
|
||||
* Setup: `set multiple-cursors`
|
||||
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
|
||||
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
||||
|
||||
* commentary
|
||||
* Setup: `set commentary`
|
||||
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
|
||||
* Commands: `gcc`, `gc + motion`, `v_gc`
|
||||
|
||||
See [doc/emulated-plugins.md](doc/emulated-plugins.md)
|
||||
|
||||
Changes to the IDE
|
||||
------------------
|
||||
|
||||
### Executing IDE Actions
|
||||
|
||||
IdeaVim adds two commands for listing and executing arbitrary IDE actions as
|
||||
Ex commands or via `:map` command mappings:
|
||||
|
||||
* `:actionlist [pattern]`
|
||||
* Find IDE actions by name or keymap pattern (E.g. `:actionlist extract`, `:actionlist <C-D`)
|
||||
* `:action {name}`
|
||||
* Execute an action named `NAME`
|
||||
|
||||
For example, here `\r` is mapped to the Reformat Code action:
|
||||
|
||||
:map \r :action ReformatCode<CR>
|
||||
|
||||
### Undo/Redo
|
||||
|
||||
The IdeaVim plugin uses the undo/redo functionality of the IntelliJ Platform,
|
||||
@@ -186,21 +174,6 @@ improvement.
|
||||
|
||||
See also [unresolved escape issues](https://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+Help+topic%3A+i_Esc).
|
||||
|
||||
### Executing IDE Actions
|
||||
|
||||
IdeaVim adds two commands for listing and executing arbitrary IDE actions as
|
||||
Ex commands or via `:map` command mappings:
|
||||
|
||||
* `:actionlist [pattern]`
|
||||
* Find IDE actions by name or keymap pattern (E.g. `:actionlist extract`, `:actionlist <C-D`)
|
||||
* `:action {name}`
|
||||
* Execute an action named `NAME`
|
||||
|
||||
For example, here `\r` is mapped to the Reformat Code action:
|
||||
|
||||
:map \r :action ReformatCode<CR>
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
|
49
build.gradle
49
build.gradle
@@ -9,7 +9,7 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.jetbrains.intellij' version '0.4.9'
|
||||
id 'org.jetbrains.intellij' version '0.4.18'
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
@@ -56,7 +56,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
|
||||
compileOnly "org.jetbrains:annotations:17.0.0"
|
||||
compileOnly "org.jetbrains:annotations:19.0.0"
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -74,15 +74,56 @@ tasks.register("slackEapNotification") {
|
||||
doLast {
|
||||
if (!slackUrl) return
|
||||
def post = new URL(slackUrl).openConnection()
|
||||
def message = "{\"text\":\"New EAP released: $version\"}"
|
||||
def changeLog = extractChangelog()
|
||||
changeLog = changeLog.replace("* ", "• ") // Replace stars with bullets
|
||||
changeLog = changeLog.replace("**", "*") // Enable bold text
|
||||
changeLog = changeLog.replaceAll("\\[([^]]+)]\\(([^)]+)\\)", '<$2|$1>') // Enable links
|
||||
def message ="""
|
||||
{
|
||||
"text": "New version of IdeaVim",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "section",
|
||||
"text": {
|
||||
"type": "mrkdwn",
|
||||
"text": "IdeaVim EAP $version has been relesed\\n$changeLog"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
post.setRequestMethod("POST")
|
||||
post.setDoOutput(true)
|
||||
post.setRequestProperty("Content-Type", "application/json")
|
||||
post.getOutputStream().write(message.getBytes("UTF-8"))
|
||||
def postRC = post.getResponseCode()
|
||||
println(postRC)
|
||||
if(postRC.equals(200)) {
|
||||
if(postRC == 200) {
|
||||
println(post.getInputStream().getText())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Very primitive changelog extraction code
|
||||
def extractChangelog() {
|
||||
def startLine = "_Available since $version EAP:_"
|
||||
def endLine = "_To Be Released..._"
|
||||
def startSaving = false
|
||||
def res = new StringBuilder()
|
||||
new File("./CHANGES.md").eachLine { line ->
|
||||
if (startSaving) {
|
||||
if (line == endLine) {
|
||||
startSaving = false
|
||||
}
|
||||
else {
|
||||
res.append(line).append('\n')
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (line == startLine) {
|
||||
startSaving = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.toString()
|
||||
}
|
62
doc/emulated-plugins.md
Normal file
62
doc/emulated-plugins.md
Normal file
@@ -0,0 +1,62 @@
|
||||
Emulated Vim Plugins
|
||||
--------------------
|
||||
|
||||
IdeaVim extensions emulate plugins of the original Vim. In order to use
|
||||
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
|
||||
|
||||
set <extension-name>
|
||||
|
||||
Available extensions:
|
||||
|
||||
## easymotion
|
||||
|
||||
* Setup:
|
||||
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
|
||||
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
|
||||
* `set easymotion`
|
||||
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
|
||||
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
|
||||
|
||||
## surround
|
||||
|
||||
* Setup: `set surround`
|
||||
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
|
||||
* Commands: `ys`, `cs`, `ds`, `S`
|
||||
|
||||
## multiple-cursors
|
||||
|
||||
* Setup: `set multiple-cursors`
|
||||
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
|
||||
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
||||
|
||||
## commentary
|
||||
|
||||
* Setup: `set commentary`
|
||||
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
|
||||
* Commands: `gcc`, `gc + motion`, `v_gc`
|
||||
|
||||
## ReplaceWithRegister
|
||||
|
||||
* Setup: `set ReplaceWithRegister`
|
||||
* Emulates [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister)
|
||||
* Commands: `gr`, `grr`
|
||||
|
||||
## argtextobj
|
||||
|
||||
* Setup:
|
||||
* `set argtextobj`
|
||||
* By default, only the arguments inside parenthesis are considered. To extend the functionality
|
||||
to other types of brackets, set `g:argtextobj_pairs` variable to a comma-separated
|
||||
list of colon-separated pairs (same as VIM's `matchpairs` option), like
|
||||
`let g:argtextobj_pairs="(:),{:},<:>"`. The order of pairs matters when
|
||||
handling symbols that can also be operators: `func(x << 5, 20) >> 17`. To handle
|
||||
this syntax parenthesis, must come before angle brackets in the list.
|
||||
* Emulates [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699)
|
||||
* Additional text objects: `aa`, `ia`
|
||||
|
||||
## textobj-entire
|
||||
|
||||
* Setup: `set textobj-entire`
|
||||
* Emulates [vim-textobj-entire](https://github.com/kana/vim-textobj-entire)
|
||||
* Additional text objects: `ae`, `ie`
|
||||
|
@@ -65,6 +65,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
||||
same as ideaselection - IdeaVim ONLY
|
||||
|
||||
'showmode' 'smd' message on the status line to show current mode
|
||||
'showcmd' 'sc' show (partial) command in the status bar
|
||||
'sidescroll' 'ss' minimum number of columns to scroll horizontally
|
||||
'sidescrolloff' 'siso' min. number of columns to left and right of cursor
|
||||
'smartcase' 'scs' no ignore case when pattern is uppercase
|
||||
@@ -104,10 +105,22 @@ The following `:set` commands can appear in `~/.ideavimrc` or be set manually in
|
||||
See wiki/`ideajoin` examples
|
||||
|
||||
`ideastatusbar` `ideastatusbar` Boolean (default true)
|
||||
DEPRECATED. Please use `ideastatusicon`
|
||||
|
||||
If false, IdeaVim icon won't be shown in the status bar.
|
||||
Works only from `~/.ideavimrc` after the IDE restart.
|
||||
|
||||
`ideastatusicon` `ideastatusicon` String(default "enabled")
|
||||
|
||||
Define the behavior of IdeaVim icon in the status bar.
|
||||
|
||||
Use one of the following values:
|
||||
- enabled - icon is shown in the status bar
|
||||
- gray - use the gray version of the icon
|
||||
- disabled - hide the icon
|
||||
|
||||
Works only from `~/.ideavimrc` after the IDE restart.
|
||||
|
||||
`lookupkeys` `lookupkeys` List of strings
|
||||
|
||||
List of keys that should be processed by the IDE during the active lookup (autocompletion).
|
||||
|
@@ -1,11 +1,11 @@
|
||||
# suppress inspection "UnusedProperty" for whole file
|
||||
|
||||
ideaVersion=2019.3
|
||||
ideaVersion=2020.1
|
||||
downloadIdeaSources=true
|
||||
instrumentPluginCode=true
|
||||
version=SNAPSHOT
|
||||
javaVersion=1.8
|
||||
kotlinVersion=1.3.61
|
||||
kotlinVersion=1.3.71
|
||||
publishUsername=username
|
||||
publishToken=token
|
||||
publishChannels=eap
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
#Fri Nov 22 14:42:01 MSK 2019
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||
#Fri Apr 10 10:57:10 MSK 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
|
22
gradlew
vendored
22
gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m"'
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -109,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m"
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
@@ -197,6 +197,8 @@
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertSingleCommandAction" mappingModes="I" keys="«C-O»"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.VisualBlockInsertAction" mappingModes="X" keys="I"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.VisualBlockAppendAction" mappingModes="X" keys="A"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertCompletedDigraphAction" mappingModes="IC" keys="«C-K»"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.insert.InsertCompletedLiteralAction" mappingModes="IC" keys="«C-V»,«C-Q»"/>
|
||||
|
||||
<!-- Delete -->
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.change.delete.DeleteCharacterAction" mappingModes="N" keys="«DEL»"/>
|
||||
@@ -258,14 +260,16 @@
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorNoIndentAction" mappingModes="N" keys="[P,]P,[p"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextAfterCursorActionMoveCursor" mappingModes="N" keys="gp"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutTextBeforeCursorActionMoveCursor" mappingModes="N" keys="gP"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.SelectRegisterAction" mappingModes="NXO" keys='"'/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankLineAction" mappingModes="N" keys="Y"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankMotionAction" mappingModes="N" keys="y"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualAction" mappingModes="X" keys="y"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.YankVisualLinesAction" mappingModes="X" keys="Y"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextAction" mappingModes="X" keys="p,P"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextNoIndentAction" mappingModes="X" keys="[p,]p,]P,[P"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextMoveCursorAction" mappingModes="X" keys="gp,gP"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextBeforeCursorAction" mappingModes="X" keys="P"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorAction" mappingModes="X" keys="p"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextBeforeCursorNoIndentAction" mappingModes="X" keys="]P,[P"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction" mappingModes="X" keys="[p,]p"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextBeforeCursorMoveCursorAction" mappingModes="X" keys="gP"/>
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorMoveCursorAction" mappingModes="X" keys="gp"/>
|
||||
|
||||
<!-- File -->
|
||||
<vimAction implementation="com.maddyhome.idea.vim.action.file.FileSaveCloseAction" mappingModes="N" keys="ZQ,ZZ"/>
|
@@ -60,5 +60,6 @@
|
||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.NextTabHandler" names="tabn[ext]"/>
|
||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.PreviousTabHandler" names="tabp[revious],tabN[ext]"/>
|
||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.TabOnlyHandler" names="tabo[nly]"/>
|
||||
<vimExCommand implementation="com.maddyhome.idea.vim.ex.handler.BufferListHandler" names="buffers,ls,files"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
@@ -3,5 +3,8 @@
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.commentary.CommentaryExtension"/>
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.textobjentire.VimTextObjEntireExtension"/>
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.argtextobj.VimArgTextObjExtension"/>
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.replacewithregister.ReplaceWithRegister"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
@@ -3,9 +3,8 @@
|
||||
<id>IdeaVIM</id>
|
||||
<change-notes><![CDATA[
|
||||
<ul>
|
||||
<li>Support dot command for Surround and Commentary extensions</li>
|
||||
<li>Support XDG settings standard</li>
|
||||
<li>Add option to remove the status bar icon</li>
|
||||
<li>Fix mappings for uppercase letters</li>
|
||||
<li>Fix yank/paste with number registers</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>
|
||||
@@ -32,25 +31,19 @@
|
||||
|
||||
<application-components>
|
||||
<component>
|
||||
<implementation-class>com.maddyhome.idea.vim.VimPlugin</implementation-class>
|
||||
</component>
|
||||
<component>
|
||||
<implementation-class>com.maddyhome.idea.vim.VimLocalConfig</implementation-class>
|
||||
<implementation-class>com.maddyhome.idea.vim.DynamicLoaderStopper</implementation-class>
|
||||
</component>
|
||||
</application-components>
|
||||
<project-components>
|
||||
<component>
|
||||
<implementation-class>com.maddyhome.idea.vim.VimProjectComponent</implementation-class>
|
||||
</component>
|
||||
</project-components>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension"/>
|
||||
<extensionPoint name="vimExtension" interface="com.maddyhome.idea.vim.extension.VimExtension" dynamic="true"/>
|
||||
|
||||
<extensionPoint name="vimExCommand" beanClass="com.maddyhome.idea.vim.ex.ExBeanClass">
|
||||
<!-- For internal use only -->
|
||||
<extensionPoint name="vimExCommand" beanClass="com.maddyhome.idea.vim.ex.ExBeanClass" dynamic="true">
|
||||
<with attribute="implementation" implements="com.maddyhome.idea.vim.ex.CommandHandler"/>
|
||||
</extensionPoint>
|
||||
<extensionPoint name="vimAction" beanClass="com.maddyhome.idea.vim.handler.ActionBeanClass">
|
||||
<!-- For internal use only -->
|
||||
<extensionPoint name="vimAction" beanClass="com.maddyhome.idea.vim.handler.ActionBeanClass" dynamic="true">
|
||||
<with attribute="implementation" implements="com.maddyhome.idea.vim.handler.EditorActionHandlerBase"/>
|
||||
</extensionPoint>
|
||||
</extensionPoints>
|
||||
@@ -59,13 +52,19 @@
|
||||
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
||||
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
||||
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.StatusBarIconProvider"/>
|
||||
<statusBarWidgetProvider implementation="com.maddyhome.idea.vim.ui.ShowCmdStatusBarWidget"/>
|
||||
|
||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimLocalConfig"/>
|
||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.VimPlugin"/>
|
||||
|
||||
<postStartupActivity implementation="com.maddyhome.idea.vim.PluginStartup"/>
|
||||
</extensions>
|
||||
|
||||
<xi:include href="/META-INF/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="/META-INF/includes/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<xi:include href="/META-INF/VimActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="/META-INF/VimExCommands.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="/META-INF/VimExtensions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="/META-INF/includes/VimActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="/META-INF/includes/VimExCommands.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="/META-INF/includes/VimExtensions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<actions>
|
||||
<action id="VimPluginToggle" class="com.maddyhome.idea.vim.action.VimPluginToggleAction" text="Vim Emulator" description="Toggle the vim plugin On/off">
|
||||
|
9
resources/META-INF/pluginIcon_noBorders.svg
Normal file
9
resources/META-INF/pluginIcon_noBorders.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
|
||||
<defs>
|
||||
<linearGradient id="ideavim_plugin-a" x1="-6.748%" x2="47.286%" y1="33.61%" y2="85.907%">
|
||||
<stop offset="0%" stop-color="#3BEA62"/>
|
||||
<stop offset="100%" stop-color="#087CFA"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd" points="29.019 0 13.988 26.119 13.988 0 0 0 0 40 16.953 40 40 0"/>
|
||||
</svg>
|
After Width: | Height: | Size: 450 B |
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
# Copyright (C) 2003-2019 The IdeaVim authors
|
||||
# Copyright (C) 2003-2020 The IdeaVim authors
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,17 +18,7 @@
|
||||
|
||||
package com.maddyhome.idea.vim
|
||||
|
||||
import com.intellij.openapi.components.ProjectComponent
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.maddyhome.idea.vim.listener.VimListenerManager
|
||||
|
||||
/**
|
||||
* @author Alex Plate
|
||||
* This class prevents dynamic loading of IdeaVim plugin
|
||||
*/
|
||||
class VimProjectComponent(private val project: Project) : ProjectComponent {
|
||||
override fun projectOpened() {
|
||||
if (!VimPlugin.isEnabled()) return
|
||||
// Project listeners are self-disposable, so there is no need to unregister them on project close
|
||||
VimListenerManager.ProjectListeners.add(project)
|
||||
}
|
||||
}
|
||||
class DynamicLoaderStopper
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -53,16 +53,15 @@ import java.util.Map;
|
||||
* @author vlan
|
||||
*/
|
||||
public class EventFacade {
|
||||
@NotNull private static final EventFacade ourInstance = new EventFacade();
|
||||
private static final @NotNull EventFacade ourInstance = new EventFacade();
|
||||
|
||||
@Nullable private TypedActionHandler myOriginalTypedActionHandler;
|
||||
private @Nullable TypedActionHandler myOriginalTypedActionHandler;
|
||||
private Map<Project, MessageBusConnection> connections = new HashMap<>();
|
||||
|
||||
private EventFacade() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static EventFacade getInstance() {
|
||||
public static @NotNull EventFacade getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
@@ -193,8 +192,7 @@ public class EventFacade {
|
||||
return connections.get(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TypedAction getTypedAction() {
|
||||
private @NotNull TypedAction getTypedAction() {
|
||||
return EditorActionManager.getInstance().getTypedAction();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
48
src/com/maddyhome/idea/vim/PluginStartup.kt
Normal file
48
src/com/maddyhome/idea/vim/PluginStartup.kt
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim
|
||||
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.StartupActivity
|
||||
import com.maddyhome.idea.vim.listener.VimListenerManager
|
||||
|
||||
/**
|
||||
* @author Alex Plate
|
||||
*
|
||||
* [VERSION UPDATE] 193+ Use StartupActivity.DumbAware
|
||||
*/
|
||||
class PluginStartup : StartupActivity, DumbAware {
|
||||
|
||||
private var firstInitializationOccurred = false
|
||||
|
||||
override fun runActivity(project: Project) {
|
||||
if (firstInitializationOccurred && VimPlugin.isEnabled()) {
|
||||
// This code should be executed on every project open
|
||||
// Project listeners are self-disposable, so there is no need to unregister them on project close
|
||||
VimListenerManager.ProjectListeners.add(project)
|
||||
}
|
||||
|
||||
if (firstInitializationOccurred) return
|
||||
firstInitializationOccurred = true
|
||||
|
||||
// This code should be executed once
|
||||
VimPlugin.getInstance().initialize()
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointListener;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.maddyhome.idea.vim.group.KeyGroup;
|
||||
import com.maddyhome.idea.vim.handler.ActionBeanClass;
|
||||
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
|
||||
import com.maddyhome.idea.vim.key.Shortcut;
|
||||
import com.maddyhome.idea.vim.key.MappingOwner;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -32,32 +34,61 @@ public class RegisterActions {
|
||||
|
||||
public static final ExtensionPointName<ActionBeanClass> VIM_ACTIONS_EP =
|
||||
ExtensionPointName.create("IdeaVIM.vimAction");
|
||||
private static boolean actionsRegistered = false;
|
||||
private static boolean initialRegistration = false;
|
||||
|
||||
static {
|
||||
// IdeaVim doesn't support contribution to VIM_ACTIONS_EP extension point, so technically we can skip this update,
|
||||
// but let's support dynamic plugins in a more classic way and reload actions on every EP change.
|
||||
// TODO: [VERSION UPDATE] since 191 use
|
||||
// ExtensionPoint.addExtensionPointListener(ExtensionPointListener<T>, boolean, Disposable)
|
||||
// TODO: [VERSION UPDATE] since 201 use
|
||||
// ExtensionPoint.addExtensionPointListener(ExtensionPointChangeListener, boolean, Disposable)
|
||||
VIM_ACTIONS_EP.getPoint(null).addExtensionPointListener(new ExtensionPointListener<ActionBeanClass>() {
|
||||
@Override
|
||||
public void extensionAdded(@NotNull ActionBeanClass extension, PluginDescriptor pluginDescriptor) {
|
||||
// Suppress listener before the `VimPlugin.turnOn()` function execution. This logic should be rewritten after
|
||||
// version update (or earlier).
|
||||
if (!initialRegistration) return;
|
||||
unregisterActions();
|
||||
registerActions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extensionRemoved(@NotNull ActionBeanClass extension, PluginDescriptor pluginDescriptor) {
|
||||
if (!initialRegistration) return;
|
||||
unregisterActions();
|
||||
registerActions();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all the key/action mappings for the plugin.
|
||||
*/
|
||||
static void registerActions() {
|
||||
if (actionsRegistered) return;
|
||||
actionsRegistered = true;
|
||||
|
||||
public static void registerActions() {
|
||||
registerVimCommandActions();
|
||||
registerEmptyShortcuts();
|
||||
initialRegistration = true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static EditorActionHandlerBase findAction(@NotNull String id) {
|
||||
public static @Nullable EditorActionHandlerBase findAction(@NotNull String id) {
|
||||
return VIM_ACTIONS_EP.extensions().filter(vimActionBean -> vimActionBean.getActionId().equals(id)).findFirst()
|
||||
.map(ActionBeanClass::getAction).orElse(null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static EditorActionHandlerBase findActionOrDie(@NotNull String id) {
|
||||
public static @NotNull EditorActionHandlerBase findActionOrDie(@NotNull String id) {
|
||||
EditorActionHandlerBase action = findAction(id);
|
||||
if (action == null) throw new RuntimeException("Action " + id + " is not registered");
|
||||
return action;
|
||||
}
|
||||
|
||||
public static void unregisterActions() {
|
||||
KeyGroup keyGroup = VimPlugin.getKeyIfCreated();
|
||||
if (keyGroup != null) {
|
||||
keyGroup.unregisterCommandActions();
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerVimCommandActions() {
|
||||
KeyGroup parser = VimPlugin.getKey();
|
||||
VIM_ACTIONS_EP.extensions().forEach(parser::registerCommandAction);
|
||||
@@ -66,12 +97,8 @@ public class RegisterActions {
|
||||
private static void registerEmptyShortcuts() {
|
||||
final KeyGroup parser = VimPlugin.getKey();
|
||||
|
||||
// Digraph shortcuts are handled directly by KeyHandler#handleKey, so they don't have an action. But we still need to
|
||||
// register the shortcuts or the editor will swallow them. Technically, the shortcuts will be registered as part of
|
||||
// other commands, but it's best to be explicit
|
||||
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_MASK)));
|
||||
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_MASK)));
|
||||
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_MASK)));
|
||||
parser.registerShortcutWithoutAction(new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)));
|
||||
// The {char1} <BS> {char2} shortcut is handled directly by KeyHandler#handleKey, so doesn't have an action. But we
|
||||
// still need to register the shortcut, to make sure the editor doesn't swallow it.
|
||||
parser.registerShortcutWithoutAction(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), MappingOwner.IdeaVim.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim
|
||||
|
||||
import com.intellij.ide.BrowserUtil
|
||||
@@ -32,6 +50,7 @@ import com.intellij.ui.awt.RelativePoint
|
||||
import com.intellij.util.Consumer
|
||||
import com.intellij.util.text.VersionComparatorUtil
|
||||
import com.maddyhome.idea.vim.group.NotificationService
|
||||
import com.maddyhome.idea.vim.option.IdeaStatusIcon
|
||||
import com.maddyhome.idea.vim.option.OptionsManager
|
||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable
|
||||
import icons.VimIcons
|
||||
@@ -41,11 +60,20 @@ import javax.swing.Icon
|
||||
import javax.swing.SwingConstants
|
||||
|
||||
private class StatusBarIconProvider : StatusBarWidgetProvider {
|
||||
override fun getWidget(project: Project): VimStatusBar? = if (OptionsManager.ideastatusbar.isSet) VimStatusBar else null
|
||||
override fun getWidget(project: Project): VimStatusBar? {
|
||||
@Suppress("DEPRECATION")
|
||||
if (!OptionsManager.ideastatusbar.isSet) return null
|
||||
if (OptionsManager.ideastatusicon.value == IdeaStatusIcon.disabled) return null
|
||||
return VimStatusBar
|
||||
}
|
||||
}
|
||||
|
||||
object VimStatusBar : StatusBarWidget, StatusBarWidget.IconPresentation {
|
||||
|
||||
init {
|
||||
OptionsManager.ideastatusicon.addOptionChangeListener { _, _ -> this.update() }
|
||||
}
|
||||
|
||||
private var statusBar: StatusBar? = null
|
||||
|
||||
override fun ID(): String = "IdeaVim-Icon"
|
||||
@@ -58,7 +86,10 @@ object VimStatusBar : StatusBarWidget, StatusBarWidget.IconPresentation {
|
||||
|
||||
override fun getTooltipText() = "IdeaVim"
|
||||
|
||||
override fun getIcon(): Icon = if (VimPlugin.isEnabled()) VimIcons.IDEAVIM else VimIcons.IDEAVIM_DISABLED
|
||||
override fun getIcon(): Icon {
|
||||
if (OptionsManager.ideastatusicon.value == IdeaStatusIcon.gray) return VimIcons.IDEAVIM_DISABLED
|
||||
return if (VimPlugin.isEnabled()) VimIcons.IDEAVIM else VimIcons.IDEAVIM_DISABLED
|
||||
}
|
||||
|
||||
override fun getClickConsumer() = Consumer<MouseEvent> { event ->
|
||||
val component = event.component
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,9 +20,9 @@ package com.maddyhome.idea.vim
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.components.State
|
||||
import com.intellij.openapi.components.Storage
|
||||
import com.maddyhome.idea.vim.VimPlugin.STATE_VERSION
|
||||
import org.jdom.Element
|
||||
|
||||
/**
|
||||
@@ -31,27 +31,27 @@ import org.jdom.Element
|
||||
|
||||
@State(name = "VimLocalSettings", storages = [
|
||||
Storage("\$APP_CONFIG$$/vim_local_settings.xml", roamingType = RoamingType.DISABLED, deprecated = true),
|
||||
Storage("\$APP_CONFIG$/vim_local_settings.xml", roamingType = RoamingType.DISABLED)
|
||||
Storage("\$APP_CONFIG$/vim_local_settings.xml", roamingType = RoamingType.DISABLED, deprecated = true)
|
||||
])
|
||||
// TODO: 27.01.2020 [VERSION UPDATE] 2019.3 https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_services.html#light-services
|
||||
@Deprecated("The data from this class will be stored in vim_settings")
|
||||
class VimLocalConfig : PersistentStateComponent<Element> {
|
||||
override fun getState(): Element {
|
||||
val element = Element("ideavim-local")
|
||||
|
||||
val state = Element("state")
|
||||
state.setAttribute("version", STATE_VERSION.toString())
|
||||
element.addContent(state)
|
||||
|
||||
VimPlugin.getMark().saveData(element)
|
||||
VimPlugin.getRegister().saveData(element)
|
||||
VimPlugin.getSearch().saveData(element)
|
||||
VimPlugin.getHistory().saveData(element)
|
||||
return element
|
||||
}
|
||||
override fun getState(): Element? = null
|
||||
|
||||
override fun loadState(state: Element) {
|
||||
// This is initialization of state from the legacy configuration structure.
|
||||
// This code should be performed only once on settings migration.
|
||||
// After the migration is done, the file with settings gets removed and this method won't be called again.
|
||||
VimPlugin.getMark().readData(state)
|
||||
VimPlugin.getRegister().readData(state)
|
||||
VimPlugin.getSearch().readData(state)
|
||||
VimPlugin.getHistory().readData(state)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun initialize() {
|
||||
@Suppress("DEPRECATION")
|
||||
ServiceManager.getService(VimLocalConfig::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,10 +23,14 @@ import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PermanentInstallationID;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
@@ -66,6 +70,9 @@ import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.maddyhome.idea.vim.group.EditorGroup.EDITOR_STORE_ELEMENT;
|
||||
import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
|
||||
|
||||
/**
|
||||
* This plugin attempts to emulate the key binding and general functionality of Vim and gVim. See the supplied
|
||||
* documentation for a complete list of supported and unsupported Vim emulation. The code base contains some debugging
|
||||
@@ -75,15 +82,15 @@ import java.util.concurrent.TimeUnit;
|
||||
* Registers and marks are shared across open projects so you can copy and paste between files of different projects.
|
||||
*/
|
||||
@State(name = "VimSettings", storages = {@Storage("$APP_CONFIG$/vim_settings.xml")})
|
||||
public class VimPlugin implements BaseComponent, PersistentStateComponent<Element>, Disposable {
|
||||
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
|
||||
public class VimPlugin implements PersistentStateComponent<Element>, Disposable {
|
||||
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";
|
||||
private static final String IDEAVIM_STATISTICS_TIMESTAMP_KEY = "ideavim.statistics.timestamp";
|
||||
public static final int STATE_VERSION = 5;
|
||||
private static final int STATE_VERSION = 6;
|
||||
|
||||
private static long lastBeepTimeMillis;
|
||||
|
||||
private boolean error = false;
|
||||
private String message = null;
|
||||
|
||||
private int previousStateVersion = 0;
|
||||
private String previousKeyMap = "";
|
||||
@@ -93,21 +100,25 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(VimPlugin.class);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return IDEAVIM_COMPONENT_NAME;
|
||||
}
|
||||
private final @NotNull VimState state = new VimState();
|
||||
|
||||
|
||||
@NotNull private final VimState state = new VimState();
|
||||
|
||||
// [VERSION UPDATE] 193+ replace with com.intellij.openapi.components.PersistentStateComponent.initializeComponent
|
||||
@Override
|
||||
public void initComponent() {
|
||||
public void initialize() {
|
||||
LOG.debug("initComponent");
|
||||
|
||||
if (enabled) turnOnPlugin();
|
||||
// Initialize a legacy local config.
|
||||
if (previousStateVersion == 5) {
|
||||
//noinspection deprecation
|
||||
VimLocalConfig.Companion.initialize();
|
||||
}
|
||||
if (enabled) {
|
||||
Application application = ApplicationManager.getApplication();
|
||||
if (application.isUnitTestMode()) {
|
||||
application.invokeAndWait(this::turnOnPlugin);
|
||||
}
|
||||
else {
|
||||
application.invokeLater(this::turnOnPlugin);
|
||||
}
|
||||
}
|
||||
|
||||
LOG.debug("done");
|
||||
}
|
||||
@@ -122,23 +133,21 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
/**
|
||||
* @return NotificationService as applicationService if project is null and projectService otherwise
|
||||
*/
|
||||
@NotNull
|
||||
public static NotificationService getNotifications(@Nullable Project project) {
|
||||
public static @NotNull NotificationService getNotifications(@Nullable Project project) {
|
||||
if (project == null) {
|
||||
return ServiceManager.getService(NotificationService.class);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return ServiceManager.getService(project, NotificationService.class);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VimState getVimState() {
|
||||
public static @NotNull VimState getVimState() {
|
||||
return getInstance().state;
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public static MotionGroup getMotion() {
|
||||
public static @NotNull MotionGroup getMotion() {
|
||||
return ServiceManager.getService(MotionGroup.class);
|
||||
}
|
||||
|
||||
@@ -150,18 +159,17 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
public static void statisticReport() {
|
||||
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
|
||||
final long lastUpdate = propertiesComponent.getOrInitLong(IDEAVIM_STATISTICS_TIMESTAMP_KEY, 0);
|
||||
final boolean outOfDate =
|
||||
lastUpdate == 0 || System.currentTimeMillis() - lastUpdate > TimeUnit.DAYS.toMillis(1);
|
||||
final boolean outOfDate = lastUpdate == 0 || System.currentTimeMillis() - lastUpdate > TimeUnit.DAYS.toMillis(1);
|
||||
if (outOfDate && isEnabled()) {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
try {
|
||||
final String buildNumber = ApplicationInfo.getInstance().getBuild().asString();
|
||||
final String version = URLEncoder.encode(getVersion(), CharsetToolkit.UTF8);
|
||||
final String os =
|
||||
URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, CharsetToolkit.UTF8);
|
||||
final String os = URLEncoder.encode(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, CharsetToolkit.UTF8);
|
||||
final String uid = PermanentInstallationID.get();
|
||||
final String url = "https://plugins.jetbrains.com/plugins/list" +
|
||||
"?pluginId=" + IDEAVIM_PLUGIN_ID +
|
||||
"?pluginId=" +
|
||||
IDEAVIM_PLUGIN_ID +
|
||||
"&build=" +
|
||||
buildNumber +
|
||||
"&pluginVersion=" +
|
||||
@@ -190,106 +198,87 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ChangeGroup getChange() {
|
||||
public static @NotNull ChangeGroup getChange() {
|
||||
return ServiceManager.getService(ChangeGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CommandGroup getCommand() {
|
||||
public static @NotNull CommandGroup getCommand() {
|
||||
return ServiceManager.getService(CommandGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static MarkGroup getMark() {
|
||||
public static @NotNull MarkGroup getMark() {
|
||||
return ServiceManager.getService(MarkGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static RegisterGroup getRegister() {
|
||||
public static @NotNull RegisterGroup getRegister() {
|
||||
return ServiceManager.getService(RegisterGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static FileGroup getFile() {
|
||||
public static @Nullable RegisterGroup getRegisterIfCreated() {
|
||||
return ServiceManager.getServiceIfCreated(RegisterGroup.class);
|
||||
}
|
||||
|
||||
public static @NotNull FileGroup getFile() {
|
||||
return ServiceManager.getService(FileGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static SearchGroup getSearch() {
|
||||
public static @NotNull SearchGroup getSearch() {
|
||||
return ServiceManager.getService(SearchGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ProcessGroup getProcess() {
|
||||
public static @Nullable SearchGroup getSearchIfCreated() {
|
||||
return ServiceManager.getServiceIfCreated(SearchGroup.class);
|
||||
}
|
||||
|
||||
public static @NotNull ProcessGroup getProcess() {
|
||||
return ServiceManager.getService(ProcessGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static MacroGroup getMacro() {
|
||||
public static @NotNull MacroGroup getMacro() {
|
||||
return ServiceManager.getService(MacroGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static DigraphGroup getDigraph() {
|
||||
public static @NotNull DigraphGroup getDigraph() {
|
||||
return ServiceManager.getService(DigraphGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HistoryGroup getHistory() {
|
||||
public static @NotNull HistoryGroup getHistory() {
|
||||
return ServiceManager.getService(HistoryGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static KeyGroup getKey() {
|
||||
public static @NotNull KeyGroup getKey() {
|
||||
return ServiceManager.getService(KeyGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static WindowGroup getWindow() {
|
||||
public static @Nullable KeyGroup getKeyIfCreated() {
|
||||
return ServiceManager.getServiceIfCreated(KeyGroup.class);
|
||||
}
|
||||
|
||||
public static @NotNull WindowGroup getWindow() {
|
||||
return ServiceManager.getService(WindowGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static EditorGroup getEditor() {
|
||||
public static @NotNull EditorGroup getEditor() {
|
||||
return ServiceManager.getService(EditorGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VisualMotionGroup getVisualMotion() {
|
||||
public static @Nullable EditorGroup getEditorIfCreated() {
|
||||
return ServiceManager.getServiceIfCreated(EditorGroup.class);
|
||||
}
|
||||
|
||||
public static @NotNull VisualMotionGroup getVisualMotion() {
|
||||
return ServiceManager.getService(VisualMotionGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static YankGroup getYank() {
|
||||
public static @NotNull YankGroup getYank() {
|
||||
return ServiceManager.getService(YankGroup.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PutGroup getPut() {
|
||||
public static @NotNull PutGroup getPut() {
|
||||
return ServiceManager.getService(PutGroup.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
LOG.debug("Saving state");
|
||||
|
||||
final Element element = new Element("ideavim");
|
||||
// Save whether the plugin is enabled or not
|
||||
final Element state = new Element("state");
|
||||
state.setAttribute("version", Integer.toString(STATE_VERSION));
|
||||
state.setAttribute("enabled", Boolean.toString(enabled));
|
||||
element.addContent(state);
|
||||
|
||||
getKey().saveData(element);
|
||||
getEditor().saveData(element);
|
||||
this.state.saveData(element);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static NotificationService getNotifications() {
|
||||
private static @NotNull NotificationService getNotifications() {
|
||||
return getNotifications(null);
|
||||
}
|
||||
|
||||
@@ -307,15 +296,13 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PluginId getPluginId() {
|
||||
public static @NotNull PluginId getPluginId() {
|
||||
return PluginId.getId(IDEAVIM_PLUGIN_ID);
|
||||
}
|
||||
|
||||
// [VERSION UPDATE] 193+ remove suppress
|
||||
@SuppressWarnings({"MissingRecentApi", "UnstableApiUsage"})
|
||||
@NotNull
|
||||
public static String getVersion() {
|
||||
public static @NotNull String getVersion() {
|
||||
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(getPluginId());
|
||||
if (!ApplicationManager.getApplication().isInternal()) {
|
||||
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
|
||||
@@ -330,6 +317,8 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
|
||||
public static void setEnabled(final boolean enabled) {
|
||||
if (isEnabled() == enabled) return;
|
||||
|
||||
if (!enabled) {
|
||||
getInstance().turnOffPlugin();
|
||||
}
|
||||
@@ -347,6 +336,10 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
return getInstance().error;
|
||||
}
|
||||
|
||||
public static String getMessage() {
|
||||
return getInstance().message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate to the user that an error has occurred. Just beep.
|
||||
*/
|
||||
@@ -375,6 +368,9 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
|
||||
public static void showMessage(@Nullable String msg) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
getInstance().message = msg;
|
||||
}
|
||||
ProjectManager pm = ProjectManager.getInstance();
|
||||
Project[] projects = pm.getOpenProjects();
|
||||
for (Project project : projects) {
|
||||
@@ -390,18 +386,13 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static VimPlugin getInstance() {
|
||||
return ApplicationManager.getApplication().getComponent(VimPlugin.class);
|
||||
public static @NotNull VimPlugin getInstance() {
|
||||
return ServiceManager.getService(VimPlugin.class);
|
||||
}
|
||||
|
||||
private void turnOnPlugin() {
|
||||
ApplicationManager.getApplication().invokeLater(this::updateState);
|
||||
|
||||
getEditor().turnOn();
|
||||
getSearch().turnOn();
|
||||
VimListenerManager.INSTANCE.turnOn();
|
||||
|
||||
// Register vim actions in command mode
|
||||
RegisterActions.registerActions();
|
||||
|
||||
@@ -413,15 +404,32 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
|
||||
// Execute ~/.ideavimrc
|
||||
registerIdeavimrc();
|
||||
|
||||
// Turing on should be performed after all commands registration
|
||||
getEditor().turnOn();
|
||||
getSearch().turnOn();
|
||||
VimListenerManager.INSTANCE.turnOn();
|
||||
}
|
||||
|
||||
private void turnOffPlugin() {
|
||||
KeyHandler.getInstance().fullReset(null);
|
||||
|
||||
getEditor().turnOff();
|
||||
getSearch().turnOff();
|
||||
EditorGroup editorGroup = getEditorIfCreated();
|
||||
if (editorGroup != null) {
|
||||
editorGroup.turnOff();
|
||||
}
|
||||
SearchGroup searchGroup = getSearchIfCreated();
|
||||
if (searchGroup != null) {
|
||||
searchGroup.turnOff();
|
||||
}
|
||||
VimListenerManager.INSTANCE.turnOff();
|
||||
ExEntryPanel.fullReset();
|
||||
|
||||
// Unregister vim actions in command mode
|
||||
RegisterActions.unregisterActions();
|
||||
|
||||
// Unregister ex handlers
|
||||
CommandParser.getInstance().unregisterHandlers();
|
||||
}
|
||||
|
||||
private boolean stateUpdated = false;
|
||||
@@ -469,7 +477,7 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(@NotNull final Element element) {
|
||||
public void loadState(final @NotNull Element element) {
|
||||
LOG.debug("Loading state");
|
||||
|
||||
// Restore whether the plugin is enabled or not
|
||||
@@ -484,6 +492,27 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
previousKeyMap = state.getAttributeValue("keymap");
|
||||
}
|
||||
|
||||
legacyStateLoading(element);
|
||||
this.state.readData(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
LOG.debug("Saving state");
|
||||
|
||||
final Element element = new Element("ideavim");
|
||||
// Save whether the plugin is enabled or not
|
||||
final Element state = new Element("state");
|
||||
state.setAttribute("version", Integer.toString(STATE_VERSION));
|
||||
state.setAttribute("enabled", Boolean.toString(enabled));
|
||||
element.addContent(state);
|
||||
|
||||
this.state.saveData(element);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
private void legacyStateLoading(@NotNull Element element) {
|
||||
if (previousStateVersion > 0 && previousStateVersion < 5) {
|
||||
// Migrate settings from 4 to 5 version
|
||||
getMark().readData(element);
|
||||
@@ -491,8 +520,11 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
getSearch().readData(element);
|
||||
getHistory().readData(element);
|
||||
}
|
||||
if (element.getChild(SHORTCUT_CONFLICTS_ELEMENT) != null) {
|
||||
getKey().readData(element);
|
||||
}
|
||||
if (element.getChild(EDITOR_STORE_ELEMENT) != null) {
|
||||
getEditor().readData(element);
|
||||
this.state.readData(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim
|
||||
|
||||
import org.jdom.Element
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.ActionPlan;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
|
||||
import com.maddyhome.idea.vim.helper.EditorDataContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Accepts all regular keystrokes and passes them on to the Vim key handler.
|
||||
*
|
||||
* IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}.
|
||||
*/
|
||||
public class VimTypedActionHandler implements TypedActionHandlerEx {
|
||||
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
|
||||
|
||||
@NotNull private final KeyHandler handler;
|
||||
|
||||
public VimTypedActionHandler(TypedActionHandler origHandler) {
|
||||
handler = KeyHandler.getInstance();
|
||||
handler.setOriginalHandler(origHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
|
||||
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
|
||||
try {
|
||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
}
|
74
src/com/maddyhome/idea/vim/VimTypedActionHandler.kt
Normal file
74
src/com/maddyhome/idea/vim/VimTypedActionHandler.kt
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.maddyhome.idea.vim
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.actionSystem.ActionPlan
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx
|
||||
import com.maddyhome.idea.vim.helper.EditorDataContext
|
||||
import java.awt.event.KeyAdapter
|
||||
import java.awt.event.KeyEvent
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
/**
|
||||
* Accepts all regular keystrokes and passes them on to the Vim key handler.
|
||||
*
|
||||
* IDE shortcut keys used by Vim commands are handled by [com.maddyhome.idea.vim.action.VimShortcutKeyAction].
|
||||
*/
|
||||
class VimTypedActionHandler(origHandler: TypedActionHandler?) : TypedActionHandlerEx {
|
||||
private val handler = KeyHandler.getInstance()
|
||||
|
||||
init {
|
||||
handler.originalHandler = origHandler
|
||||
}
|
||||
|
||||
override fun beforeExecute(editor: Editor, charTyped: Char, context: DataContext, plan: ActionPlan) {
|
||||
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
|
||||
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
|
||||
handler.beforeHandleKey(editor, keyStroke, context, plan)
|
||||
}
|
||||
|
||||
override fun execute(editor: Editor, charTyped: Char, context: DataContext) {
|
||||
try {
|
||||
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
|
||||
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
|
||||
handler.handleKey(editor, keyStroke, EditorDataContext(editor))
|
||||
} catch (e: Throwable) {
|
||||
logger.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger = logger<VimTypedActionHandler>()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A nasty workaround to handle `<S-Space>` events. Probably all the key events should go trough this listener.
|
||||
*/
|
||||
object VimKeyListener : KeyAdapter() {
|
||||
|
||||
var isSpaceShift = false
|
||||
|
||||
override fun keyPressed(e: KeyEvent) {
|
||||
isSpaceShift = e.modifiersEx and KeyEvent.SHIFT_DOWN_MASK != 0 && e.keyChar == ' '
|
||||
}
|
||||
}
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.action
|
||||
|
||||
import javax.swing.KeyStroke
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.action
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -86,27 +86,26 @@ class VimShortcutKeyAction : AnAction(), DumbAware {
|
||||
@Suppress("DEPRECATION")
|
||||
val SMART_STEP_INPLACE_DATA = Key.findKeyByName("SMART_STEP_INPLACE_DATA")
|
||||
if (SMART_STEP_INPLACE_DATA != null && editor.getUserData(SMART_STEP_INPLACE_DATA) != null) return false
|
||||
|
||||
if (aceJumpActive()) return false
|
||||
|
||||
val keyCode = keyStroke.keyCode
|
||||
if (LookupManager.getActiveLookup(editor) != null) {
|
||||
return LookupKeys.isEnabledForLookup(keyStroke)
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_ESCAPE) {
|
||||
return isEnabledForEscape(editor)
|
||||
}
|
||||
|
||||
if (LookupManager.getActiveLookup(editor) != null && !LookupKeys.isEnabledForLookup(keyStroke)) return false
|
||||
|
||||
if (keyCode == KeyEvent.VK_ESCAPE) return isEnabledForEscape(editor)
|
||||
|
||||
if (editor.inInsertMode) { // XXX: <Tab> won't be recorded in macros
|
||||
if (keyCode == KeyEvent.VK_TAB) {
|
||||
VimPlugin.getChange().tabAction = true
|
||||
return false
|
||||
}
|
||||
// Debug watch, Python console, etc.
|
||||
if (NON_FILE_EDITOR_KEYS.contains(keyStroke) && !EditorHelper.isFileEditor(editor)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (VIM_ONLY_EDITOR_KEYS.contains(keyStroke)) {
|
||||
return true
|
||||
if (keyStroke in NON_FILE_EDITOR_KEYS && !EditorHelper.isFileEditor(editor)) return false
|
||||
}
|
||||
|
||||
if (keyStroke in VIM_ONLY_EDITOR_KEYS) return true
|
||||
|
||||
val savedShortcutConflicts = VimPlugin.getKey().savedShortcutConflicts
|
||||
return when (savedShortcutConflicts[keyStroke]) {
|
||||
ShortcutOwner.VIM -> true
|
||||
@@ -191,15 +190,15 @@ class VimShortcutKeyAction : AnAction(), DumbAware {
|
||||
companion object {
|
||||
@JvmField
|
||||
val VIM_ONLY_EDITOR_KEYS: Set<KeyStroke> = ImmutableSet.builder<KeyStroke>().addAll(getKeyStrokes(KeyEvent.VK_ENTER, 0)).addAll(getKeyStrokes(KeyEvent.VK_ESCAPE, 0))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_TAB, 0)).addAll(getKeyStrokes(KeyEvent.VK_BACK_SPACE, 0, InputEvent.CTRL_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_INSERT, 0)).addAll(getKeyStrokes(KeyEvent.VK_DELETE, 0, InputEvent.CTRL_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_UP, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK)).addAll(getKeyStrokes(KeyEvent.VK_DOWN, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_LEFT, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_RIGHT, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_HOME, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_END, 0, InputEvent.CTRL_MASK, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_PAGE_UP, 0, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_PAGE_DOWN, 0, InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK or InputEvent.SHIFT_MASK)).build()
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_TAB, 0)).addAll(getKeyStrokes(KeyEvent.VK_BACK_SPACE, 0, InputEvent.CTRL_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_INSERT, 0)).addAll(getKeyStrokes(KeyEvent.VK_DELETE, 0, InputEvent.CTRL_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_UP, 0, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK)).addAll(getKeyStrokes(KeyEvent.VK_DOWN, 0, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_LEFT, 0, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK or InputEvent.SHIFT_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_RIGHT, 0, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK or InputEvent.SHIFT_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_HOME, 0, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK or InputEvent.SHIFT_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_END, 0, InputEvent.CTRL_DOWN_MASK, InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK or InputEvent.SHIFT_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_PAGE_UP, 0, InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK or InputEvent.SHIFT_DOWN_MASK))
|
||||
.addAll(getKeyStrokes(KeyEvent.VK_PAGE_DOWN, 0, InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK or InputEvent.SHIFT_DOWN_MASK)).build()
|
||||
|
||||
private const val ACTION_ID = "VimShortcutKeyAction"
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -39,7 +39,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
if (lastCommand == null && VimRepeater.Extension.lastExtensionHandler == null) return false
|
||||
|
||||
// Save state
|
||||
val save = state.command
|
||||
val save = state.executingCommand
|
||||
val lastFTCmd = VimPlugin.getMotion().lastFTCmd
|
||||
val lastFTChar = VimPlugin.getMotion().lastFTChar
|
||||
val reg = VimPlugin.getRegister().currentRegister
|
||||
@@ -62,9 +62,9 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
mot.count = 0
|
||||
}
|
||||
}
|
||||
state.setCommand(lastCommand)
|
||||
state.setExecutingCommand(lastCommand)
|
||||
|
||||
KeyHandler.executeVimAction(editor, lastCommand.action, context)
|
||||
KeyHandler.executeVimAction(editor, lastCommand.action!!, context)
|
||||
|
||||
VimRepeater.saveLastChange(lastCommand)
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
state.isDotRepeatInProgress = false
|
||||
|
||||
// Restore state
|
||||
if (save != null) state.setCommand(save)
|
||||
if (save != null) state.setExecutingCommand(save)
|
||||
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar)
|
||||
if (lastHandler != null) VimRepeater.Extension.lastExtensionHandler = lastHandler
|
||||
VimRepeater.repeatHandler = repeatHandler
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,14 +23,12 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.CommandFlags
|
||||
import com.maddyhome.idea.vim.command.CommandState.SubMode
|
||||
import com.maddyhome.idea.vim.command.SelectionType
|
||||
import com.maddyhome.idea.vim.common.TextRange
|
||||
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.helper.subMode
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -46,15 +44,18 @@ class DeleteVisualLinesAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
context: DataContext,
|
||||
cmd: Command,
|
||||
range: VimSelection): Boolean {
|
||||
val mode = editor.subMode
|
||||
val textRange = range.toVimTextRange(false)
|
||||
return if (mode == SubMode.VISUAL_BLOCK) {
|
||||
VimPlugin.getChange()
|
||||
.deleteRange(editor, editor.caretModel.primaryCaret, textRange, SelectionType.fromSubMode(mode), false)
|
||||
} else {
|
||||
val lineRange = TextRange(EditorHelper.getLineStartForOffset(editor, textRange.startOffset),
|
||||
EditorHelper.getLineEndForOffset(editor, textRange.endOffset) + 1)
|
||||
VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false)
|
||||
val (usedCaret, usedRange, usedType) = when (range.type) {
|
||||
SelectionType.BLOCK_WISE -> Triple(editor.caretModel.primaryCaret, textRange, range.type)
|
||||
SelectionType.LINE_WISE -> Triple(caret, textRange, SelectionType.LINE_WISE)
|
||||
SelectionType.CHARACTER_WISE -> {
|
||||
val lineRange = TextRange(
|
||||
EditorHelper.getLineStartForOffset(editor, textRange.startOffset),
|
||||
EditorHelper.getLineEndForOffset(editor, textRange.endOffset) + 1
|
||||
)
|
||||
Triple(caret, lineRange, SelectionType.LINE_WISE)
|
||||
}
|
||||
}
|
||||
return VimPlugin.getChange().deleteRange(editor, usedCaret, usedRange, usedType, false)
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
import com.maddyhome.idea.vim.command.Argument
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
class InsertCompletedDigraphAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.INSERT
|
||||
override val argumentType: Argument.Type? = Argument.Type.DIGRAPH
|
||||
|
||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||
// The converted digraph character has been captured as an argument, push it back through key handler
|
||||
val keyStroke = KeyStroke.getKeyStroke(cmd.argument!!.character)
|
||||
KeyHandler.getInstance().handleKey(editor, keyStroke, context)
|
||||
return true
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
import com.maddyhome.idea.vim.command.Argument
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
class InsertCompletedLiteralAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.INSERT
|
||||
override val argumentType: Argument.Type? = Argument.Type.DIGRAPH
|
||||
|
||||
override fun execute(editor: Editor, context: DataContext, cmd: Command): Boolean {
|
||||
// The converted literal character has been captured as an argument, push it back through key handler
|
||||
val keyStroke = KeyStroke.getKeyStroke(cmd.argument!!.character)
|
||||
KeyHandler.getInstance().handleKey(editor, keyStroke, context)
|
||||
return true
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2019 The IdeaVim authors
|
||||
* Copyright (C) 2003-2020 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user