intellij-ideaideavim

How can I map Ctrl-W to close the current editor tab when using IdeaVim + IntelliJ IDEA?


I want Ctrl-W to close the current editor tab in IntelliJ IDEA. I use IdeaVim, and somehow that seems to be thwarting my attempts.

Things I've tried that didn't work:

I've also tried using the normal vim key of "Ctrl-W c", but this closes all editor tabs, not just the current one.

IdeaVim also doesn't seem to know either :wincmd or :tabclose.

Is there any way to set Ctrl-W as a shortcut for closing the current editor tab while IdeaVim is active (ideally in normal mode, but all modes would be fine too)?


Solution

  • I'm using Android Studio, which is built on IntelliJ, and this works for me:

    Go to Settings → Other Settings → Vim Emulation, then change the Ctrl+W shortcut to be handled by IDE.

    Screenshot of Vim Emulation settings

    You probably also need to add the Ctrl+W shortcut to Settings → Keymap → Main menu → Window → Editor Tabs → Close. But you said that you have already done it.