Created
July 26, 2018 17:25
-
-
Save snipem/e12043b08b386e9869ef736261ae9910 to your computer and use it in GitHub Desktop.
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
tell application "Terminal" | |
activate | |
set allWindows to number of windows | |
global found | |
set found to false | |
repeat with i from 1 to allWindows | |
set allTabs to number of tabs of window i | |
repeat with j from 1 to allTabs | |
if processes of tab j of window i contains "nvim" then | |
set frontmost of window i to true | |
set selected of tab j of window i to true | |
set found to true | |
end if | |
end repeat | |
end repeat | |
if not found then | |
tell application "Terminal" to do script "vim" | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Open VIM in MacOS Terminal. If already open selects corresponding tab. If not starts it.
Replace "nvim" with your vi flavor.