0

I have recently created a profile that opens nvim automatically, which works fine. However, is it possible to export it to a file/app so I can open nvim straight by double-clicking/quicksilver/spotlight?

6

The AppleScript for iTerm 2.9/3

tell application "iTerm"
    activate
    tell (create window with profile "nvim")
    end tell
end tell
  • @leandros is this usable for u? – Jeffrey04 Nov 17 '15 at 2:29
  • That works, no I just have to figure out how to actually write commands into the console. write text doesn't seem to work, neither does execute command. – Leandros Nov 17 '15 at 8:38
  • 1
    Got it working. tell current session of current window write text "echo test;" end tell works like a charm. Taken from the iTerm2 AppleScript test sources. github.com/gnachman/iTerm2/blob/master/sources/… – Leandros Nov 17 '15 at 8:49
  • 1
    congratulations (: – Jeffrey04 Nov 17 '15 at 9:02
1

You can make an AppleScript that accomplishes this, and export that as an app.

The AppleScript [source]:

tell application "iTerm"
activate
tell (make new terminal)
    launch session "Your Profile Name"
end tell
end tell

To export as app [source]:

In Applescript editor File->Save As and choose File Format as Application.

  • 6
    getting this error "The variable terminal is not defined." number -2753 from "terminal" in 10.10 Yosemite (iterm2 2.9) LOLOL – Jeffrey04 Nov 5 '15 at 8:06
  • 1
    tell application "iTerm" activate create new window with profile "nvim" end tell works tho – Jeffrey04 Nov 5 '15 at 8:39
  • 1
    @Jeffrey04 That doesn't work, either. Neither are the examples from iTerm or anything else I tried. Any ideas? – Leandros Nov 16 '15 at 13:41
  • 1
    @leandros I have posted the one I use currently for iTerm2.9/3 – Jeffrey04 Nov 17 '15 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.