Is there a way to get the IdeaVIM view for mappings from my .vimrc file?

I recently hit vim (again), and now I have a ton of settings in my .vimrc file. I understand that not everything in this will make sense in the context of the IDEA plugin, but I would really like it if things like reassigning jj to Esc were matched and respected. Is there any way to do this? Without having to manually configure all this in the IDEA text table, that is.

Thank.

+47
vim ideavim
Apr 07 '11 at 18:20
source share
8 answers

Update: yes! See answer below .

The short answer is no.

I also tried to do this because I have a rather complicated .vimrc that I have been used to for many years.

In any case, there is a workaround (sort of). IdeaVim settings are stored in a file named vim.xml in the .IntelliJIdea10/config/keymaps folder inside your home folder ( C:\Users\<user_name> on Windows). You can edit the XML to add the materials you need. For example, I added the following lines to save the file by pressing F2 instead of entering :w! :

 <action id="SaveAll"> <keyboard-shortcut first-keystroke="F2"/> </action> 

However, I do not see how we can add functions such as functions or vim settings (this is what I usually used for .vimrc for).

PS This may explain why .vimrc is not used (my attention):

For the curious, the plugin is written without reference to the VIM source code (excluding regular expression processing). I'm mainly using excellent VIM documentation and VIM itself as a link to verify the correct behavior.
Source: http://ideavim.sourceforge.net/

+22
May 14 '11 at 14:56
source share

Updated answer: IdeaVim version 0.35 (released 2014-05-15) reads settings and key bindings from ~/.ideavimrc . You can put source ~/.vimrc in this file if you want to include mappings from ~/.vimrc .

0.33 and 0.34 read ~/.vimrc directly.

0.33 (released 2014-04-28) was the first version to implement VIM-288 , including things like matching j j - ESC . It works fine, and there is a new Vim Emulation section in the IDEA settings that lists all conflicts between ~/.vimrc mappings and Intellij mappings, and allows you to resolve conflicts by assigning keys to either IDEA or IdeaVim. Here's the Twitter release announcement.

(Note: I'm not an author, just a satisfied user.)

+125
Apr 29 '14 at 17:09 on
source share

Looks like the IdeaVIM # VIM-288 problem (change, update: see jbyler's answer , fixed by VIM-288) will solve your problem when it fixes. I was also looking for a way to enter jk input mode instead of using the Escape key. I am not an expert in IntelliJ plugins, but I managed to change the source code of IdeaVIM so that the "jk" label was hardcoded. All I had to do was redeploy the plugin and use this instead of the official version. Here is how I did it:

  • Grab the IdeaVIM source code.

    https://github.com/JetBrains/ideavim

  • You can follow the instructions in the "Development" section on this page to configure the development environment for the plugin.

  • Now that your IdeaVIM project is set up, open this file: com.maddyhome.idea.vim.key.RegisterActions.java

  • This file seems to have all the Visual / Insert / Normal mode commands and their corresponding key bindings. For my example of changing the "exit insert mode" key binding, find "VimInsertExitMode". You will need to add a line to this code block for the new shortcut.

  • This is what the code section looked like after I edited it:

     parser.registerAction(KeyParser.MAPPING_INSERT, "VimInsertExitMode", Command.Type.INSERT, new Shortcut[]{ new Shortcut(KeyStroke.getKeyStroke('[', KeyEvent.CTRL_MASK)), new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK)), new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), new Shortcut("jk"), new Shortcut(new KeyStroke[]{KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, KeyEvent.CTRL_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)}) }); 
  • Now expand the project (make .jar) and add it to your plugins folder; I followed the following instructions for reference:

    http://confluence.jetbrains.com/display/IDEADEV/Getting+Started+with+Plugin+Development#GettingStartedwithPluginDevelopment-anchor5

  • You may need to save the Vim.xml file from the folder with the key files, I'm not sure. I deleted mine and then was overwritten when I restarted IntelliJ.

  • Give him a whirlwind! Must be able to use "jk" as a shortcut to exit mode in direct mode!

+5
Jun 21 '13 at 4:09
source share

You know, I had some success with .vimrc in my Windows home folder, so usually C: \ Users \ yourLogin. It would seem by design. Oleg mentions that IdeaVIM uses a subset of the VIm commands here.

http://youtrack.jetbrains.com/issue/VIM-134#tab=Comments

It looks like you need to be logged in to see the comments on the youtrack system.

Oleg Shpinov Aug 15 2011 18:12

The IdeaVIM plug-in loads some configuration data from a .vimrc file, however, support for vim plug-ins is not and will not be available, since you need to rewrite the entire VIM runtime within the IdeaVim plug-in.

Note that you should name the .vimrc file, not _vimrc, if you are on Windows, where you can expect the latter.

Works with set ignorecase at least!

+4
Mar 20 '12 at 17:59
source share

As described in the plugin repository ( https://github.com/JetBrains/ideavim ), you can achieve this by creating the file " ~ / .ideavimrc " with its contents:

 source ~/.vimrc 
+4
Dec 03 '15 at 15:56
source share

IdeaVim now (at least starting at 0.35) supports a limited number of typing commands , as well as a map and its options. To get them automatically, enter your settings in ~ / .ideavimrc.

+1
Jun 19 '14 at 1:15
source share

To make it work with windows 7, create .ideavimrc in C: \ Users [username]

Worked for me.

+1
Oct. 19 '15 at 10:27
source share

I just figured out how to do this yesterday. I was able to symbolically associate my .vimrc with my ideavim settings by running the following command:

 ln -s $HOME/.vimrc $HOME/.ideavim 
0
Jul 15 '17 at 16:22
source share



All Articles