Skip to content

Instantly share code, notes, and snippets.

@snipem
Created July 26, 2018 17:25
Show Gist options
  • Save snipem/e12043b08b386e9869ef736261ae9910 to your computer and use it in GitHub Desktop.
Save snipem/e12043b08b386e9869ef736261ae9910 to your computer and use it in GitHub Desktop.
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
@snipem
Copy link
Author

snipem commented Jul 26, 2018

Open VIM in MacOS Terminal. If already open selects corresponding tab. If not starts it.

Replace "nvim" with your vi flavor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment