Skip to content

Instantly share code, notes, and snippets.

@garrettreid
Last active August 29, 2015 14:03
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 garrettreid/591d0df5a97f24deeffc to your computer and use it in GitHub Desktop.
Save garrettreid/591d0df5a97f24deeffc to your computer and use it in GitHub Desktop.
Drag and drop VIM editing
set fileName to (choose file with prompt "Select a file:")
set myCmd to "vim \"" & (POSIX path of fileName) & "\""
tell application "Terminal"
activate
do script myCmd
end tell
return
on open of someFiles
repeat with fileName in (someFiles)
set myCmd to "vim \"" & (POSIX path of fileName) & "\""
tell application "Terminal"
activate
do script myCmd
end tell
end repeat
end open
@garrettreid
Copy link
Author

Updated script to correctly handle pathnames with spaces (by encoding path with ""s)

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