+23

subl with no window open doesn't open the file

Mark Fowler hace 12 años actualizado por Tom B hace 10 años 5
Passing a filename to the "subl" command line tool when no Sublime Text 2 window is open causes a new window to open with "Untitled" to appear, but the filename isn't opened. 
+1

sometimes i dont even get my folter oppened on project panel... and i have to do the subl command again and again ultil it opens the project panel

+1

This has bothered me for a long time. It can be seen in both ST2 and ST3.

It is rather inconsistent, sometimes it works, often it doesn't. I also have had to re-run the command up to 5 times or so before the requested file or folder would finally open.

Yep, they still didn't fix this for ST3. Nerve wrecking because it's totally random.

I use AppleScript (OS X) to open a project file and my workaround was to first activate ST, wait 2 seconds (I found it was the minimum for ST to be "ready") and then open the project.


From


do shell script "'/usr/local/bin/subl' '~/Documents/Sublime Text/project.sublime-project'"
to

tell application "Sublime Text" to activate
delay 2
do shell script "'/usr/local/bin/subl' '~/Documents/Sublime Text/project.sublime-project'"

-------------
-Damazio

Well i think its a memory problem... when i run to much programs on my pc the chance of this happens is to much big than when i start my computer

+1
Based on the suggestion by Damazio above, for me it worked to put this in my .bash_profile:

alias edit='subl && sleep 0.1 && subl'
I'm on a fast MacBook Air so for me 0.1 seconds of sleep already do the trick... other users may have to increase the value.