Here is a way I've done it myself:
- Install Dropbox or Ubuntu One on both systems. In the following steps it will be assumed that you have installed Dropbox with default directory layout.
Assuming you have the up-to-date settings on Linux, move there the ~/.config/sublime-text-2/Packages
directory to ~/Dropbox/.config/sublime-text-2/Packages
and create the following symlink:
ln -s ~/Dropbox/.config/sublime-text-2/Packages ~/.config/sublime-text-2/Packages
On Windows remove the %UserProfile%\AppData\Sublime Text 2\Packages
directory and in place of it create a symlink pointing to %UserProfile%\Dropbox\.config\sublime-text-2\Packages
by running:
mklink /d "%UserProfile%\AppData\Sublime Text 2\Packages" %UserProfile%\Dropbox\.config\sublime-text-2\Packages
Please note that the commands are only provided for reference and I haven't tested them.
The reason it doesn't work is that you have the wrong alias. Here's the correct one for Sublime Text 3:
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
This is an alias that Sublime Text specifically provides for macOS. It will not block execution and—by default—open files in a tab next to the ones that are already open.
If you want to know more about why your alias didn't work, read on.
Application packages in OS X have an .app
suffix, but when launched, they actually launch a binary that's specified in Info.plist
in said package. This is the binary your alias links to, in the MacOS
folder.
Running an application from the GUI or through Launch Services (e.g. via osascript
or open
) makes OS X open that binary, but at the same time ensure it's only launching one instance of that app. When you call the binary directly, you bypass this restriction and launch another instance of the application—unless the application has measures for preventing two instances from being launched, which normally OS X handles.
Also, as a side effect, launching the binary will block the terminal execution until you exit the program or suspend it to the background. Using the built-in subl
from Sublime Text returns control to your terminal, as it actually uses a Launch Services call to open the Sublime package instead of addressing the binary in MacOS
only.
Since you're basically launching a second Sublime Text instance, it'll show you the files it previously had opened, because that's its default behavior.
Best Answer
There is a button for that in ST2.