ideavim — whats-new — 80×24

~ $ ideavim

Here's what landed in 2.48.1.

ex commands · help

:help right inside the IDE

:help now opens IdeaVim's own read-only help file in the editor instead of a web page. It lists every supported command with a description of what it does in IdeaVim, and you can jump straight to a topic.

:help :s          " how :substitute works in IdeaVim
:help i_CTRL-W    " what <C-W> does in Insert mode

ideavimrc · completion

No more guessing action IDs

On the command line, press Tab or Shift+Tab after :action or :actionlist to cycle through the matching action IDs. In your .ideavimrc, code completion suggests action IDs, along with their names and descriptions, inside <Action(...)> and after action.

:action Goto<Tab>                " cycle through matching IDs
map <leader>f <Action>(Goto   " in .ideavimrc, completion suggests IDs here

editors · ai chat

Vim in AI Assistant chats and plugin editors

The 'ideaeditor' option has two new values. chat turns Vim on in the prompt input of JetBrains AI Assistant chats, and main covers tabs in the main editor area that are not backed by a regular file, such as editors that plugins open for in-memory or decrypted content.

set ideaeditor+=chat   " Vim keys in the AI chat input
set ideaeditor+=main   " ... and in plugin-provided editor tabs

Both are off by default. The chat input starts in Insert mode, so Enter still sends the message.

new plugin · multiple cursors

vim-visual-multi, on the IDE's own carets

The bundled visual-multi extension brings the vim-visual-multi workflow to IdeaVim, built on the IDE's native multiple carets. Select a word, keep adding its next occurrences, skip the ones you don't want, and then edit them all at once with ordinary Vim commands.

Plug 'mg979/vim-visual-multi'

<C-n>               " select the word under the cursor, then add the next one
\\A                  " select every occurrence
<C-Down> / <C-Up>   " add a cursor on the line below / above
n / N               " next / previous occurrence
q / Q               " skip / remove a region
<Tab>               " switch between regions and cursors

\\z, \\@, \\C and \\a run a :normal command, run a macro, convert case and align the cursors. Keys can be changed with g:VM_maps and g:VM_leader.

new plugin · motions

Just press f again

With the bundled clever-f extension, there's no need to reach for ; and ,. After f{char}, pressing f again jumps to the next {char} and F to the previous one. F, t and T work the same way, searches cross line boundaries, and the characters you can jump to on the cursor line are highlighted.

Plug 'rhysd/clever-f.vim'

fa     " jump to the next "a"
f      " ... and the one after that
F      " ... and back again

let g:clever_f_smart_case = 1   " tune it with g:clever_f_* variables

ex commands · bar

Chain :s and :sort with |

| now separates Ex commands that take a pattern or free-form argument, so you can run several substitutions in one go, or sort and then keep on editing.

:%s/foo/bar/|%s/baz/qux/   " run both substitutions
:%sort u|1d                " sort, then delete the first line
:%sort /a|b/               " a | inside a :sort pattern stays part of it

A \| inside the pattern or replacement is still regex alternation or a literal |. As in Vim, :global, :vglobal, :normal and :! take the | as part of their argument.

scrolling · mouse

The caret follows the mouse wheel

With the new 'ideascrollcursor' option, scrolling with the mouse wheel or the scrollbar moves the caret with the text, keeping it 'scrolloff' lines from the edge of the window, as in Vim.

set ideascrollcursor

It is off by default.

also worth a look

keylog

Enable set keylog to write every key you type to a file, like Vim's -w. The keys go to ideavim.log next to your ideavimrc, or to g:keylog_file.

sethandler for Enter and Esc

<CR>, <Esc> and the arrow keys can be handed to the IDE, e.g. sethandler <CR> i:ide. sethandler a:ide still leaves them to Vim.

NERDTree navigation keys

j, k, gg, G, <C-D>, <C-U> and / can now be remapped, e.g. let g:NERDTreeMapSelectNext = '<C-N>', without restarting the IDE.

:function

List your user-defined functions: :function shows them all, :function MyFunc shows one, and :function /pattern filters by name.

polish & fixes

  • No freeze when searching big files — the search count for /, n and * is now worked out in the background and shown when it's ready.
  • . replays what you typed — as in Vim, repeating a change replays your keys, so a tag rename like cwdiv<Esc> renames the closing tag too, and accepted completions are repeated with the completed text.
  • Visual mode reaches the end of line — v$ now takes in the line break, so v$x joins the next line and v$y yanks the trailing new line.
  • V on collapsed folds — linewise Visual mode now selects the whole folded region, so Vd on a collapsed <div> deletes the entire tag.
  • Dead keys and input methods — they no longer type text in Normal or Visual mode, and a composed character can be a command argument, e.g. fé.
  • Smarter cc and S — on an empty or blank line they now indent to match the surrounding code.
  • Paste in Replace mode — Cmd+V/Ctrl+V overwrites the characters under the caret, and <BS> puts them back.
  • Middle-click paste on Linux — in Insert mode it pastes the * register at the caret instead of moving the caret to the mouse first.
  • scrolloff and sticky lines — set scrolloff=999 keeps the caret centred again, typing no longer scrolls the editor, and k no longer hides the caret under the sticky lines panel.
  • Surround tags with Enter — ysiwtem<CR> now finishes the tag prompt, the same as typing the closing >.
  • multiple-cursors I and A — on occurrences selected with <C-n> they insert before or append after each selection.
  • gr across lines — the ReplaceWithRegister extension now replaces only the selected text when a characterwise selection spans lines.
  • Precise = in CLion Nova — == reformats only the given lines, not the whole file.
  • Popups with no file open — Enter and Esc work in Recent Files and Search Everywhere, and Space-leader action mappings work in the Project tool window.
  • NERDTree speed search in popups — / works in trees such as the File Structure popup.
  • Alt mappings for ' and ` — nmap <A-'> w no longer fires on unrelated keys like <A-Right>.
  • 'langmap' applied once — keys typed after a mapping that didn't match are no longer translated twice.
  • Messages stay open — the message shown by n no longer closes while it is still being updated.
  • % and apostrophes — in (it's) y's, % on ( now jumps to the matching ), and % in an empty file no longer errors.
  • Expand Selection in Rider — it no longer stops at the current word in Visual mode when the caret is on the word's last character.
  • Vimscript fixes — :continue in a :for loop no longer hangs, slice([1, 2, 3], 0, 0) returns [], and the history functions accept "?".
  • Fewer internal errors — :/ and :? with an empty pattern use the last search, :tags copes with deleted lines, and \< searches work while the command-line window is open.