Is it possible to "extend" IntelliJ such that I can open the current file in VIM

Here's how to set this up with the Homebrew version of MacVim (i.e. the mvim command) on Intellij IDEA 14.

  • Go to Preferences->Tools->External Tools and click the plus symbol.

Screenshot of settings window

  • Set up the new tool with these parameters

Program:

/usr/local/bin/mvim

Parameters:

+"silent! "$LineNumber$"|norm! zz" $FilePath$

Working Directory:

$SourcepathEntry$

Screenshot of external editor config tool


Even though the original question is about VIM, I'd like to share my settings for GVIM. Especially useful is the parameter used to take it to the current line.

enter image description here

I find it useful to have Gvim open up the file AND take me to the current line. This is done using the following parameters: +$LineNumber$ $FilePath$.

When executed, Gvim should open up and take you to the line you were at in Intellij.


Absolutely!

Go to File -> Settings -> External Tools and add a new one.

Program and Working Directory fields should be self-explanatory. The parameter field should be $FilePath$. Click the Insert macro button to see more token values that you could use.

You can also bind keyboard shortcuts to the external tools you define.

See the help page on configuring third party tools for more info.

Also, see the answers below with helpful screenshots for Windows or Mac.


For macOS 10.12+ users, If you want to open it in iTerm2, here is a latest solution:

#!/bin/sh

vim="vim $1"
osascript -e "
tell application \"iTerm\"
    set myterm to (create window with default profile)
    tell myterm
        activate current session
        launch session \"Default Session\"
        tell the current session
            write text \"$vim\"
       end tell
   end tell
end tell
"

Date: Apr 5, 2018
iTerm2: 3.1.5
IntelliJ IDEA: 2018.1
https://gist.github.com/backslash112/open_vim_in_iterm.sh