Categories
debian linux open-source tech

Sublime Text 2 on Debian Linux

sublime-text-the-text-editor-youll-fall-in-love-with-opera_002
As good as GEdit is, sometimes you want the polish and power of a actively-maintained, fully-functional text editor that excels at both coding duties and regular note taking – especially in Markdown.
For this reason, my choice for the last few years has been Sublime Text 2 – which although is available on a trial license is well worth paying a personal license for.
It’s available for Linux, Windows and OSX/Mac. Here I detail how to install from the tarball on a Debian Linux but the same instructions will work on any Linux flavour.
dropbox-gaming-mame-md-sublime-text-2_001
Update: I have written a script to automate these steps and you don’t even need root access, take a look here

Step 1 – Get tarball

Grab tarball from website www.sublimetext.com

Step 2 – Extract to /usr/local/src

You may already have your own preference on where you install third-party software on a Linux system (/opt perhaps?), so this is an optional step. However if anything comes as a tarball then I prefer to install them in /usr/local/src
First make it owned by you by changing to root and running this:

chown <username>. /usr/local/src

while we changing directory ownerships, lets do the same to /usr/local/bin (we’ll come back to this in a bit)

chown <username>. /usr/local/bin

Now we are ready to extract the freshly downloaded tarball to the directory

tar -xjvf SublimeText2.tar.bz -C /usr/local/src

Step 3 – Create a launcher

In order to easily launch Sublime Text like any other installed app, we now create a symlink from the Sublime Text 2 program to /usr/local/bin – this will mean that we can launch Sublime Text 2 by simply invoking `sublime_text` on the command line:

cd /usr/local/bin
ln -s /usr/local/src/Sublime\ Text\ 2/sublime_text

Next create a .desktop file for Sublime Text 2 like this:

╰─○ cat ./.local/share/applications/sublime_text.desktop
[Desktop Entry]
Version=1.0
Name=Sublime Text
Type=Application
Comment=GUI Text Editor
StartupNotify=true
MimeType=text/plain;
Terminal=false
Exec=sublime_text %U
Icon=sublime_text.png
Categories=TextEditor;Utility;
GenericName=Sublime Text

Then set an icon for the launcher, luckily these are already provided in the tarball:

cd /usr/local/src/Sublime Text 2/Icon
cp 128x128/sublime_text.png ~/.icons

…and thats it! All being well, you can now tap the “overview” key (mapped to Windows logo key) and start typing “sublime” and it will match Sublime Text 2
screenshot-from-2017-09-06-15-58-58
…and from here you can drag it into the Favourites bar
screenshot-from-2017-09-06-13-48-20

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.