Use Vim Editor Emulation in RubyMine (IdeaVim)
The IdeaVim plugin emulates Vim in the RubyMine 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 RubyMine.
After you restart the RubyMine, Vim emulation is enabled and the editor starts operating in the Vim mode. To disable it, deselect
in the main menu.Configure shortcuts
Both Vim and RubyMine are keyboard-centric. Your keymap in RubyMine 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 emulation:
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.
Editing modes
With Vim emulation enabled, the cursor is a block when you are in the Normal mode:
![Vim emulation Normal mode Vim emulation Normal mode](https://resources.jetbrains.com/help/img/idea/2021.1/rm_vim_normal.png)
To change to the Insert mode, press i
, and the cursor will become a line:
![Vim emulation Insert mode Vim emulation Insert mode](https://resources.jetbrains.com/help/img/idea/2021.1/rm_vim_insert.png)
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 configuration
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
source
command in your ideavimrc file:source ~/.vimrcThis way you can also include other commands in your ideavimrc file, which will be applied only to your Vim emulation in RubyMine 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 emulation in RubyMine compared to actual Vim configuration:
mklink _ideavimrc _vimrcln -s "$HOME/.vimrc" "$HOME/.ideavimrc"ln -s "$HOME/.vimrc" "$HOME/.ideavimrc"