- Open Automator
- Choose "New Document"
- Locate "Run AppleScript" and double-click it
- Paste the Applescript code into the box
- Save as
/Applications/TerminalVim.app
- In Finder, select some file you want to open in Vim, e.g. a .rb file.
- Hit
⌘I
to open the “Get Info” window. - Under “Open with:”, choose
TerminalVim.app
. You may need to select “Other…” and then browse. - Hit the “Change All…” button and confirm.
Now all .rb files in Finder will open in Vim.
I took the idea further, now you can edit any text snippet (e.g. in Mail, Safari etc.) in MacOS with VIM:
https://github.com/normen/vim-macos-scripts