The plugin can be configured via an ~/.config/ideavim/ideavimrc run config file. It is not that straight-forward becuase the plugin does not have a genuine vimscript parser, and uses hacky regex parsing. Therefore it is a good idea to write a dedicated vimrc configuration for the plugin, and not use the more general vimrc (vim.init) file used by vim/nvim.

The commands set, map etc are supported.

A list of set commands is listed in the documentation.

The map command can be used to resolve key binding conflicts. It supports two new constructs

  • actionlist {pattern}
  • action {name}

A list of supported IDE commands can be seen in the IDE after typing :actionlist. The list is also here that this gist.

A list of default keybindings can be seen here.

Builtin plugins

  • vim-surround
  • vim-commentary
  • vim-multiple-cursors

Add the following set commands to your ideavimrc

set surround
set multiple-cursors

Troubleshooting

Just use vim/nvim!

Okay I like Rider.

You can setup nvim as an external tool, and make a shortcut in the IDE to open nvim in the current file on the current line. This guide uses this trick. This works because we can start neovim on a specific line using

nvim +{linenumber} {path}

Structural Code Selections not working

Selecting content by some action, such as the EditorSelectWord (aka. Extend Selection) does not mean it is visually selected. That means that triggering the EditorSelectWord action and then performing something like c or d on it will not do anything. The issue is well documented here and here. To work around this issue, you have to enter visual mode after triggering the action - which, granted, is a bit of a hassle.

Keymap and action names

Keymaps can be printed from within the IDE using the keymap exporter plugin. This is not that useful IMO. A better (searchable) keymap can be found at the link, where all the keymaps are XML encoded. A keymap has a parent, and this represent inheritance in the OO kind of way. Another great way to interactively inspect the current keymap in the IDE is using the VimIdea plugin. If you type :actionlist showintent then all action names that matches the pattern showintent will be listed together with any keybindings.

--- Actions ---
ShowIntentionActions                               <A-CR>
ShowIntentionsGroup

This corresponds with the Show Context Actions mapped to Alt+Enter in the default keymap. The output uses the VIM conventions for describing keys

  • C: Control
  • A: Alt
  • S: Shift
  • CR: Enter
  • add more...

Note: M (meta) is something we try to avoid because this key works differently cross OS. Super (linux), Cmd (darwin) and Windows (windows) are keys we try to avoid using.

We can use the IdeaVim plugin again writing :action ShowIntentionActions<CR> in the IDE. This way we can ensure that we are talking about the correct command in the IDE.

The goal is 2-fold:

  • Define VIM keybindings
  • Learn (redefine) IDE keybindings

To make it all less complicated, I have decided to have any conflicts between VIM and IDE keybindings be defined to use VIM keybindings. Even if this means redefining standard VIM mappings in the ideavimrc file (<C-C> etc).

The hope is that we can just use the standard default Intellij Keymap in all IDE producs (Rider, Goland etc) and platforms (Win, Linux, Darwin). This is partly because it doesn't seem like sync settings work cross platform and product in the IDEs.