What It Does
This AppleScript used in conjunction with Automator will allow you to set preferences for opening files via mouse click in the Terminal version of Vim. It will also allow you to fire up the Terminal version of Vim through Spotlight within the home directory.
- Fire up Automator
- Choose "Application" from the workflow templates
- Under the "Actions" panel select "Utilities"
- To the right of "Utilities" drag an instance of "Run AppleScript" to the editor window
- Paste in the .scpt file listed in this gist
- Save As... "Vim Launcher.app" to the "Applications" folder with a file format of "Application"
Then you'll need to set your file types from Finder to open via the launcher like any other Application:
- Select a file within the Finder
- Go "File > Get Info" or use the command-I key shortcut
- In the dialog window, select the list under "Open with:"
- Select "Vim Launcher.app"
- Then click the button "Change All..." for all file types like the one you are changing to open with Terminal Vim
- Repeat this for any other file types you want to open with Terminal Vim
You'll also be able to fire up Terminal Vim via spotlight by typing "Vim Launcher". This will open Terminal Vim from your home directory.
You need to quote the_path or you'll run into problems cd-ing into directories with spaces their names:
I tried the following, but it didn't work: