Skip to content

Instantly share code, notes, and snippets.

@jeetsukumaran
Last active August 3, 2019 11:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeetsukumaran/5400816 to your computer and use it in GitHub Desktop.
Save jeetsukumaran/5400816 to your computer and use it in GitHub Desktop.
AppleScript to open a new MacVim buffer.
on run
tell application "System Events"
set currProcs to (name of processes)
set MacVimRunning to (currProcs contains "MacVim")
if not MacVimRunning then
tell application "MacVim" to activate
end if
tell process "MacVim"
click menu item "New Window" of menu "File" of menu bar 1
set visible to true
end tell
end tell
end run
@lynndylanhurley
Copy link

Is there a way to have AppleScript type commands into the new window?

For example, if I want to open a vim session on startup, I type the following command:

:OpenSession some-session-name

Is there a way to automate this using AppleScript?

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