Mac OS X: how to open vim in terminal when double click on a file
Create an Automator Application to run the following applescript:
on run {input}
set the_path to POSIX path of input
set cmd to "vim " & quoted form of the_path
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
activate
if terminalIsRunning is true then
do script with command cmd
else
do script with command cmd in window 1
end if
end tell
end run
Save the automator application. (eg. name it Vim Launcher)
Right click (or control-click) on your custom vim-type file (eg. use .vim as the extension) and under Open With… choose the bottom option Other… and find your Automator Application (eg. Vim Launcher), double-click it.
Boom.