4

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. :)

kenshinji
  • 2,021
  • 4
  • 25
  • 39
  • 3
    Yep, there are 2 good options listed as answers below (from Rumid and from Andrey Vlasovskikh). The screen shot you posted lists keys which have a conflict: they have an IntelliJ mapping and also an IdeaVIM mapping; it lets you choose whether these keys should be handled by standard IntelliJ binding system or by IdeaVIM. Use Rumid's answer if you want ^N to be handled by the IDE and work as it does without IdeaVIM, or use Andrey's answer if you want to bind a VIM-like shortcut to the same action. – jbyler Feb 15 '17 at 19:01
  • @jbyler thank you, your suggestion is well summarized for the following answers. :) – kenshinji Feb 16 '17 at 02:22

2 Answers2

10
  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>
Andrey Vlasovskikh
  • 16,489
  • 7
  • 44
  • 62
  • Great, this is exactly the way I want. Now I can put all ideavim related configurations into ~/.ideavimrc and source other vim settings from ~/.vimrc. Thank you very much. :) – kenshinji Feb 16 '17 at 02:37
4

Change handler(last column in this image) of this shourtcut to IDE.

Rumid
  • 1,627
  • 2
  • 21
  • 39