Commit Graph
2307 Commits
Author SHA1 Message Date
chylex ae17f39720 Revert "remove restriction not selecting new line char"
This reverts commit 8b97cd8b
2026-11-23 02:10:50 +01:00
chylex 4753c3fbc0 Fix backwards motions to unmatched parenthesis/brace consuming the character 2026-11-23 02:10:49 +01:00
chylex e69419677e Prevent caret from moving left when exiting insert mode at end of empty line 2026-11-23 02:10:49 +01:00
chylex f1eb1ce1d0 Make g0/g^/g$ work with soft wraps 2026-11-23 02:10:48 +01:00
chylex 7672fa417d Make gj/gk jump over soft wraps 2026-11-22 19:45:04 +01:00
chylex eefc4d81af Make camelCase motions adjust based on direction of visual selection 2026-11-22 19:45:04 +01:00
chylex aa94f464ee Stop macro execution after a failed search 2026-11-22 19:45:03 +01:00
chylex 1137faac14 Fix losing yanked text when number of carets changes 2026-11-22 19:45:03 +01:00
chylex 941f79fb91 Update search register when using f/t 2026-11-22 19:19:27 +01:00
chylex 58d540b1fc Make 'map' not affect Select mode 2026-11-22 04:15:45 +01:00
1grzyb1 0bb539e538 VIM-2609 Measure line indent with the code style tab size when shifting
Shifting lines took the current indent width from the editor's logical
column, which expands tabs with the editor's tab size, but built the new
indent with the code style tab size. When those differ (e.g. language
injections, indent detection), each shift added stray spaces after the tabs.
2026-11-20 12:23:20 +01:00
1grzyb1 9fc1b4bc45 VIM-2608 Place block insert replay at buffer columns
The repeat column of a block insert/change is a buffer (logical) column,
but the replay on the following lines moved the caret to that number as a
visual column. The two differ whenever the line has collapsed folds or
when tab widths in pixels make a tab count as more visual columns than its
logical width, so after a few leading tabs the text went in one character
too early. Move to the buffer position instead and check line length in
buffer columns.
2026-11-19 12:24:20 +01:00
1grzyb1 9e80c279fd VIM-2726 Do not map keys inserted with CTRL-V or CTRL-K
A character typed after CTRL-V, or the one made from a CTRL-K digraph,
was fed through the key handler again with mappings allowed, so with
inoremap a b, <C-V>a inserted b. It also made it impossible to type a
straight quote while textobj-quote educates quotes, since <C-V>" ended
up in the " mapping. Vim reads these keys without mappings and inserts
the result as it is.
2026-11-19 10:39:45 +01:00
1grzyb1 38c5318528 VIM-2726 Allow autoload names in variables
Plugins configured through autoload-style variables, such as
g:textobj#quote#doubleMotion, could not be set from .ideavimrc: the
grammar accepted the # namespace separator only in function names, so
the assignment silently did nothing. Variable names now take the same
foo#bar# prefix as function calls and keep it as part of the name.
2026-11-19 10:39:45 +01:00
1grzyb1 dc8ce895d1 VIM-4374 Push IDE navigation to a declaration onto the tag stack
Only <C-]> pushed onto the tag stack, so Ctrl+Click and the other ways to run Go to Declaration left nothing for <C-T>
to return to: it reported an empty stack or went back to an older <C-]>. The tag stack is now filled by the IDE action
listener for Go to Declaration, Go to Type Declaration and Go to Implementation, however they are invoked: mouse,
shortcut, <Action> mapping, :action, <C-]> and gd.

:tag without an argument redoes a jump that is already on the stack by running Go to Declaration again. It passes
TAG_STACK_PLACE as the action place, which travels with the event even when the action runs asynchronously, so the
listener can skip it. The place goes through a new VimActionExecutor overload to keep the published API compatible.

Rider's ReSharper navigation still isn't covered: the IDE hides the real action behind a composite there.
2026-11-16 09:49:40 +01:00
grzybek 102c3b9a8d Move autoselect to the engine
Engine now publishes the visual selection to PRIMARY itself and remembers the type of every write in lastWrittenToSelection, the IJ side only says if PRIMARY is still ours. Old ownership methods stay in VimClipboardManager with defaults.
2026-11-13 08:27:15 +01:00
grzybek 25d26b0b4a Run primary clipboard tests on every machine
TestWithPrimaryClipboard and TestWithoutPrimaryClipboard now set the mode instead of skipping, so both run locally and on CI. hasPrimarySelection moved to SystemInfoService.
2026-11-13 08:27:15 +01:00
grzybek b4247f1012 Remember type of the last write to each selection
With unnamed a yank to * is copied to CLIPBOARD, but the + register wasn't updated, so "+p lost the block type. + and * now recover the type in one function.
2026-11-13 08:27:15 +01:00
grzybek 275fba40e2 Keep + in * through one function when there is no PRIMARY
Same as Vim with one clipboard, but every read and write mapped it on its own, so "+y stored the type under + while reads looked under *. Blockwise "+y was pasted characterwise.
2026-11-13 08:27:15 +01:00
grzybek dee92cb2c4 Move + and * register rules into SystemRegisterPolicy
Default register and which selections a write goes to were nested ifs in onClipboardChanged, storeText and saveRegister. Now it's two pure functions tested as a table.
2026-11-13 08:27:15 +01:00
1grzyb1 6771366e32 VIM-4329 Measure the vertical scroll layout in pixels
- Block inlays and tall lines, e.g. rendered doc comments, are not whole rows, so counting them in rows put the caret in the wrong place.
- The layout and VerticalScroll now work in pixels. scrolloff and scrolljump are still rows and are converted to pixels.
- H, M and L tests check exact positions again, and cover block inlays below methods.
2026-11-09 09:02:44 +01:00
1grzyb1 2db21055bd VIM-4329 Split VerticalScroll into small named steps
The model was a close port with long loops, nested conditions on line and
filler positions, and flag arguments that changed what a function did. It
was hard to follow which rows were being counted and why.

Each step now has a name: walking up and down a filler row or a line at a
time with predicates for where that is relative to the window, counting
the rows for the cursor at the bottom in its own class, and separate
functions for zt and zb and for scrolling the cursor into view. Three
conditions that could never be true are gone. The behaviour is the same,
checked against the previous version on random layouts.
2026-11-06 10:51:59 +01:00
1grzyb1 1e1e8bd67d VIM-4329 Scroll with the row based model
scrollCaretIntoView, zt, zb, zz, CTRL-E and CTRL-Y now ask the vim-engine model what to show, and keeping the caret inside 'scrolloff' after scrolling (CTRL-E, CTRL-D, CTRL-F, H, L, the mouse wheel with 'ideascrollcursor') uses its cursor_correct. EditorWindowLayout measures the editor for it: the rows of each visual line, including the full height of a custom fold region, and the block inlays between lines as filler. It is also the one place that knows about the sticky lines panel, the command line or output panel over the bottom of the editor, and how far the editor can scroll.

This replaces counting lines against a window height that was itself a line count, and the special cases that grew around it: falling back to pixels when block inlays took up most of the window, showing at most 3 rows of an inlay at the edge, and normalising 'scrolloff' to half of an approximate height. Inlay rows now count towards 'scrolloff' everywhere, and CTRL-E and CTRL-Y step through an inlay one row at a time.

It also fixes scrolling in the second half of a soft-wrapped file (zt, CTRL-E, CTRL-F and moving up with 'scrolloff' stopped, as the scroll limit used the logical line count as a visual line), zb on a rendered doc comment leaving most of it below the screen, the caret scrolling off the screen next to an inlay taller than the window, and an open output panel never being taken off the bottom of the window.
2026-11-06 10:51:59 +01:00
1grzyb1 82b6d26f4d VIM-4329 Add a row based model of vertical scrolling to vim-engine
Scrolling counted lines in some places, pixels in others, and special-cased block inlays, sticky lines and soft wraps on top. This adds one model that counts rows: a window layout gives the rows of each line and of the filler between lines, and update_topline, scroll_cursor_top, scroll_cursor_bot, scrollup, scrolldown and cursor_correct work on it. Wrapped lines, folds, tall lines and inlays are then just rows, and filler rows count towards 'scrolloff'.

It doesn't depend on the IntelliJ editor, so it is tested on a fake layout. Nothing uses it yet.
2026-11-06 10:51:59 +01:00
1grzyb1 820b1e9dca VIM-2527 Let each virtual buffer kind describe how it is shown
Every new virtual buffer needed its own open/refresh methods in
VirtualBufferGroup and a branch in several `when`s spread over the group,
the cmdwin and the <CR> handler. A kind now carries its own flags (read-only,
viewer, exclusive, reused when open) and its <CR> behaviour, so the group
only has the generic open/refresh, and the help, quickfix and action list
kinds live next to their features.

The :actionlist help text moves to the command description, since the help
file is generated from the descriptions.
2026-11-04 09:41:15 +01:00
1grzyb1 3d5cff6a22 VIM-2527 Execute the action on the line with <CR> in the :actionlist window
The list is mostly used to look up an action, so running it right from the
list saves copying the ID into an :action command. The action runs in the
window the list was opened from, since editor actions work on the editor they
are invoked in.
2026-11-04 09:41:15 +01:00
1grzyb1 d8dd3a3550 VIM-2527 Open :actionlist in a read-only buffer
The output panel is a pager that supports neither searching nor regular
motions, which makes exploring the long list of action IDs painful. The list
now opens in a read-only virtual buffer, like :help and the quickfix list, so
all the normal-mode navigation and search work there. Running the command
again reuses the open window with the new search result.
2026-11-04 09:41:15 +01:00
1grzyb1 567d9bdf31 VIM-4346 Bring back createPanel without the command line type
Adding the type parameter to createPanel removed the old signature, and
the multicursor plugin still calls it, so it would fail with
NoSuchMethodError. The old signature now guesses the type from the label,
the same way readInputAndProcess does.
2026-11-03 11:26:51 +01:00
1grzyb1 8d04e0a0fd VIM-4368 Split NormalCommand.processCommand into steps that say what they do
The command did everything in one loop, and the two ways it runs - once from Insert mode, or once for each line of
the range - were mixed together through an early return in the middle of it. Each of them is now its own function, and
typing the keys and abandoning a command the keys left unfinished have names of their own.

From Insert mode, Insert mode now comes back even when the line of the range is past the end of the buffer and the
keys don't run at all.
2026-11-03 11:23:10 +01:00
1grzyb1 04e9869b76 VIM-4368 Let surround read its character from :normal and surround each line of a block
A handler that waits for a character, like the one of `yss`, takes it from the key stack, and only if there is none
there, from the keyboard. :normal fed its keys to the key handler one by one, past the key stack, so the `"` of
`:normal yss"` was still waiting in its loop while the handler waited for the user to type something. The keys of
:normal now go through the key stack, as the keys of mappings and macros do.

`S` in Visual block mode surrounded only the selection of the primary caret, which is the one on the last line. Each
line of the block has a native caret with its own selection, and each of them is now surrounded, from the bottom up so
that the text inserted on a line doesn't move the lines above.
2026-11-03 11:23:10 +01:00
1grzyb1 fc7140c247 VIM-2524 Indent the line emptied by cc in Rider
The indent was only worked out where the language has a formatter. Rider has
no formatter for C# on the frontend (formatting lives in the ReSharper
backend), so cc and S left the line with its old indent.

Rider's frontend has a LineIndentProvider that works out the C# indent, but
also a dummy one answering DO_NOT_ADJUST, and CodeStyle.getLineIndent only
asks the first provider of a language. Ask all of them and take the first
indent, and fall back to the formatter only if none of them answers.
2026-11-03 10:04:35 +01:00
1grzyb1 ef4174295f VIM-4365 Move AIR support into an optional ideavim-air module
The AIR prompt was recognised and handled in several places of the core
by AIR's internal key names and action ids. Everything AIR-specific now
lives in the ideavim-air module, which only loads with the AIR plugin and
implements the new ChatInputProvider extension point. The core asks the
provider whether an editor is a chat prompt, whether the chat owns a key,
and which action breaks a line.

The line-break action is now also used by processEnter, so <C-J>, <C-M>
and mappings ending in <CR> break the line in the AIR prompt. Before,
they ran the platform's Enter action, which AIR turns into a no-op there.
2026-11-02 11:29:02 +01:00
1grzyb1 604d4ca6df VIM-4351 Match the files of a chain of changes by path, stop <C-O> reporting an error
A "Show Diff" tab of changes in version control was matched by the names of
its diffs, which only some diffs name after the path of the file. Its
changes know the path, through PresentableChange, which lives in
intellij.platform.vcs.impl. ideavim-vcs depends on it already, so it now
knows such chains too, and the providers come before the match by name,
which stays for chains of other diffs.

<C-O> to another file moves the caret in the other editor and then
returned Motion.Error, which made IdeaVim report an error after a jump that
worked. It returns Motion.NoMotion now. Marks, the tag stack and the change
list do the same when they go to another file, and are left for later.
2026-11-02 10:56:07 +01:00
1grzyb1 e3c95eb14b Fix(VIM-4351): Bring back the diff editor with <C-O> in split mode
In split mode the diff tab lives on the backend: the frontend only shows
it, with editors that mirror the backend's ones. IdeaVim runs on the
frontend, so it found no diff tab and fell back to the plain file.

- The diff code moved to ideavim-common, so it runs on both sides, and
  uses only the platform: the backend has no IdeaVim injector. The
  frontend looks for a local diff tab first (monolith), and otherwise
  asks the backend through JumpRemoteApi. The mirrored editors share the
  backend editors' EditorId, so the backend finds the real diff editor.
- On the backend, split mode keeps a diff tab in its own file editor
  (DiffRequestDirectTransferEditor), which exposes the diff only as a
  `processor` property. There is no public API for it, so it is read by
  reflection, with the old behaviour as the fallback.
- A write action can't wait for the backend, so a jump recorded during
  one stays a plain file jump, as before.
- The left side of a diff from version control has a document with a
  LightVirtualFile, so it counted as "in the file": such a jump was saved
  across restarts and came back as the plain file at the wrong line.
  Only a file on disk counts now. The tests use such a left side too.

Two jump bugs showed up on the way, not specific to diffs:

- <C-O> could stay where the caret already was, when the IDE had already
  recorded that place as the newest jump (e.g. after clicking another
  file in the Commit tool window). Leaving the newest end of the jump
  list now adds the place of the caret first, which replaces the older
  jump to it, and then goes back, as Vim does.
- In split mode, jumping to a file that wasn't open didn't place the
  caret: selectEditor looked for the frontend editor right after the RPC,
  before the frontend has it, so the file opened wherever it was last
  left. The backend now opens the file at the position, for jumps, marks,
  the tag stack, the change list and quickfix.
2026-11-02 10:56:07 +01:00
1grzyb1 a8eb19380a Fix(VIM-4351): Bring back the diff editor with <C-O>
A jump only stored the file and line, so a jump recorded in a diff tab
came back as the plain file. Jumps now record where they were made
(JumpSource): a plain editor, or a side of a diff tab.

- The position is kept per side of the diff, not per view. The user can
  switch a tab between side-by-side and unified at any time, so each view
  translates the side's line to its own editor.
- A side that shows the file itself can come back in any other diff of
  the file, or as the plain file once no diff shows it: the file looks
  the same everywhere. A side showing anything else (e.g. the old
  revision) only exists in its own tab, so once that tab is closed its
  jump is dropped from the list and <C-O> goes on to the next one. Such
  jumps are not saved across restarts.
- A tab can show many files one at a time. Which files and how to switch
  depends on the tab, so it is behind DiffTabFiles: "Show Diff" chains
  in the core, and previews that follow a tree of changes (Commit, VCS
  Log, Shelf, staging) in the new optional ideavim-vcs module, because
  ChangeViewDiffRequestProcessor lives in intellij.platform.vcs.impl.
- Selecting the file in the tree is protected before 2026.3, so older
  IDEs only switch the preview and it follows the tree again on the next
  refresh. 2026.3 adds showChange(FilePath), called by reflection until
  it is the minimum version.
- One rule decides which jumps are the same place (Jump.isSamePlaceAs):
  file, line and source. The same line in a diff and in a plain editor
  are two jumps. The ' mark records its jump with the editor's source,
  otherwise it duplicated the diff jump as a plain file one.
- The API keeps seeing only files: jumps added through it are plain file
  jumps.
2026-11-02 10:56:07 +01:00
1grzyb1 1b848a9269 VIM-4365 Open a new line with o and O in the AIR prompt
AIR turns the platform's line-break editor actions (EditorEnter and
friends) into no-ops in its prompt and breaks a line only with its own
Air.Chat.Prompt.NewLine action. o and O run EditorEnter, so in the prompt
they only moved the caret to the line end and entered Insert mode.

In an AIR prompt, o and O now run Air.Chat.Prompt.NewLine instead.
2026-11-02 10:52:41 +01:00
1grzyb1 27aabf8301 VIM-4329 Fix k movement scrolling with so=9999
The sticky lines panel's height depends on the scroll position, so an exact middle doesn't always exist, and the old tolerance range let the previous position count as centred after every other k; instead, try the middle for each panel height we find and keep the closest position, staying put on a tie unless the caret moved to another line, so moves always scroll but typing never scrolls back and forth.
2026-10-27 11:40:44 +01:00
1grzyb1 87bd828e2d VIM-4346 new API to open ex entry panel
Now entry panel knows what type of action opened it and can perofrm opartions according to it's type
2026-10-27 09:21:04 +01:00
1grzyb1 ea8e3bd1ae VIM-4349 parse ' and ` keycodes in mappings 2026-10-26 12:57:36 +01:00
1grzyb1 238a696594 VIM-2342 Document fugitive extension and quickfix commands 2026-10-26 09:41:18 +01:00
1grzyb1 8d9a16d995 VIM-2342 Add cclose command 2026-10-26 09:41:18 +01:00
1grzyb1 97ae43ee55 VIM-2342 Add copen command
Shows the quickfix list in a read-only window that follows the current item. Enter on a line jumps to that item in the window copen was run from
2026-10-26 09:41:18 +01:00
1grzyb1 712adc3093 VIM-2342 Implement cfirst and clast commands 2026-10-26 09:41:18 +01:00
1grzyb1 96d5ca8388 VIM-2342 Implement cpfile command 2026-10-26 09:41:18 +01:00
1grzyb1 3906c8f38f VIM-2342 Implement cnfile command 2026-10-26 09:41:18 +01:00
1grzyb1 57a6952543 VIM-2342 Keep quickfix list per project 2026-10-26 09:41:18 +01:00
1grzyb1 f1a8ae4789 VIM-2342 Add cprev command 2026-10-26 09:41:18 +01:00
1grzyb1 0f2d81233d VIM-2342 Add cnext to jump to next item in quickfix list
Ggrep works based on quickfix list and we didn't have implementation of that so we need to support it first
2026-10-26 09:41:18 +01:00
1grzyb1 78b82c395f VIM-2342 Add fugitive extension with grep command 2026-10-26 09:41:18 +01:00
1grzyb1 8a183c5159 VIM-2200 Open the command-line window with <C-F> from the command line
Editing a long command or search pattern is easier with Normal mode motions than in the one-line command line.
2026-10-21 12:01:59 +02:00