Search code examples
clionideavim

How to define a keyboard shortcut in CLion for IdeaVim normal mode only?


For example, I am used to having ; act as "fuzzy search file by name" (what Ctrl+Shift+N does) in Vim normal mode. So I go ahead and define this shortcut in settings; now I can't type ; because it triggers file search even in insert mode.

Is there a way to define a CLion shortcut that works only in Vim normal mode, but not in insert mode?


Solution

  • The correct way to define mappings in IdeaVim is to use ~/.ideavimrc file. To define a mapping that works only in normal mode (and doesn't affect insert mode), you can use nmap mapping. You should add nmap ; :action GotoFile<CR> to your ~/.ideavimrc.