Skip to content

Instantly share code, notes, and snippets.

@kbrx93
Forked from MondoGao/TerminalVim.scpt
Created December 6, 2018 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbrx93/24c779f836185e77b8236266caa1fcb9 to your computer and use it in GitHub Desktop.
Save kbrx93/24c779f836185e77b8236266caa1fcb9 to your computer and use it in GitHub Desktop.
Open file in iTerm vim/neovim for MacOS High Sierra
-- TerminalVim.app
-- 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 TerminalVim.app 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"
activate
if (count of windows) = 0 then
create window with default profile
end if
tell current window
create tab with default profile
tell current session
-- if you're using vim, change 'nvim' to 'vim' below
write text ("vim " & quote & POSIX path of input & quote & "; exit")
end tell
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment