Sublime Forum

Open iTerm2 2.9.20160523 with sublime_terminal Package

#1

I’m currently running:
iTerm2: Build 2.9.20160523 with shell integration and ST3 build 3114. Currently the sublime_terminal package isn’t opening iTerm2 for me after modifying the settings file by adding “iTerm.sh”. Also I replaced my iTerm.sh with the one that @twolfson suggested but it still doesn’t work. Leaving it blank still opens with the default Terminal program as expected. I see #94 is suggesting to rebuild using a new function launch_terminal. Has launch_terminal been implemented yet? Looking through the logs and through Terminal.py it seems like no. Is there currently a way to open iTerm2 from sublime using this package or any others? Thanks :slight_smile:

0 Likes

#2

I’ve never used iTerm2 before, but I went and downloaded a copy and the sublime_terminal package to see if I could reproduce your problem.

Unfortunately, I cannot; I downloaded and installed iTerm2, installed the sublime_terminal package, modified the settings to be:

{
    "terminal": "iTerm.sh",
    "parameters": []
}

and then right clicked on the settings file window and selected Open Terminal Here, and it opened up an iTerm2 window in ~/Library/Application Support/Sublime Text 3/Packages/User as it should.

On the other hand:

  • An attempt to open the terminal the same way before I changed the settings to specify iTerm failed (with an error popup), so I couldn’t initially get it to open in the normal terminal application, but I could get it work with iTerm, which is the opposite of what you’re experiencing.
  • According to the version of iTerm I downloaded (from http://iterm2.com/), the build number is 2.1.4, not 2.9.20160523.

That last one leads me to believe that I may not have downloaded the correct iTerm2 (or there is a newer version somewhere?)

When it fails for you, does it display an error dialog or generate any errors into the sublime console?

1 Like

#3

@OdatNurd Thanks a lot for trying that! Unfortunatley I don’t have much information in the form of error messages, Open Terminal Here and the shortcut super + shift + t work for me when the "terminal": property is left blank, and both simple don’t work when I add iTerm.sh. There are no errors in the console and no pop-ups, nothing happens.

Something is interesting: using sublime.log_commands(True) it looks like in the both the default and iTerm.sh case sublime is executing the command: open_terminal. This strengthens my feeling that it is something to do with the iTerm.sh script, especially because this also appears to be where people are having issues on github

I remember not being able to get the 2.1.4 version working either, however I’m going to try again and get back to you, I’ll try the nightly build also. If you’re interesting in trying other versions they can be found here

Edit: with iTerm2 Build 2.1.4
Both Open Terminal Here and the shortcut super + shift + t work as expected. However when adding the --openNewTab parameter iTerm still opens in it’s own window. Is --openNewTab working for you @OdatNurd? Also do you think I should make a new post for the tab functionality not working?

0 Likes

#4

That does not work for me using 2.1.4, no. Looking at the contents of iTerm.sh that comes with the plugin, it looks like the command parameter should actually be --open-in-tab; that works for me. Could be a case of documentation somewhere being wrong?

Are you experiencing problems with it sometimes not being able to find iTerm.sh?

For example, if I do Open Terminal Here for a file contained in ~/Library/Application Support/Sublime Text 3/Packages/User it will open a terminal there. However, when the current file is in ~/Library/Application Support/Sublime Text 3/Packages/Default/ I get an error dialog about not being able to locate iTerm.sh.

I don’t have time at the moment to look into that further, but I’d be interested to see if that happens to you as well.

0 Likes

#5

Just to review: This is with iTerm2 Build 2.1.4 and the up-to-date sublime_terminal package.

Man, this is such a mysterious situation. You were right on to look inside iTerm.sh to see exactly what the parameter should be (the original PR suggested the flag would be --openInTab. I changed mine from --openInTab to --open-in-tab and it worked…for one sublime session, then I restarted sublime and later restarted my computer and it hasn’t worked since then. I haven’t changed anything except the parameter name.

Also, my Open Terminal Here functionality works fine in either the ~/Library/Application Support/Sublime Text 3/Packages/User or the ~/Library/Application Support/Sublime Text 3/Packages/Default directories (except the the tab functionality). It opens a new terminal window at the correct directory without any errors.

So we seem to be in a weird situation where we’re experienced mirrored functionality and lack there of.

0 Likes

#6

Interesting… all else being equal, what version of MacOS are you running? I haven’t upgraded to El Capitan yet so I’m still at 10.10.5. Maybe if you’re running a newer version there have some subtle changes that break things a little?

0 Likes

#7

Ya it’s pretty weird. I think that’s the only thing that’s different between us. I’m running:
OSX 10.11.5
iTerm2 Build 2.1.4
ST3 Build 3114
sublime_terminal latest pull, which I’m pretty sure is version 1.12.0

super+shift+t : successfully opens a new iTerm window
Open Terminal Here: successfully opens a new iTerm window
"--open-in-tab" parameter: doesn’t work except for the first time I changed it.

and from the sounds of it you’re running:
OSX 10.5
iTerm2 Build 2.1.4
ST3 Build 3114
sublime_terminal latest pull, which I’m pretty sure is version 1.12.0

super+shift+t : successfully opens a new iTerm window but not from the ~/Library/Application Support/Sublime Text 3/Packages/Default/ directory
Open Terminal Here: successfully opens a new iTerm window also except for the ~/Library/Application Support/Sublime Text 3/Packages/Default/ directory
"--open-in-tab" parameter: works as expected except for the ~/Library/Application Support/Sublime Text 3/Packages/Default/ directory.

Am I understanding you correctly? Are there any other directories that either the shortcut or manual command don’t work? Also can you take a screen shot of the error dialog? I want to write this thing up as an issue.

Thanks for your help so far @OdatNurd :slight_smile:

0 Likes

#8

I did not forget about you sir, but I was away on a little mini vacation. Back now, though!

This is correct, yes (including the presumed version number of the latest sublime terminal based on its package-metedata.json file).

So far as I am able to tell, yes. It works fine in the general case based on my noodling around in a sample project. However, when I try to open a new terminal in that path, the following error dialog appears:

The following appears in the console; It first complains that the file that I right clicked on doesn’t exist (although it does), and then it throws an error that iTerm.sh is not found, although it is most definitly also there (checked via ls and file).

Also, just because you had issues with it, I tried this both after closing and restarting sublime, and also after doing a complete reboot of the laptop, but it still works the same before and after. So I’m not experiencing the issue you are where it only opened in a new tab once and then only in windows after that.

0 Likes

#9

I cannot get the Terminal package (v1.12.0) to open iTerm2 (Build 3.0.0) using Sublime (Build 3114).

Neither the CMD+Shift+T works or the Open here mouse click.

If I remove the iTerm.sh filename from the config file it does open the default OSX (10.11.2) Terminal.app. When I change it to iTerm.sh I get nothing, and no output in the console in Sublime.

If I add a dummy (incorrect) script name to the config file and run I get an error (expected) so this tells me that the shortcut works and there is a problem with iTerm.sh.

But when I change it back to iTerm.sh and run the shortcut keys again I get nothing, no terminal opens and nothing goes in the console log.

When I run iTerm.sh from Temrinal.app I get this:

Last login: Sat Jun 4 20:32:12 on ttys000 ilium007@MacBookAir:~$ /Users/ilium007/Library/Application\ Support/Sublime\ Text\ 3/Packages/Terminal/iTerm.sh 41:49: syntax error: Expected end of line but found identifier. (-2741) ilium007@MacBookAir:~$

0 Likes

#10

Please see https://github.com/wbond/sublime_terminal/issues/89 - there’s an updated script available which fixes the issue.

1 Like

#11

Great - thanks. Works perfectly.

0 Likes