1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-06-15 18:39:56 +02:00
Commit Graph

1397 Commits

Author SHA1 Message Date
Matt Ellis
2e0ef7e0b0 Enter Insert Visual/Select mode with shifted key 2025-01-10 11:29:44 +03:00
Matt Ellis
da99e1f1c3 Return to Insert when leaving Insert Normal 2025-01-10 11:29:44 +03:00
Matt Ellis
0e587211d9 Improve isEndAllowed 2025-01-10 11:29:44 +03:00
Matt Ellis
dc5ef487d2 Show additional Insert modes in showmode widget 2025-01-10 11:29:44 +03:00
Matt Ellis
eaad93903b Simplify Mode hierarchy
Wanting to add `ReturnTo.SELECT` would be very tricky, as we would have to recreate the mode, but have no details about the selection type.
2025-01-10 11:29:44 +03:00
Matt Ellis
a6b2bf1c55 Remove ReturnableFromCmd marker interface 2025-01-10 11:29:44 +03:00
Matt Ellis
e3a07b6c89 Add support for CTRL-J
Supported in Normal, Visual, Select and Operator-pending. Also adds support for CTRL-M in Select mode.

Fixes VIM-3740
2025-01-10 10:00:28 +03:00
Alex Plate
c225452432
[VIM-3577] Store the information if the editor was initialized in insert mode 2024-12-18 13:19:20 +02:00
Alex Plate
5995a48d7b
[VIM-3577] Replace weak reference to focused editor to needed information
The `editorInFocus` used the weak reference in order to avoid editor leaks. However, if the user is unlucky, the GC may be called in between the console closing and switching focus to the new editor. In this case, the logic breaks and the Editor remains in the insert mode.
Now, we store only the required information about the last used editor.
2024-12-17 20:36:51 +02:00
Julien Phalip
4962baabad Add support for hlsearch variable 2024-12-06 17:21:33 +02:00
Julien Phalip
2e550a0960 Add support for escape() vim function 2024-12-06 17:09:59 +02:00
Matt Ellis
a005eb0612 Fix repeating change action with count
Fixes VIM-3729
2024-12-04 18:23:16 +02:00
Julien Phalip
e32fa6dd11 Change Variable to an interface 2024-11-26 10:32:11 +02:00
Julien Phalip
ec3db81c6d Move register variable to its own separate class 2024-11-26 10:32:11 +02:00
Julien Phalip
7062dc4860 Add support for the v:register variable 2024-11-26 10:32:11 +02:00
filipp
94d7902ef2 Remove more deprecated methods 2024-11-22 17:15:07 +02:00
filipp
3d08170d54 Post-rebase fixes 2024-11-22 17:15:07 +02:00
filipp
cccb23d9ee Specify which commands perform mode change
We need this for undo subsystem. Mode change is not something that we want to be a separate entity in the undo log

P.S. It's not a full list of such commands, e.g. <ESC> for leaving insert mode is missing. It is because <ESC> may insert some text after visual block mode, I'll figure out a solution for this later
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
eae3fb3ebe Introduce VimKeyBasedUndoService and VimTimestampBasedUndoService
Undo is managed differently in Fleet and IJ Platform, so now we have two different interfaces that are aware of that
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
7f5dce4051 Stop using some deprecated methods 2024-11-22 17:15:07 +02:00
Filipp Vakhitov
25e3988dcf Introduce VimCopiedText class
I don't really like that we have `transferableData: List<Any>`
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
36589c5250 Add context argument in clipboard methods
Alas, adding in just to clipboard was not possible, as there are a lot of depending on methods
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
f1f86b5cd2 Simplify Register class
1. `rawText` vs `text` is confusing and `rawText` was misused, we do not need this field in IdeaVim at all
2. `rawText` and `keys` are the same thing, just parsed. And for some reason, rawText was a nullable field
3. Register is an immutable class now
4. Working with Register class is easier and more compact now
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
628b3ca89f Fix <CR> parsing
It's ^M, not ^J
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
d2b929ddd0 Fix parsing for clipboard option
When I added the selection clipboard, it was confusing to explain to people how this option works and why they should prepend, because the parsing was broken
I've also removed "exclude" part, because it doesn't work in IdeaVim and can confuse people
2024-11-22 17:15:07 +02:00
filipp
43d770ff5a Simplify getTransferableData method signature 2024-11-22 17:15:07 +02:00
Filipp Vakhitov
cde9bc94e6 Fix select mode for immutable caret
Due to implementation details, caret cannot be moved after setting selection
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
63f6e73223 Fix select mode for immutable caret 2024-11-22 17:15:07 +02:00
Filipp Vakhitov
ad28e09fec Move caret when deleting a char
In Fleet deleting text does not move caret, so we add caret moving logic
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
f616f2c3c1 Fix gv in Fleet
Moving caret after setting selection removes the selection
2024-11-22 17:15:07 +02:00
Filipp Vakhitov
66aec26091 Move ColLineFunctionHandler.kt to vim-engine 2024-11-22 17:15:07 +02:00
Filipp Vakhitov
1d59c49b95 Move more logic to vim-engine 2024-11-22 17:15:07 +02:00
Matt Ellis
468ca840ed Update options tests
Expanded to assert changes on all open windows, and formatted to make it a little easier to read/comprehend what's being tested
2024-11-22 17:01:38 +02:00
Julien Phalip
c75e6756c0 Add some tests for the getcmdtype() function 2024-11-22 16:49:04 +02:00
Julien Phalip
52737c60cf Add JSON entry for getcmdtype function 2024-11-22 16:49:04 +02:00
Julien Phalip
e99c191d49 Add partial support for getcmdtype() function
Tests not included
2024-11-22 16:49:04 +02:00
Alex Plate
b026144254
Add RWLock label to selectionStart & selectionEnd 2024-11-15 20:53:54 +02:00
Alex Plate
0e3cda827c
Fix(VIM-3695): Wrap getting a vimLeadSelectionOffset with a read action 2024-11-15 20:44:00 +02:00
Alex Plate
791edbd29b
Restore compatibility with peekaboo plugin
https://plugins.jetbrains.com/plugin/25776-vim-peekaboo
2024-11-13 19:39:24 +02:00
Matt Ellis
4b7381901d Fix bug removing map that is also a prefix 2024-11-13 17:57:31 +02:00
Matt Ellis
6e2cb9ba11 Reorder functions. No logic changes 2024-11-13 17:57:31 +02:00
Matt Ellis
91cd4ab01f Add sequences to iterate keystroke trie
Allows iterating the trie entries without having to create a list or create a list for each entry's keystrokes.
2024-11-13 17:57:31 +02:00
Matt Ellis
34d23180bd Avoid wrapping the keys list for each map attempt 2024-11-13 17:57:31 +02:00
Matt Ellis
fc5aaa50d8 Remove unnecessary hasmapfrom function 2024-11-13 17:57:31 +02:00
Matt Ellis
c7bbfdcaf5 Remove some test only functions 2024-11-13 17:57:31 +02:00
Matt Ellis
562906fe6d Filter map output by prefix
Fixes VIM-2981
2024-11-13 17:57:31 +02:00
Matt Ellis
976771d11a Implement smap and snoremap
Support for sunmap and smapclear already exists, and vmap would introduce a Select mode map.

Fixes VIM-2260
2024-11-13 17:57:31 +02:00
Matt Ellis
5fc4462b03 Support map! to map insert and cmdline modes
Also supports `mapclear!` and `unmap!`

Moves parsing of the bang modifier to the parser so we can tell the difference between `map! foo bar` and `map ! foo bar`
2024-11-13 17:57:31 +02:00
Matt Ellis
5f263e7014 Fix output of maps with same keys in multiple modes
E.g. `map foo bar` and `vmap foo baz` would only output one map for `foo` when calling `:map`. Now it will output all maps that match the ex command's modes. This change also improves the marker characters in the first column of map output.
2024-11-13 17:57:31 +02:00
Matt Ellis
2f8fe392af Use KeyStrokeTrie for maps 2024-11-13 17:57:31 +02:00
Matt Ellis
84c7e1159b Introduce KeyStrokeTrie to find commands
Should also restore compatibility with idea-which-key
2024-11-13 17:57:31 +02:00
Matt Ellis
18d6f79796 Add missing C-PageUp/Down shortcuts to switch tab
Fixes VIM-2044
2024-11-13 17:52:28 +02:00
Matt Ellis
a745da9761 Add Shift+Enter mapping to scroll page forward
Fixes VIM-2752
2024-11-13 17:52:28 +02:00
Matt Ellis
5eb36ce428 Remove unneeded extended special name parsing
This was needed when action keys were registered in a comma separated list in a single XML attribute string. Additional encoding was needed for angle brackets and commas. Registration has changed, and this is no longer needed
2024-11-13 17:52:28 +02:00
Matt Ellis
92ee271f1e Add fallback if ve guicursor option not specified 2024-11-05 12:29:13 +02:00
Matt Ellis
babc5daf3b Use Visual-exclusive caret shape from guicursor 2024-11-05 12:29:13 +02:00
Matt Ellis
82d18cfbb9 Remove unused imports 2024-11-05 04:14:12 +02:00
dependabot[bot]
15b2a17ae6 Bump org.junit.jupiter:junit-jupiter-engine from 5.10.3 to 5.10.5
Bumps [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.10.3 to 5.10.5.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.10.5)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-30 18:10:50 +02:00
dependabot[bot]
2fd488531b Bump org.junit.vintage:junit-vintage-engine from 5.10.3 to 5.10.5
Bumps [org.junit.vintage:junit-vintage-engine](https://github.com/junit-team/junit5) from 5.10.3 to 5.10.5.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.10.5)

---
updated-dependencies:
- dependency-name: org.junit.vintage:junit-vintage-engine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-30 17:55:56 +02:00
dependabot[bot]
e69b30796c Bump org.junit.jupiter:junit-jupiter-api from 5.10.3 to 5.10.5
Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.10.3 to 5.10.5.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.10.5)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-30 17:54:34 +02:00
dependabot[bot]
43555ad581 Bump org.jetbrains:annotations from 24.1.0 to 26.0.1
Bumps [org.jetbrains:annotations](https://github.com/JetBrains/java-annotations) from 24.1.0 to 26.0.1.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JetBrains/java-annotations/compare/24.1.0...26.0.1)

---
updated-dependencies:
- dependency-name: org.jetbrains:annotations
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-23 18:50:30 +03:00
Matt Ellis
879d191800 Scroll caret into view after undo/redo
This is to ensure that 'scrolloff' is applied. Relates to VIM-3671
2024-10-21 15:50:58 +03:00
Matt Ellis
34fe09c8f9 Use full width of output panel for text 2024-09-05 19:22:04 +03:00
Matt Ellis
10283ce2f8 Add support for custom digraphs 2024-09-05 19:22:04 +03:00
Matt Ellis
cc53b59658 Add digraph headers 2024-09-05 19:22:04 +03:00
Matt Ellis
c758a79f79 Minor refactor outputting digraphs 2024-09-05 19:22:04 +03:00
Matt Ellis
01d00d45d8 Add a default size for the digraph string builder 2024-09-05 19:22:04 +03:00
Matt Ellis
5c7edc498f Rename getDigraph - it gets a char from a digraph 2024-09-05 19:22:04 +03:00
Matt Ellis
9c403d2862 Simplify creating string digraph key 2024-09-05 19:22:04 +03:00
Matt Ellis
ebbd733bba Update default digraphs to match current Vim
List is based on Vim's documentation, although not all digraphs are documented. Additional digraphs are added based on the output of `:digraphs`. These additional digraphs include some digraphs that produce the same character, so the code is updated to handle duplicates, with the same ordering/priority as Vim.

Extra digraphs include the Euro symbol (`=e` and `Eu`), quadruple prime (`4'`) and bullet (`oo`), amongst others.

Also removes a number of non-standard digraphs. The symbols generated don't match the descriptions. The code appears to be private use, so are not reliable. Once custom digraphs are implemented, they can be easily added back in `~/.ideavimrc`
2024-09-05 19:22:04 +03:00
Matt Ellis
88d1e1d24a Suppress language download inspection 2024-09-05 19:22:04 +03:00
Matt Ellis
c19f2aeee4 Update comments for default digraphs 2024-09-05 19:22:04 +03:00
Matt Ellis
86202c846a Remove unused commented digraph data 2024-09-05 19:22:04 +03:00
Matt Ellis
9a7ff442f3 Correctly format RTL and combining digraph chars 2024-09-05 19:22:04 +03:00
Matt Ellis
3752a97d74 Output digraph character codes in decimal, like Vim
Not sure why IdeaVim has used hex. Vim appears to have used decimal for at least 20 years.
2024-09-05 19:22:04 +03:00
Matt Ellis
5572dfc80d Update digraph formatting to match Vim
Vim only use the `~` prefix if the encoding is "latin1". We can just treat it as though the encoding is Unicode, and match the other places we format printable characters. Note that for Vim, if `'display'` contains "uhex", then all unprintable characters are shown in hex, including control characters (`^C`, etc.). IdeaVim does not support the `'display'` option.
2024-09-05 19:22:04 +03:00
Matt Ellis
100f420d46 Strip trailing spaces 2024-09-05 19:22:04 +03:00
Matt Ellis
3fcc4746d8 Migrate digraph output to engine 2024-09-05 19:22:04 +03:00
dedd90ce13 Fix(VIM-3615): Escape closes dialog while waiting for more keys 2024-08-30 16:46:53 +03:00
Matt Ellis
fb7a2de07b Encapsulate the command builder's state flag
This also gets rid of BAD_COMMAND, which was set but never checked - the function that set the flag would immediately reset the command builder
2024-08-30 16:36:24 +03:00
Matt Ellis
def9ca479b Ensure builder resets to a root command trie node
Also refactors command nodes a bit for better debug/trace output
2024-08-30 16:36:24 +03:00
Matt Ellis
0936e0761f Reorder CommandBuilder methods
Try to keep related functions together: awaiting arguments, count, registers, adding action/argument, processing keystrokes, build, reset.
2024-08-30 16:36:24 +03:00
Matt Ellis
09a335bcfe Start to encapsulate setting command builder state
Also rename `pushCommandPart` and `completeCommandPart`
2024-08-30 16:36:24 +03:00
Matt Ellis
37b8d69bac Remove unused EMPTY_COMMAND 2024-08-30 16:36:24 +03:00
Matt Ellis
13308050a8 Remove unnecessary OperatorArguments parameters 2024-08-30 16:36:24 +03:00
Matt Ellis
a1a553ebc9 Deprecate OperatorArguments.mode 2024-08-30 16:36:24 +03:00
Matt Ellis
5bb0c4f7cb Use editor.mode instead of OperatorArguments.mode
`OperatorArguments.mode` is the mode *before* the command was completed, rather than the current mode, which is non-obvious. E.g. for a command in Insert mode, it will still be Insert, and for a (simple) command in Normal, it will still be Normal. The only difference is that a command such as `dw` would be in Operator-pending before the command is completed. That logic is not required for this method, so it's safe to use the current mode.

This allows us to start to deprecate `OperatorArguments.mode`.
2024-08-30 16:36:24 +03:00
Matt Ellis
da6736f24a Simplify the logic when yanking during delete 2024-08-30 16:36:24 +03:00
Matt Ellis
4df1ce2ae8 Remove OperatorArguments.mode usage in block insert
`OperatorArguments.mode` is the mode *before* the command is completed, so might be Visual, Operator-pending, Insert, etc. It's not immediately obvious this is the case, so we're going to deprecate `OperatorArguments.mode` to avoid confusion with `editor.mode`.

It's not required for this method because it's only called for Visual-block mode.
2024-08-30 16:36:24 +03:00
Matt Ellis
00fd4cd491 Handle op-pending for space and backspace 2024-08-30 16:36:24 +03:00
Matt Ellis
d185672e2f Deprecate OperatorArguments.isOperatorPending
Register specific handlers for Operator-pending mode instead of relying on a runtime flag for behaviour. Also refactors and renames some arrow motion handlers.
2024-08-30 16:36:24 +03:00
Matt Ellis
69b3e4f782 Start to refactor OperatorArguments 2024-08-30 16:36:24 +03:00
Matt Ellis
6be29b0378 Remove KeyHandler.isOperatorPending
It's easier to just look at mode. We don't need the additional check on command builder, because we can't be in OP_PENDING without pushing an operator action to the command builder
2024-08-30 16:36:24 +03:00
Matt Ellis
9965c863a6 Encapsulate command node state in builder 2024-08-30 16:36:24 +03:00
Matt Ellis
3f11ae512c Move register pending state to command builder 2024-08-30 16:36:24 +03:00
Matt Ellis
1c842eb3d8 Avoid exposing misleading count on command builder 2024-08-30 16:36:24 +03:00
Matt Ellis
c7fbce675b Update comment 2024-08-30 16:36:24 +03:00
Matt Ellis
d7e68488c8 Make Command.rawCount immutable 2024-08-30 16:36:24 +03:00
Matt Ellis
69d13a74e6 Remove unnecessary copy method 2024-08-30 16:36:24 +03:00
Matt Ellis
5a83df34a7 Replace var properties with read only 2024-08-30 16:36:24 +03:00