Last active
August 22, 2023 11:12
Use vim to open a file in iTerm2 from IntelliJ IDEA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
vim="vim $1 $2 $3" | |
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 | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basic Usage
Use it with IntelliJ IDEA
You can set it as an external tool of IntelliJ IDEA to open the current file in VIM:

Program:
/Users/<user>/Projects/gist/launch_vim.sh
Arguments:
$FilePath$ '+call cursor($LineNumber$,$ColumnNumber$)'
Working directory:
$ProjectFileDir$
Versions
Date: Apr 5, 2018
iTerm2: 3.1.5
IntelliJ IDEA: 2018.1
References
https://stackoverflow.com/a/3313469
https://stackoverflow.com/a/8964037/2195426