Search code examples
intellij-ideaideavim

How to open class file in IdeaVim through shortcut?


I'm using IntelliJ IDEA with IdeaVim. Usually I can open any class file by shortcut Ctrl+N without IdeaVim, which is really handy. However when I switched to IdeaVim, The shortcut doesn't work both in Normal Mode and Insert Mode. Neither can I find a settings option in the following dialog. enter image description here

I'd really appreciate that if anyone can shed light on this issue. :)


Solution

    1. You can use :actionlist *class* to find an IDE action for going to the definition of a class.

    2. You can use the found action :action GotoClass as a Vim command-mode command.

    3. You can map this command to any key combination in any Vim mode you want using the :map family of Vim commands, e.g. :nmap ,c :action GotoClass<CR>.

    4. You can put your mapping command into ~/.ideavimrc so it'll load at startup:

    ~/.ideavimrc:

    nmap ,c :action GotoClass<CR>