0

I'd like to open sublime text 3 with the project from the console. The project is the current folder where I enter 'subl'. For example:

cd ./project/test-1

pwd

subl .

after the I entered subl in the console, sublime text 3 is open and open the ./project/test-1 as the current project. I know it is possible here at 4:50. How?

gdlmx
  • 6,479
  • 1
  • 21
  • 39
Nicolas S.Xu
  • 13,794
  • 31
  • 84
  • 129

1 Answers1

2

Pass the full path as the argument to -a:

subl -a "$PWD"
# or
subl -a $(pwd)

Make sure your version of sublime support the -a option:

subl --help


Arguments:
  --project <project>: Load the given project
  --command <command>: Run the given command
  -n or --new-window:  Open a new window
  -a or --add:         Add folders to the current window
  -w or --wait:        Wait for the files to be closed before returning
  -b or --background:  Don't activate the application
  -h or --help:        Show help (this message) and exit
  -v or --version:     Show version and exit

Filenames may be given a :line or :line:column suffix to open at a specific
location.
gdlmx
  • 6,479
  • 1
  • 21
  • 39
  • "subl" results "zsh: command not found: subl". Do I need to make a link (ln) to link sublime text to "subl"? I read many tutorials online, but failed to do so. – Nicolas S.Xu Jun 18 '16 at 15:38
  • You said: "after the I entered `subl` in the console, sublime text 3 is open ...". So I thought you set an alias `subl=sublime`. – gdlmx Jun 18 '16 at 18:45