-
-
Save jbboynton/b37f8dfb8944f27edad25a0fec00e454 to your computer and use it in GitHub Desktop.
AppleScript to open a file in vim and iTerm2 on macOS High Sierra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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 | |
| -- Note: this script will open vim in a new iTerm2 tab. Currently the | |
| -- AppleScript API doesn't support tmux operations, so it's not possible to open | |
| -- files in a new tmux window or pane. | |
| on run {input, parameters} | |
| tell application "iTerm2" | |
| tell front window | |
| create tab with default profile command "vim " & quote & POSIX path of input & quote | |
| end tell | |
| activate | |
| end tell | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment