Created
May 28, 2019 22:26
-
-
Save goerz/52a0f9e6314d520d04fdfc7ca9a13e14 to your computer and use it in GitHub Desktop.
Use Neovim in iTerm as a GUI editor
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
on run {input, parameters} | |
set cmd to "" | |
if input is not {} then | |
set filePath to POSIX path of input | |
set cmd to ":e " & filePath | |
end if | |
tell application "iTerm" | |
set mywindow to (create window with profile "neovim") | |
tell the current session in mywindow | |
write text cmd | |
end tell | |
try | |
repeat | |
tell the current session in mywindow | |
-- querying the id will raise an exception if the window is closed | |
set dummy to id | |
delay 0.5 | |
end tell | |
end repeat | |
on error errStr number errorNumber | |
-- pass | |
end try | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create a new app in Automator, add a “Run Applescript” action, and paste the script.
Improves on https://blog.schembri.me/post/neovim-everywhere-on-macos/ by blocking execution until the iTerm window is closed.