Skip to content

Instantly share code, notes, and snippets.

@backslash112
Last active August 22, 2023 11:12
Show Gist options
  • Save backslash112/67ba9a8dcef114930abc3afa1338c49d to your computer and use it in GitHub Desktop.
Save backslash112/67ba9a8dcef114930abc3afa1338c49d to your computer and use it in GitHub Desktop.
Use vim to open a file in iTerm2 from IntelliJ IDEA
#!/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
"
@backslash112
Copy link
Author

backslash112 commented Apr 6, 2018

Basic Usage

./open_vim_file_in_iterm.sh <FILE> '+call cursor(<LINE>, <COLUMN>)'

Use it with IntelliJ IDEA

You can set it as an external tool of IntelliJ IDEA to open the current file in VIM:
screen shot 2018-04-08 at 9 43 39 pm
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment