Ever wanted to use Vim editing features while inside IntelliJ IDEA? Here is how to do it… You can even jump to the very same line you are on in IntelliJ.
Go to Settings > External Tools, add a new tool and use something similar:
Program: c:\Program Files (x86)\Vim\vim71\gvim.exe
Parameters: "+call cursor($LineNumber$,$ColumnNumber$)" "$FilePath$"
Working directory: $FileDir$
Update: IdeaVim – Vim commands right in the IDE
Additionally I finally tried the IdeaVim plugin for IntelliJ and my experience so far is pretty good. The need to start gVim externally almost disappeared.
Update: Open file in IntelliJ from gVim (Windows)
Save file + Open current file on the same line in IntelliJ + Close file in VIM
map! <F3> <Esc>:update<CR>:silent exe "!openIntelliJ.bat c: --line " . line(".") . " %:p"<CR>:q<CR>
:map!command creates a key map that works in insert and command-line mode.
:updateis similar to
":write", but only writes when the buffer has been modified.
silentprevents Hit enter cmd window.
line(".")returns current line number (dot is for the current)
%:preturns full file path of the current file
- IntelliJ commmand line uses following syntax:
[IntelliJ Path] [path1 = path to the project that contains the desired file] --line[number] [path to the file to be opened]
Here is my
openIntelliJ.bat – one of the advantages is that I have just one place to change when I upgrade to a newer version (giving the exe to path variable would an option too):
start "" "c:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.6\bin\idea.exe" %1 %2 %3 %4
The second attribute for Windows “start” command is title, I don’t need it, so I supply empty string.