1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-04-19 10:15:44 +02:00
Commit Graph

5068 Commits

Author SHA1 Message Date
Alex Plate
e257a10525
Fix an issue that the highlighting was silently missing due to an error 2025-02-24 12:13:51 +02:00
Alex Plate
42d80f6866
Add write action in several places 2025-02-21 19:32:47 +02:00
Alex Plate
fedefea0aa
Remove the write action in several places 2025-02-21 18:56:52 +02:00
Alex Plate
437fa9a1a0
Remove the root write and read actions
Historically, IdeaVim was starting read or write action based on command type. However, this is incorrect because of several reasons:
- The command of different type may perform a write/read action
- The write lock with a lot of code inside does cause application freezes
- Since a large branching of code happens inside the write action, there is a chance of read action request, resulting in the deadlock

Also, now this prevents from implementing a proper execution of VIM-3376.
2025-02-21 18:44:51 +02:00
Alex Plate
0511ee277f
Remove the requirement for the write action in macros
It's not clear why the write action was needed. Probably, it was a mistake and it supposed to be a check for EDT. However, since the check for EDT exists right in the constructor of the potemkin progress, let's remove it at all.
2025-02-21 17:40:40 +02:00
Alex Plate
45d92c1981
Use the read action for neovim tests in other place 2025-02-21 13:33:53 +02:00
Alex Plate
58de834832
Use the read action for neovim tests 2025-02-21 13:17:37 +02:00
Alex Plate
3866565e51
Remove IdeaVimTestCase and replace it with VimTestCase 2025-02-21 13:03:23 +02:00
Alex Plate
564ab7d75e
Remove EDT and write action from the VimTestCase 2025-02-21 09:54:12 +02:00
Matt Ellis
43a2bd98db Reduce multiple implementations to one 2025-02-21 09:53:11 +02:00
Matt Ellis
4787a5e22a Rewrite backwards search for word under cursor 2025-02-21 09:53:11 +02:00
Matt Ellis
1a8789b50c Rewrite next/previous word motions and objects 2025-02-21 09:53:11 +02:00
Matt Ellis
b5937e885d Rewrite displayLocationInfo to avoid findNextWord
Simplifies and fixes counting words, especially when selection intersects words. Also moves implementation to engine and adds more tests.
2025-02-21 09:53:11 +02:00
Matt Ellis
cad6afdc9d Rewrite word end motions and word objects 2025-02-21 09:53:11 +02:00
Matt Ellis
54ef691a98 Add tests for outer word motions and blank lines 2025-02-21 09:53:11 +02:00
Matt Ellis
426c2fd006 Handle blank and empty lines for text objects
Fixes VIM-1642
2025-02-21 09:53:11 +02:00
Matt Ellis
f25c56b545 Refactor checks for including following whitespace 2025-02-21 09:53:11 +02:00
Matt Ellis
960eb50d8c Fix incorrectly selected new line char with viw 2025-02-21 09:53:11 +02:00
Matt Ellis
18b4b76ebf Select trailing whitespace with viw
Inner word/WORD motions will select trailing whitespace at the end of a line without wrapping
2025-02-21 09:53:11 +02:00
Matt Ellis
d9e575d4a2 Select leading whitespace with viw
Inner word/WORD motions will select leading whitespace at the start of a line without wrapping
2025-02-21 09:53:11 +02:00
Matt Ellis
1769804c8a Select leading whitespace with vaw
Outer word/WORD motions will select leading whitespace at the start of a line
2025-02-21 09:53:11 +02:00
Matt Ellis
81e094ac8f Select trailing whitespace with vaw
Outer word/WORD motions will select trailing whitespace at the end of a line
2025-02-21 09:53:11 +02:00
Matt Ellis
4240c429ba Select preceding whitespace if no following (vaw)
Outer word/WORD text objects should select following whitespace, unless there isn't any, and then it should select preceding whitespace.
2025-02-21 09:53:11 +02:00
Matt Ellis
2da77f0f11 Add tests for existing word/WORD text objects 2025-02-21 09:53:11 +02:00
Matt Ellis
580764b30c Match empty line as word/WORD
Unless moving to end of word/WORD, in which case, skip all whitespace to get to end of the next set of word/WORD characters.

Fixes VIM-1650
2025-02-21 09:53:11 +02:00
Matt Ellis
afd69eef95 Fix end of file edge case deleting previous word
Adds extra tests to confirm that deleting previous word in Insert mode was already working as expected (relates to VIM-1650)

Also fixes an edge case for a test that was marked as behaving differently to Vim, but was actually showing buggy behaviour due to its unorthodox caret placement. It looked like the caret was placed at the end of the line, but it was actually placed _passed_ the last character in the file. Adding extra text below the caret placement would cause the action to behave as expected, and the test would then match Vim behaviour. However, it is possible to get this caret position in the editor and in Vim, with `virtualedit=onemore`, and the IdeaVim implementation was wrong. The test has been updated to provide the correct scenario, and the implementation has been fixed.
2025-02-21 09:53:11 +02:00
Matt Ellis
be1cc67566 Fix previous word end motion at start of file 2025-02-21 09:53:11 +02:00
Matt Ellis
4bc75e0a9b Add tests for existing word/WORD motion behaviour 2025-02-21 09:53:11 +02:00
Matt Ellis
5740372df9 Add err_teapot function 2025-02-20 19:21:31 +02:00
Matt Ellis
06791b9378 Add float2nr function 2025-02-20 19:21:31 +02:00
Matt Ellis
91e927c913 Add fmod function 2025-02-20 19:21:31 +02:00
Matt Ellis
9a5c558060 Add float classification functions 2025-02-20 19:21:31 +02:00
Matt Ellis
d1127a5238 Add power functions 2025-02-20 19:21:31 +02:00
Matt Ellis
613a8b5792 Add exponential functions 2025-02-20 19:21:31 +02:00
Matt Ellis
6f63371e9b Add rounding functions 2025-02-20 19:21:31 +02:00
Matt Ellis
3b96e2eacd Add trigonometric and hyperbolic builtin functions 2025-02-20 19:21:31 +02:00
Matt Ellis
ffdd6716f5 Refactor some moved tests 2025-02-20 19:21:31 +02:00
Matt Ellis
4453862ea0 Extract function tests 2025-02-20 19:21:31 +02:00
Matt Ellis
1bd7a7596b Support binary numbers in vimscript
Also supports octal with an `0o` or `0O` prefix.
2025-02-20 19:21:31 +02:00
Matt Ellis
23329cc522 Add bitwise functions 2025-02-20 19:21:31 +02:00
Alex Plate
be86dc3c78
Rename VimNoWriteActionTestCase to IdeaVimTestCase 2025-02-20 19:15:43 +02:00
Alex Plate
d65a219194
Mark VimTestCase as deprecated 2025-02-20 19:13:39 +02:00
Alex Plate
e18035b729
Migrate java tests to VimNoWriteActionTestCase 2025-02-20 18:57:52 +02:00
Alex Plate
83b92d84a6
Disable IdeaVim listeners in places where IdeaVim is disabled
This is needed for the new terminal. Before this change, it was impossible to put the caret at the line end, even taking the fact the IdeaVim is disabled in the new terminal.
2025-02-14 17:59:06 +02:00
Alex Plate
4ca187926c
Use SimpleDataContext instead of the obsolete DataContextWrapper 2025-02-11 11:53:00 +02:00
Osvaldo Cordova Aburto
491a96825f feat: improve any brackets behavior 2025-02-07 12:56:56 +02:00
Alex Plate
62ed920363
Use null instead of -1 when the version of IdeaVim is not set 2025-02-03 11:05:17 +02:00
Osvaldo Cordova Aburto
7b16deb3e3 fix: calculation to find the closest delimited range 2025-01-30 13:40:26 +02:00
Osvaldo Cordova Aburto
01d776957a fix: distanceTo to works with nested quotes and brackets 2025-01-30 13:40:26 +02:00
Alex Plate
96bff03d99
Refactor VimShortcutKeyAction for clarity and structure.
Simplify and reorganize logic in isEnabled() for improved readability and maintainability. Adjust logging messages for consistency and replace unused exception variable with underscore.
2025-01-29 10:25:20 +02:00
Alex Plate
6eeb0eb47d
Fix the issue that the shortcuts where not working in the command line 2025-01-29 10:11:23 +02:00
Osvaldo Cordova Aburto
31a6d8174a feat: add mini-ai extension 2025-01-27 23:19:24 +02:00
Alex Plate
ee548b52db
[VIM-3784] Store the information about the first version of IdeaVim for the user. 2025-01-27 11:09:47 +02:00
Alex Plate
1d77b0b059
Fix the incorrect variable name 2025-01-27 10:46:21 +02:00
Alex Plate
304562a2db
Remove the notification about the new undo functionality 2025-01-27 10:43:18 +02:00
Alex Plate
e358dc9cee
Fix(VIM-3640): Enable IdeaVim only in the editor context component
As the GitHub Copilot is placed right in the editor component, the IdeaVim's actions are also collected. Action promoter promotes the IdeaVim's action and, since the data context has the editor, executes a Vim's actions like backspace.
Now we make sure that IdeaVim works only in the actual editor.
Since this change may affect some places where the IdeaVim used to work, but won't work now (this will be a surprise), a registry key is introduced to help the users that face this problem.
2025-01-24 13:34:08 +02:00
Alex Plate
00d9ed93ec
Fix(VIM-3543): Disable IdeaVim in the new terminal 2025-01-23 12:22:22 +02:00
Matt Ellis
308996c4c1 Remove Visual when updating incsearch for a command 2025-01-22 17:42:30 +02:00
Matt Ellis
1f68b756d5 Disable incsearch highlight in Visual mode 2025-01-22 17:42:30 +02:00
Matt Ellis
ed6789cb8b Add tests updating Visual while editing incsearch 2025-01-22 17:42:30 +02:00
Matt Ellis
e9e86b07fb Fix incsearch not updating empty selection
As a by-product, this also fixes an off-by-one error where incsearch would effectively treat all Visual searches as exclusive
2025-01-22 17:42:30 +02:00
Matt Ellis
a969b93ba6 Add tests for updating Visual selection with search 2025-01-22 17:42:30 +02:00
Matt Ellis
970cfadaec Extract search highlighting related tests 2025-01-22 17:42:30 +02:00
Matt Ellis
12ed60d88e Remove tests using obsolete newregex option 2025-01-22 17:42:30 +02:00
Sebastian Doerner
cb218697fa [VIM-3731] Add support for "jump to previous/next lowercase mark".
Fixes VIM-3731
2025-01-21 22:48:12 +02:00
Matt Ellis
7548b160ae Fix race condition resetting editor on focus gain
Fixes VIM-3773
2025-01-14 17:21:53 +01:00
Alex Plate
1105f61988
[VIM-3620] Use shortened links instead of plain ones 2025-01-14 17:35:09 +02:00
Alex Plate
54b49d3322
[VIM-3620] Do not show the uninstall feedback when updating the plugin 2025-01-14 17:17:15 +02:00
Alex Plate
6ab0add430
Update the twitter icon to X 2025-01-14 13:37:39 +02:00
Matt Ellis
296288f428 Ensure correct caret position when exiting Select
Fixes VIM-3042
2025-01-13 18:10:01 +01:00
Matt Ellis
1d5fc01d65 Fix Del and BS not working in Select mode
Fixes VIM-3618
2025-01-13 18:10:01 +01:00
Alex Plate
ad584d553c
Reformat code 2025-01-10 13:28:48 +03:00
Alex Plate
36556d559f
Optimize imports 2025-01-10 13:28:47 +03:00
Alex Plate
ef16181ba2
Clean up code 2025-01-10 13:28:46 +03:00
Alex Plate
aaba0a09c2
Remove deprecated function 2025-01-10 13:28:46 +03:00
Matt Ellis
0b308769b1 Move select toggle implementation 2025-01-10 11:29:44 +03:00
Matt Ellis
a28416dd9f Update mode widget text for Select pending 2025-01-10 11:29:44 +03:00
Matt Ellis
63b3af3f65 Implement v_CTRL-O
From Select mode, enters Visual for a single command
2025-01-10 11:29:44 +03:00
Matt Ellis
fcc234c4fe Rename submode to selectionType 2025-01-10 11:29:44 +03:00
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
5827ad1581 Only show mode widget popup on left mouse click 2025-01-10 11:29:44 +03:00
Matt Ellis
8b8ef80a5e Reinstate showmode tests 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
Xinhe Wang
bde4fcdd47 Fix test failure introduced in 5e60ea7 2024-12-21 20:29:18 +02:00
Alex Plate
69811c864e
Add checks to avoid incorrect creation of the visual position
Related to VIM-3755
2024-12-18 16:33:18 +02: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
Filipp Vakhitov
5e60ea7f4c Fix(VIM-3754): set clipboard+=unnamed stopped working in IdeVIM 2.18
I did remove `exclude:cons\\|linux` from the overriden value
2024-12-18 13:11:26 +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
Alex Plate
4614e2ad54
[VIM-3617] Remove the forgotten recursion call 2024-12-17 10:06:48 +02:00
Alex Plate
077de91e01
[VIM-3617] Set a recursion guard for obtaining the editor
Function `selectedTextEditor` in some cases may create a new editor, what causes the recursion and IDE freeze. The guard should protect from it.
2024-12-17 10:02:34 +02:00
Alex Plate
1ce7a97f2a
Fix(VIM-3747): There is no need to remove the visual mode if there is still a selection 2024-12-16 13:38:29 +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
Justas Trimailovas
63297e685c Correctly change surround if it's empty or only spaces
This commit fixes 2 bugs at once:

1. Correctly trim surround with closing brackets motion, e.g.: `cs()`.

   It should trim all surrounding white space or leave things unchanged if
   there's no space.

   For example cases like these:

	"( ${c}foo )"  // single spaces
	"(   ${c}foo   )"  // multiple spaces
	"( ${c}foo)"  // assymetric spaces
	"(${c} )"  // single space without text
	"(${c}   )"  // multiple spaces without text

   Should trim white spaces into these results accordingly:

	"${c}(foo)"
	"${c}(foo)"
	"${c}(foo)"
	"${c}()"
	"${c}()"

In case of no spaces - they should be left unchanged, e.g.:

	"(${c}foo)"  // no spaces around the word
	"(${c})"  // empty parenthesis

2. Leave empty parenthesis unchanged. IdeaVim now deleted them instead.
2024-12-04 18:07:02 +02:00
Justas Trimailovas
6c9a5e1f2d [VIM-1824] surround - remove whitespace with closing bracket
**Context**:

In vim surround extendsion closing brackets (`}, ], )`) should remove
whitespace when using `cs` movement.

Example:
- Before: `{ example }`
- Movement: `cs{}`
- After: `{example}`

This was because  were replaced with a string from `SURROUND_PAIRS` map,
which does not have any context about removing characters.

**Solution**:

Inspired from VSCode's VIM plugin[^1], I have introduced new class
`SurroundPair` that will carry this context about need to trim
characters.

**Disclaimer**:

I have never written in `Kotlin` so solution may be not use best
practices, though at least this PR seems to fix the problem and tests
are passing.

**Ticket**:
- https://youtrack.jetbrains.com/issue/VIM-1824/Vim-Surround-Does-not-remove-whitespace-with-the-closing-bracket

[^1]: 04fe42aa81/src/actions/plugins/surround.ts (L455)
2024-12-04 18:07:02 +02:00