.vimrc for IntelliJ Idea's vim plugin
I am using the vim plugin for IntelliJ Idea.
Where should I place the .vimrc for that plugin. Using Windows XP开发者_运维技巧The latest version of the plugin will read settings from a file named .ideavimrc
in the home directory.
On *nix, the home directory can be accessed at ~
.
On Windows, you can use the %HOMEPATH%
environment variable. (Normally, "C:\Users\<User Name>" or "C:\Documents and Settings\<User Name>", depending on your Windows version.)
If you rename your .vimrc
to _ideavimrc
in your ~ directory (/Users/ in windows)
Underscore is used instead of the .
in windows for vim apparently
IntelliJ will honour it
Was tearing my hair out for a while getting this to work.
On my mac i simply ran ln -s "$HOME/.vimrc" "$HOME/.ideavimrc"
to create a symlink so IntelliJ would use the same .vimrc
as my standard vim.
My .vimrc
is very simple. However, if there is config that is incompatible between IntelliJ and vim then you might have issues with this approach.
echo %homepath%
gives me my "home directory" on Windows XP,
where I need to put my .vimrc.
Unfortunately, the vim plugin for JetBrains doesn't effectively support the full functionality of a .vimrc
. The file that the plugin uses is called .ideavimrc
. This is what you should use and it should be placed in your home directory (see this other answer for details, particularly for Windows).
I have a very comprehensive .vimrc
that I use. Unfortunately, I had to pare that down quite a bit to work as .ideavimrc
. You can look at the gists to see the differences. For what it's worth, it's still provides nice functionality, including buffer switching across tabs and splits.
- .ideavimrc
- .vimrc
So why not just use the same file (i.e., .vimrc
) for both? Well, for one thing, you need some settings in .ideavimrc
that give precedence to the vim plugin for certain keyboard shortcuts that conflict with the IDE. See the top of my .ideavimrc for my settings (for example, sethandler <C-B> a:vim
). The other thing is that it seemed that when my more complicated .vimrc
couldn't be processed, other settings (such as just set noerrorbells
) also wouldn't take effect.
精彩评论