# Vim in IntelliJ IDEA

[IdeaVim](https://plugins.jetbrains.com/plugin/164-ideavim) is a Vim engine for the IntelliJ IDEA editor. It supports the normal, insert, and visual modes, Command-line and Ex modes, Vim regexp and configuration, and other features.

Procedure: Install the IdeaVim plugin

1. In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select Plugins.

2. Find the IdeaVim plugin in the Marketplace and click Install.

3. Restart IntelliJ IDEA.

After you restart the IntelliJ IDEA, Vim is enabled and the editor starts operating in the Vim mode. To disable it,  deselect `Tools | Vim` in the main menu.

Procedure: Configure shortcuts

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.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | Vim`.

2. Find the shortcut and the corresponding IDE action and then select how you want to handle it when you are using Vim:

![Vim settings](https://resources.jetbrains.com.cn/help/img/idea/2026.2/vim_shortcut.png)

* Undefined: show a popup notification that suggests to either redefine the IDE shortcut or configure the handler in the settings. ![Shortcut notification](https://resources.jetbrains.com.cn/help/img/idea/2026.2/vim_banner.png)

* IDE: perform the IDE action associated with this shortcut.

* Vim: handle it as a Vim shortcut.

## Editing modes

With Vim, the caret is a block when you are in the [Normal mode](http://vimdoc.sourceforge.net/htmldoc/intro.html#Normal).

![Vim Normal mode](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_vim_normal.png)

To change to the [Insert mode](http://vimdoc.sourceforge.net/htmldoc/insert.html#Insert), press `i`, and the cursor will become a line.

![Vim Insert mode](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_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](http://vimdoc.sourceforge.net/htmldoc/insert.html#Replace).

To return to the Normal mode, press `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)).

## Vim configuration

Vim is configured using a `vimrc` file. Similarly, the IdeaVim plugin uses an `ideavimrc` file with the same syntax.

Procedure: Create a .ideavimrc file

* In the status bar at the bottom of the IDE window, click the IdeaVim widget and select Create ~/.ideavimrc.

![Creating .ideavimrc file in widget](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ideavim_widget.png)

IntelliJ IDEA creates the file and opens it in the editor. You can use this widget later on to quickly access your `ideavimrc` file.

> **Tip:**
> You can find examples of the `ideavimrc` file in this [GitHub discussion](https://jb.gg/share-ideavimrc).

The configuration file will be created in one of the following locations depending on the operating system:

Windows:
`%HOMEPATH%\_ideavimrc`

macOS:
`~/.ideavimrc`

Linux:
`~/.ideavimrc`

> **Note:**
> The location where IntelliJ IDEA looks for `ideavimrc` depends on the `user.home` JVM option, which is set to the user's home directory by default. For more information, refer to [JVM options](tuning-the-ide.html#configure-jvm-options).

Procedure: If the configuration already exists

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:

```PLAINTEXT
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:

Windows:

```SHELL
mklink _ideavimrc _vimrc
```

macOS:

```SHELL
ln -s "$HOME/.vimrc" "$HOME/.ideavimrc"
```

Linux:

```SHELL
ln -s "$HOME/.vimrc" "$HOME/.ideavimrc"
```

## IDE actions

IdeaVim allows you to map IDE features using action IDs.

Procedure: Learn an action ID

1. Press `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)) and type `IdeaVim: Track Action Ids`.

2. Toggle the feature on using the switcher on the right.

![Enabling the Track Action Ids feature](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ideavim_track_id.png)

Now the IDE will be showing you IDs of actions that you click with the mouse in a popup notification at the bottom of the screen and in the [Notifications](notifications.html) tool window. Note that some actions do not have an ID.

![Actions IDs are displayed](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ideavim_ids_displayed.png)

3. Click Copy Action Id to copy an ID or Stop Tracking to disable the tracking mode.

Procedure: Map an action in ideavimrc

1. In the `ideavimrc` file, map an action using the `map` command and the `<Action>` keyword, for example: `map \r <Action>(ReformatCode)`

2. Press `Ctrl+Shift+O` (Windows), `Ctrl+Shift+O` (macOS), `Ctrl+Shift+O` (IntelliJ IDEA Classic (macOS)), `Ctrl+Shift+O` (macOS System Shortcuts), `Ctrl+Shift+O` (XWin), `Ctrl+Shift+O` (GNOME), `Ctrl+Shift+O` (KDE), `Ctrl+Shift+O` (Emacs), `Ctrl+Shift+O` (Sublime Text), `Ctrl+Shift+O` (Sublime Text (macOS)), `Ctrl+Shift+O` (NetBeans), `Ctrl+Shift+O` (Visual Studio), `Ctrl+Shift+O` (Visual Studio (macOS)), `Ctrl+Shift+O` (Eclipse), `Ctrl+Shift+O` (Eclipse (macOS)) to reload the changes.

> **Tip:**
> You can also execute actions as Ex commands. For more information, refer to [IdeaVim documentation](https://jb.gg/abva4t).

## See also

### External Links

[IdeaVim documentation](https://jb.gg/abva4t) [Examples of ideavimrc](https://jb.gg/share-ideavimrc)

