Created
June 14, 2018 18:32
-
-
Save joeybaker/bcc5dafee758455f2ec80697564f3da0 to your computer and use it in GitHub Desktop.
Applescript to use in automator to open a file in Terminal in neovim
This file contains 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
on run {input} | |
set filename to POSIX path of input | |
set cmd to "clear;cd $(dirname " & filename & ");nvim " & quoted form of filename & "; exit" | |
tell application "System Events" to set terminalIsRunning to exists application process "Terminal" | |
tell application "Terminal" | |
activate | |
if terminalIsRunning is true then | |
set newWnd to do script with command cmd | |
else | |
do script with command cmd in window 1 | |
end if | |
end tell | |
end run |
matthewshannon
commented
Sep 18, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment