Emulate Vim in IntelliJ IDEA
The IdeaVim plugin emulates Vim in the IntelliJ IDEA editor, including normal, insert, and visual modes, Command-line and Ex modes, Vim regexp and configuration, and other features.
Install the IdeaVim plugin
In the Settings/Preferences dialog (Ctrl+Alt+S), select Plugins.
Find the IdeaVim plugin in the Marketplace and click Install.
Restart IntelliJ IDEA.
After you restart the IntelliJ IDEA, Vim is enabled and the editor starts operating in the Vim mode. To disable it, deselectin the main menu.
Both Vim and IntelliJ IDEA are keyboard-centric. Your keymap in IntelliJ IDEA may conflict with Vim's key combinations. To resolve this, select the shortcuts you prefer for different actions.
In the Settings/Preferences dialog (Ctrl+Alt+S), select .
Find the shortcut and corresponding IDE action, and select how you want to handle it when you are using Vim:
Undefined: show a popup notification that suggests to either redefine the IDE shortcut or configure the handler in Vim emulation settings.
IDE: perform the IDE action associated with this shortcut.
Vim: handle it as a Vim shortcut.
With Vim, the cursor is a block when you are in the Normal mode:
To change to the Insert mode, press
i, and the cursor will become a line:
In this mode you can type new code or change existing code. You can also enter other Vim modes: for example, press
r for the Replace mode.
To return to the Normal mode, press Escape.
Vim is configured using a vimrc file. Similarly, the VimIdea plugin uses an ideavimrc file with the same syntax. Create the configuration file in one of the following locations depending on the operating system:
If you already have a vimrc file with your configuration, you can do one of the following:
Include the configuration from vimrc with the
sourcecommand in your ideavimrc file:source ~/.vimrc
This way you can also include other commands in your ideavimrc file, which will be applied only to your Vim in IntelliJ IDEA and will not affect actual Vim configuration.
If you don't want to use your Vim configuration, you can rename .vimrc to .ideavimrc.
Create ideavimrc as a symlink to vimrc if you don't want to modify your Vim in IntelliJ IDEA compared to actual Vim configuration:mklink _ideavimrc _vimrcln -s "$HOME/.vimrc" "$HOME/.ideavimrc"ln -s "$HOME/.vimrc" "$HOME/.ideavimrc"