How to run Sublime Text with a selected project using a local .sublime-project file?

Perhaps I missed the obvious, but I can’t solve this rather simple and typical case (from v3 build 3022 on Debian or XP, if that matters):

  • Launch Sublime Text by opening the "myprj" project specified on the command line,
  • using default.sublime-project located under this dir project (say "/ repo / myprj" )
  • Automatically reopen the last opened files of this project (i.e. its workspace),
  • using default.sublime-workspace for this (also from the same dir project)
  • but (obviously) do not automatically open any other files remembered from non-design sessions,
  • and automatically save all open files (to the default.sublime-workspace specified above) upon exit.

Perfectly:

  • $ sublime_text --project /repo/myprj/default.sublime-project

must work. But this is not so (see below).

Another approximation that seemed reasonable:

  1. "hot_exit" and "remember_open_files" to false , and then calling ST with:

  2. $ sublime_text --data /repo/myprj --project default.sublime-project

But ST3 either does not find the project file (via --data ), unless I chdir there ( --data seems to be no longer supported ?), And it either can not automatically open any files of the workspace from the last time (despite the previous " Project / Save Workspace As ... "), or, if I return true_open_files to true, it simply reopens the last opened files regardless of the project specified on the command line.

I think the problem is that the workspace file is not being processed automatically for some reason, and I just skipped some trivial step somewhere. (The official docs (as well as the unofficial one ) seem to discuss command line switches for OS X only , and the --help request didn't really help with that.)

(Note: I would not want to start ST first and then switch to some project from the inside manually, and I also do not want to store sublime-project / -workspace files outside of prj. Dir.) Thank you very much!

+6
source share
2 answers

For those who still want to do this, you can run the built-in command line tool and run it with such a project (Mac OSX):

 "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" --project "absolute-path-to-your.sublime-project" 
0
source

These days I applied a solution to a similar problem and did not find a suitable way. So I created an automation application with a small apple script. Perhaps this also helps.

  • Open Automator and select the news app.
  • Create an action to run Sublime Text 2
  • Paste the action to execute the following apple script:

 delay 0.2 tell application "System Events" tell process "Sublime Text 2" tell menu bar 1 tell menu bar item "Project" tell menu "Project" tell menu item "Recent Projects" tell menu "Recent Projects" click menu item "~/yourproject.sublime-project" keystroke "p" using {command down, shift down} end tell end tell end tell end tell end tell end tell end tell 
-1
source

Source: https://habr.com/ru/post/945490/


All Articles