Home Download Buy Blog Forum Support

subl command not working as expected anymore

subl command not working as expected anymore

Postby matthew on Fri Aug 24, 2012 2:52 pm

I've use
Code: Select all
subl filename
for months, and never had an issue. I have it set up correctly.

However this morning, when I first tried the command, it opens up a blank new document rather than the file. After discussing the matter on irc, I've found that
Code: Select all
subl -w filename
works, but the terminal of course waits until editing is completed.

How/why did this change overnight for me? (I can't think of anything I've changed)

This isn't expected behavior for me, am I expecting incorrectly?

I'm on Mac OS Lion with the newest version of Sublime Text 2.
matthew
 
Posts: 1
Joined: Fri Aug 24, 2012 2:49 pm

Re: subl command not working as expected anymore

Postby slempke on Sun Sep 09, 2012 7:21 pm

I am having the same problem. Actually, the alias has never worked for me at all... I would like to use it in zsh. Anyone have any suggestions?
slempke
 
Posts: 1
Joined: Sun Sep 09, 2012 7:20 pm

Re: subl command not working as expected anymore

Postby canadaduane on Tue Nov 13, 2012 10:56 pm

Just wanted to add that I'm having the same problem. When I switched to zsh (I'm using prezto), suddenly the "subl" command does not open files or directories from the command prompt. In fact, it appears to simply open Sublime Text 2 if it has not yet been opened, and it opens it to the previously open files or directories.

I can confirm that when I use bash, the behavior reverts to normal--"subl ." for example, will open the current directory in a new sublime window.
canadaduane
 
Posts: 14
Joined: Wed Aug 31, 2011 3:22 pm

Re: subl command not working as expected anymore

Postby canadaduane on Tue Nov 13, 2012 11:22 pm

Correcting an earlier observation: It appears that the behavior is not dependent on bash/zsh, but rather on the state of sublime text 2. If Sublime Text 2 is open, but has no open windows, then "subl ." will open a NEW window, but it will not load the current directory. OTOH, if I first press "Cmd+N" in sublime text 2, then the "subl ." command (or any other subl <file or folder>" command) will open a file or directory in a new sublime text editor window. Odd.
canadaduane
 
Posts: 14
Joined: Wed Aug 31, 2011 3:22 pm

Re: subl command not working as expected anymore

Postby aik099 on Fri Nov 23, 2012 2:10 pm

Also, when you drag a file into Sublime Text, when no files open, then "untitled" tab is opened and no content in it. If you close that tab and drag again, then all works.

About all windows restored on next open of sublime - it's a setting that you can turn off:
"hot_exit": false,
aik099
 
Posts: 1
Joined: Fri Nov 23, 2012 2:07 pm

Re: subl command not working as expected anymore

Postby alexmuller on Tue Nov 27, 2012 2:09 pm

Just wanted to chime in that this is an issue for me too. If ST is not open, running subl filename will just launch it. Running the command a second time will work as expected.

Sublime Text 2 Version 2.0.1, Build 2217.

Cheers!
alexmuller
 
Posts: 1
Joined: Tue Nov 27, 2012 2:07 pm

Re: subl command not working as expected anymore

Postby lancespeelmon on Thu Jan 31, 2013 7:23 pm

Agreed - the state of Sublime seems to be the culprit. FYI - I am seeing same exact issues on build 3008. If Sublime is not running (i.e. was Quit), then "subl ." works as expected. However, if Sublime was running, but no windows were open, then "subl ." opens a new window but with no open project/files. However, "subl -w ." does work, but I really don't want to use "-w". :) A bug fix would be most appreciated! Thanks, L
lancespeelmon
 
Posts: 1
Joined: Thu Jan 31, 2013 7:13 pm

Re: subl command not working as expected anymore

Postby alltom on Sat Apr 12, 2014 6:04 pm

This is still broken, right? I'm using build 3059 and I deal with this daily. "subl dir/" sometimes opens an empty window, sometimes opens the directory.
alltom
 
Posts: 1
Joined: Sat Apr 12, 2014 6:01 pm

Re: subl command not working as expected anymore

Postby razzi on Mon May 05, 2014 11:55 pm

I'm getting the same issue with build 3059. Highly annoying to often have to run `subl` twice.
razzi
 
Posts: 1
Joined: Mon Aug 13, 2012 9:45 pm

Re: subl command not working as expected anymore

Postby perryclarke on Fri May 16, 2014 12:15 am

I can confirm that subl is unreliable with both ST2 and ST3 in that the specified file is not always opened. Sometimes it works, and sometimes it doesn't: running the exact same command twice will yield different results (making sure ST is in the same state each time). It's worst if ST isn't running initially but I've had it fail to open a file even it's already running.

open -a 'Sublime Text' filename is much more reliable but you can't specify a line number that way. I also tried using the --command argument to subl but that seemed even more flaky. I suspect there's a bug in the argument processing of subl which is munging things.

I'm on Mac OS X 10.8.5
perryclarke
 
Posts: 2
Joined: Wed May 07, 2014 11:01 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 18 guests