Skip to content

Instantly share code, notes, and snippets.

Last active October 14, 2023 06:50
  • Star 70 You must be signed in to star a gist
  • Fork 18 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Open file in iTerm vim for MacOS Sierra
-- This creates a shim Application that will enable you to open files from the Finder in vim using iTerm
-- To use this script:
-- 1. Open Automator and create a new Application
-- 2. Add the "Run Applescript" action
-- 3. Paste this script into the Run Applescript section
-- 4. Save the application as in your Applications folder
-- 5. In the Finder, right click on a file and select "Open With". In that window you can set TerminalVim as a default
on run {input, parameters}
tell application "iTerm"
create window with default profile
tell front window
tell current session
write text ("vim " & quote & POSIX path of input & quote & "; exit")
end tell
end tell
end tell
end run
Copy link

can this be a one line command not apple script

You want a one line command to open a file in vim? How about vim myfile.txt?

I success done this use
this app made by applescript
so I can open -a filename
one line ~

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