Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Sublime Text

You're reading from   Mastering Sublime Text When it comes to cross-platform text and source code editing, Sublime Text has few rivals. This book will teach you all its great features and help you develop and publish plugins. A brilliantly inclusive guide.

Arrow left icon
Product type Paperback
Published in Dec 2013
Publisher Packt
ISBN-13 9781849698429
Length 110 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Dan Peleg Dan Peleg
Author Profile Icon Dan Peleg
Dan Peleg
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Mastering Sublime Text
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing Sublime Text FREE CHAPTER 2. Code Editing 3. Snippets, Macros, and Key Bindings 4. Customization and Theme Development 5. Unravelling Vintage Mode 6. Testing Using Sublime 7. Debugging Using Sublime 8. Developing Your Own Plugin Index

Installing Sublime Text on Linux


This section will explain how to install Sublime Text on different Linux distributions.

Installing Sublime Text on Ubuntu 32/64 bit

This section will explain how to install Sublime Text on Ubuntu 32/64 bit.

There are a few different options for installing Sublime Text on your Ubuntu; we will use the Personal Package Archive (PPA) one. For this, we need to add the PPA that contains the Sublime Package. PPA is a software repository that contains packages that can be installed by Ubuntu's Launchpad.

To add the repository, run the following from the terminal:

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

To install Sublime Text 3 on our Ubuntu, we can now use the following commands:

subl filename ("filename" is the filename to edit)
subl foldername ("foldername" is the folder to open)
subl . (to open the current directory)

We can also see the Sublime icon on Ubuntu's action bar, which is typically on the left-hand side, as shown in the following screenshot:

Setting Sublime Text as the default editor

After we have installed Sublime, we want to set it as the default editor for everything! To do that, simply open the defaults.list file of Ubuntu by using the following command:

sudo subl /usr/share/applications/defaults.list

And replace all occurrences of gedit.desktop with sublime-text.desktop.

Installing Sublime Text on other Linux distributions

Installing Sublime on a Linux other than Ubuntu takes a little longer, but we will do it as fast as possible! We start by going to http://www.sublimetext.com/3 and downloading the desired tarball for 32-bit or 64-bit.

Tip

Notice that we do not download the Ubuntu one but the tarball.

After downloading, let's open our terminal and navigate to the Downloads folder:

cd ~/Downloads

The downloaded file is compressed using TAR. We will have to NTAR it first by running the following command:

tar xf sublime_text_3_build_3047_x64.tar.bz2

Note

Your filename might be different depending on your build and architecture.

Move the extracted folder to /op:

sudo mv sublime_text_3 /opt/

We want to make a symbolic link so that we can run Sublime straight from the terminal:

sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl

Now, we have Sublime installed and can use the following commands to open the directory:

subl filename ("filename" is the filename to edit)
subl foldername ("foldername" is the folder to open)
subl . (to open the current directory)

Adding a desktop file

Some distributions such as OpenSUSE, Ubuntu, or GNOME, use .desktop files. These files are for the desktop/action bar launch icons.

Let's add Sublime's .desktop file to the environment. It's good for us that Sublime comes with the file already and we don't need to write it. Just copy the file to the right location using the following command:

sudo cp /opt/sublime_text/sublime_text.desktop /usr/share/applications/

Your distribution may not provide /usr/share/applications, in which case you'll have to copy the file to ~/.local/share/applications.

You have been reading a chapter from
Mastering Sublime Text
Published in: Dec 2013
Publisher: Packt
ISBN-13: 9781849698429
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image