ideavim — whats-new — 80×24

~ $ ideavim

Here's what landed in 2.47.0.

navigation · tag stack

Go to definition, then find your way back

IdeaVim now keeps a tag stack, just like Vim. <C-]> remembers where you jumped from, <C-T> and :pop walk back up those positions, :tag walks back down again, and :tags shows the whole stack with > marking where you are. Every command takes a count, so 2<C-T> goes back two jumps at once.

<C-]>     " jump to the definition and push the position
<C-T>     " ... and come back to where you were
:tags      " list the stack
:2pop      " step back two tag jumps

set notagstack   " jump without recording anything

The stack holds twenty entries. <C-T> used to be a second key for <C-O>; it now walks the tag stack as in Vim, and <C-O> is still the way through the jump list. gd and gD leave the stack alone.

settings · ideavimrc

Pick your ideavimrc

You can now choose where the ideavimrc file lives in Settings | Editor | Vim. The path can use ~, environment variables such as $VAR and IDE path macros, so every IDE can have a config of its own:

$APPLICATION_CONFIG_DIR$/ideavim/ideavimrc

Leave the field empty to keep using the default locations. They are also used while the file you picked doesn't exist yet.

performance · search

Fast typing, even with thousands of matches

With 'hlsearch' on, a pattern that matched all over a large file used to slow down typing and scrolling, because every single match was highlighted, including the ones far off screen. IdeaVim now highlights only the matches in and around the visible part of the editor and adds more as you scroll, so big files stay smooth.

Nothing changes in how search works: n and N still find every match in the file.

new plugin · marks

See your marks in the gutter

The bundled vim-signature extension puts an icon in the gutter for every local mark a–z, so you can see where your marks are instead of having to remember them. It also comes with commands to place, clear and walk through them. Every one of them is a jump, so '' and <C-O> bring you back.

Plug 'kshenoy/vim-signature'

m,          " place the next free mark
m-          " clear the marks on this line
m<Space>    " clear every mark in the buffer
]' / ['     " next / previous marked line
`] / `[     " next / previous mark by letter

Every key is a <Plug> mapping, so you can keep Vim's own '] and `[ marks if you prefer. Global marks are left out because with the default ideamarks they are IDE bookmarks, which the IDE already shows.

new plugin · search

Search for the selection with *

Turn on the bundled vim-visual-star-search extension and * and # in Visual mode search forwards and backwards for the selected text instead of the word under the caret. The text is matched literally, so ., * and [ just match themselves, and linewise and blockwise selections work too.

Plug 'bronson/vim-visual-star-search'

viw*   " find the next occurrence, even inside a longer word
3*     " counts work: jump to the third match

n and N repeat the search, gv brings back the selection, and <C-O> returns to where you started. The search follows 'ignorecase' and 'smartcase'.

ex commands · file names

% means the current file, everywhere — and # the alternate one

% and its file name modifiers now work when a command runs, not only when Tab completes it. :w, :!, :source, :split and :read all accept it, and the modifiers chain from left to right as they do in Vim.

:w %:h/backup.txt           " write a copy next to the current file
:!mv % %:h/renamed.txt      " rename it
:e %:h/<Tab>                " complete the files in the same directory

" :p full path · :h directory · :t file name · :r drop extension · :e extension

Next to "%, there's now a "# register that holds the alternate file, the one <C-^> jumps back to. "#p pastes its name, @# reads it in an expression, and it shows up in :registers.

splits · jump list

A jump list for every split

With the new 'ideawindowjumps' option, every split gets its own jump list, as in Vim. A new split starts with a copy of the list of the window it came from, and after that the two are separate, so <C-O>, <C-I> and :jumps only see the jumps made in the window you are in.

set ideawindowjumps

The IDE's own Back and Forward navigation still covers the whole project.

consoles · run & debug

Vim in the run and debug consoles

Vim now works in the console of a run or debug configuration, such as the console of an application you are debugging. The new 'ideaeditor' option lists the non-file editors IdeaVim is active in: python for the Python console and debug for run and debug consoles. Both are on by default.

set ideaeditor-=debug    " give the debug console its native keys back
set ideaeditor-=python   " ... or the Python console (replaces 'nopythonconsole')

ex commands · autocommands

Start typing straight away

:startinsert and :startreplace are the counterparts of :stopinsert. They enter Insert or Replace mode as i and R do, and the ! forms start at the end of the line, like A and $R. They work with every caret and are meant for autocommands.

autocmd BufEnter scratch startinsert   " open the scratch buffer ready to type

also worth a look

vim-textobj-line

Enable Plug 'kana/vim-textobj-line' for two line text objects: al is the whole line without its line break, and il leaves out the leading and trailing white space. So dil deletes the code and keeps the indent.

'wildmenu'

set nowildmenu turns off the completion popup on the : command line. Tab still cycles through the matches one at a time.

'autoindent'

With set noautoindent, o, O, cc, S and Enter start the new line with no indent. And cc<Esc> now leaves a truly empty line, as in Vim.

All options start with idea

Every IdeaVim-only option now has the idea prefix, so it's clear which options are IdeaVim's. 'lookupkeys', 'trackactionids' and 'visualdelay' are now 'idealookupkeys', 'ideatrackactionids' and 'ideavisualdelay'. The old names still work.

matchit b:match_words

Teach % your own word pairs: set b:match_words to 'if:elsif:else:end' and it cycles through if, elsif, else and end.

Line comments in commentary

Set g:commentary_block_comments to 0 to always comment out whole lines, as the original plugin does, instead of using a block comment for gciw.

Small additions

<C-W>q closes the current window, and in NERDTree <C-D> and <C-U> move the selection half a page down and up.

polish & fixes

  • Action mappings with no file open — a mapping such as map <leader>sf <Action>(GotoFile) now works when every editor tab is closed and the focus is on something like the Project tool window. Counts, 'timeout' and Esc behave as they do in an editor.
  • No leftover box after a search — the box around the current match now only appears while 'incsearch' is previewing the pattern you are typing, as in a stock Vim.
  • . doesn't replay auto-imports — when the IDE adds an import while you type, repeating the change with . now repeats only what you typed.
  • HTML and XML tags rename in pairs — editing a tag name in Insert mode or with r updates the closing tag too, so <tag></tag> becomes <tas></tas>.
  • gv gets it right — after :'<,'>sort, gU or g?, gv reselects all the changed lines. In Visual mode it no longer selects one character too many.
  • Visual mode mappings in Select mode — a :map or :vmap mapping now runs as if in Visual mode and then returns to Select mode, instead of its keys being typed over the selection.
  • Visual r caret — after replacing a selection with r, the caret lands on the first replaced character, as in Vim.
  • End can go to the IDE — sethandler <End> a:ide now works for End and its Ctrl/Shift variants.
  • da( in nested blocks — deleting an inner block that closes on the same line as the outer one no longer takes the outer bracket with it.
  • Blockwise-forced yanks — y<C-V>j now yanks the whole block, not only its first line.
  • gx leaves the jump list alone — opening a URL no longer records a jump, so <C-O> still takes you back to where you were before.
  • Edge-of-file errors — word text objects that reach the start of the file and <C-R><C-F> on a match at the very end of the file no longer report internal errors.
  • Clean switch-off — disabling, uninstalling or updating IdeaVim without restarting the IDE no longer reports an error, and afterwards the keys work as if IdeaVim had never been installed.