Search code examples
terminalsublimetext3sublimetext

How to create a file from the Mac OS terminal and open it in sublime?


How to create a file from the Mac OS terminal and open it in sublime? But not in a new sublime window, but in a new tab, in an already open sublime? Example:

touch filename.js -a 'Sublime Text' $_

Is there any flag or argument that can be added here?


Solution

  • All you need to do (assuming you have the subl helper script in your $PATH) is type subl filename.ext and Sublime Text will open it in the currently-active window. You don't need to call touch at all.

    Note: this will work on any OS.