Escape to IntelliJ IDEA shortcuts from IdeaVim

A keymap without any bindings here: to be used, so one could start from clean slate configuring the .ideavimrc


I made .ideavimrc that contains bindings for all conflicted mappings. Maybe it'll be usefull to someone.

imap jj <Esc>

let mapleader = " "
map <leader>a :action $SelectAll<CR>
map <leader>b :action GotoDeclaration<CR>
map <leader>c :action $Copy<CR>
map <leader>d :action EditorDuplicate<CR>
map <leader>e :action RecentFiles<CR>
map <leader>f :action Find<CR>
map <leader>g :action GotoLine<CR>
map <leader>h :action TypeHierarchy<CR>
map <leader>i :action ImplementMethods<CR>
map <leader>m :action EditorScrollToCenter<CR>
map <leader>n :action FileChooser.NewFolder<CR>
map <leader>o :action OverrideMethods<CR>
map <leader>p :action ParameterInfo<CR>
map <leader>q :action QuickJavaDoc<CR>
map <leader>r :action Replace<CR>
map <leader>s :action SaveAll<CR>
map <leader>t :action Vcs.UpdateProject<CR>
map <leader>u :action GotoSuperMethod<CR>
map <leader>v :action $Paste<CR>
map <leader>w :action EditorSelectWord<CR>
map <leader>x :action $Cut<CR>
map <leader>y :action EditorDeleteLine<CR>
map <leader>[ :action EditorCodeBlockStart<CR>
map <leader>] :action EditorCodeBlockEnd<CR>

I just turn VIM plugin off, execute keystroke, then turn it back on. I have ^Z bound to the VIM Emulator command for this purpose and it's enough for me. To set this up, go to Preferences... => Keymap, search for "vim emulator", and right-click on the command name to assign a shortcut.

But if you have a limited set of IntelliJ commands you want to use with a prefix key, you could pick the prefix key, make sure it is unbound in IntelliJ, and then use it in your ~/.ideavimrc along with the original binding you wan to invoke.

For example, ^D in VIM is "Scroll window Downwards" and in IntelliJ (with keymap "Mac OS X 10.5+") is "Debug". If you want to be able to use both:

  • choose a prefix key that's not bound in IntelliJ, say ^Z
  • in Other Settings => Vim Emulation, find shortcut ^D and set the handler to Vim.
  • In your ~/.ideavimrc, add the following mapping:

    nnoremap <C-Z><C-D> :action Debug<CR>

Now you can type ^D for the Vim action scroll down, or ^Z^D for the IntelliJ action Debug, without actually disabling IdeaVIM. You'll of course have to add a mapping to your ~/.ideavimrc for each IntelliJ command you want to execute this way, but if you have a limited number you can set them up once and be done with it.


Adding onto the excellent answer by @melihovv, I have added the Run, Debug, and Choose Configuration actions to my ~/.ideavimrc.

map <leader>dd :action Debug<CR>
map <leader>cd :action ChooseDebugConfiguration<CR>
map <leader>rr :action Run<CR>
map <leader>cr :action ChooseRunConfiguration<CR>