0

As the name suggested. I would like to have something like:

sublime ./My_project/my_example.cpp

Then it opens the my_example.cpp in SublimeText for me.

4 Answers4

1

Everything is explained here.

Basically you just need to create a symbolic link (ln -s) somewhere in your path and make it point to the "subl" (not "sublime") executable.

Thiht
  • 252
  • 4
  • 11
1

Sublime text includes a command line script subl but you'll need to link it into your /usr/local/bin

ln -s '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' /usr/local/bin

(and you may need sudo)

gnarf
  • 105,192
  • 25
  • 127
  • 161
0

I'm not sure what SublimeText is, but if it is an app bundle you can do:

$ open -a SublimeText.app ./My_project/my_example.cpp

You can do a few other things if you really want it to be exactly the syntax you suggested:

$ alias sublime='open -a SublimeText.app'

enter that in a terminal, or add it to your ~/.profile.

drootang
  • 2,351
  • 1
  • 20
  • 30
0

If you install Sublime Text 3 via homebrew (cask, as explained here) then it will create sublime symlink for you automatically.

Community
  • 1
  • 1
dreamzor
  • 5,795
  • 4
  • 41
  • 61