SublimeText does not store its settings and plugins (at least those you downloaded using PackageControl) in the same directory as the editor itself (/usr/lib/sublime-text-2
in your case) - the settings are stored in /home/(yourusername)/.config/sublime-text-2/
, so they won't be overridden when you install a new version.
But, just in case, you can make a backup copy of your current install before unpacking. Something like this would do:
sudo mv /usr/lib/sublime-text-2 /usr/lib/sublime-text-2.old
sudo tar jxf "/var/cache/sublime-text-2/Sublime Text 2 Build 2181.tar.bz2" /usr/lib
Just to note: installing stuff from tarballs into /usr
is very wrong, if you must use system directories use /opt
at least. Otherwise SublimeText runs just fine from a location in your home directory. Here I wrote a bit more on the matter: https://askubuntu.com/a/172753/14564
The solution provided by Anwesha will work but you will have to manually make sublime text your default opening application for all file formats.
What worked for me in 17.10 was the following:
First what you need is the path to the executable file for sublime text
I have ST 3 and it was at
/opt/sublime_text/sublime_text
Then open your terminal and use the following commands:
sudo update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /path/to/executablesublime 100
Then enter:
sudo update-alternatives --config gnome-text-editor
This will bring up a list of the available alternatives, where the default is marked by an asterisk. If sublime text is not it, then select it now by entering corresponding number. Make sure sublime-text's priority is the highest.
And you're done! Hope this helps :D
Best Answer
These instructions assume that you have installed Sublime Text 3 using the
.deb
file provided for Ubuntu. If you downloaded the tarball and installed it manually, you will need to change the paths below to your install location.First, make sure that
/usr/share/applications/sublime_text.desktop
exists (sublime-text.desktop
on some systems):Then, open
/usr/share/applications/defaults.list
with Sublime:Search for all instances of
gedit
and replace them withsublime_text
. Save the file, log out and back in, and you should be all set.If for some reason
/usr/share/applications/sublime_text.desktop
(orsublime-text.desktop
) doesn't exist, create it:Open it in Sublime:
and paste the following into it:
However, if you installed Sublime Text using the
.deb
file downloaded from sublimetext.com, the file should already exist.