Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Sublime Text
Mastering Sublime Text

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.

By Dan Peleg
$19.99 $13.98
Book Dec 2013 110 pages 1st Edition
eBook
$19.99 $13.98
Print
$32.99
Subscription
$15.99 Monthly
eBook
$19.99 $13.98
Print
$32.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Dec 24, 2013
Length 110 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849698429
Category :
Concepts :
Table of content icon View table of contents Preview book icon Preview Book

Mastering Sublime Text

Chapter 1. Installing Sublime Text

This chapter will guide us through installing Sublime Text on all the supported platforms. We will also cover advanced installation and basic navigation around Sublime. This chapter is aimed at new users, but we recommend you flip through it even if you are already familiar with Sublime Text.

In this chapter, we will cover the following topics:

  • Installing Sublime Text on OS X

  • Installing Sublime Text on Windows 32/64 bit

  • Installing Sublime Text on Linux 32/64 bit

  • Getting to know the Data and Packages directories

  • Running Sublime for the first time

  • Installing the Package Control ASAP

Preparing for Sublime Text Installation


This chapter serves as a quick installation reference for users who are new to Sublime Text, and covers all supported operating systems. We will also cover advanced installation techniques such as adding Sublime to our Command Line Interface (CLI) and to Ubuntu's action bar. Please refer to the appropriate section depending on your operating system.

Note

At the time of writing this book, Sublime Text 3 was in Beta. Follow #sublimehq on Twitter for version updates.

Installing Sublime Text on OS X


This section will explain how to install Sublime Text on OS X 10.7 or later, as required.

First go to http://www.sublimetext.com/3 and click on the download link for OS X. A file called Sublime Text Build #.dmg will be downloaded. Open this file and we will see the following window:

Simply drag the Sublime Text icon into the Applications folder and wait for the application to be copied.

We have just installed Sublime on our OS X! Is that all? No, we can also get the bleeding edge version from here: http://www.sublimetext.com/3dev. Bleeding edge versions are available for registered users only and are more susceptible to bugs.

Working with Sublime CLI

Sublime Text ships with a CLI called subl, but this CLI isn't added to our environment by default. We want to be able to use it straight from our terminal, so we need to add a symbolic link called subl to the subl executable.

ln –s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

To see if it worked, type subl filename in the terminal where filename is the file you want to edit. Did it work? If not, then we need to add our folder that contains the new symlink to the environment. Run the following command:

open ~/.bash_profile

The first line of the file should start with export PATH=. It contains all the directories that will be looked into for executable binaries when we type a command in the terminal. Since we created a symlink to subl inside the /usr/local/bin directory, we will add it to the path by adding it to the directories:

export PATH=/usr/local/bin[…]

Note

[…] represents other directories that would be listed on the same line, separated by a colon.

Now, run the following code before continuing:

source ~/.bash_profile

This will reload your .bash_profile with the newly added directory.

Sublime CLI should work now; try one of 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)

That's it! We have Sublime Text with CLI running on our OS X!

Installing Sublime Text on Windows 32/64 bit


This section will explain how to install Sublime Text on Windows 7/8, 32/64 bit. It is important to get the right version because the 64-bit version won't run on a 32-bit PC.

Go to http://www.sublimetext.com/3 and download the relevant file for 32-bit or 64-bit. A file called Sublime Text Build # Setup.exe will be downloaded. Open the file and you will be guided through the setup. Click on Next and choose setup location. Next, add Sublime to the explorer context by American English: should use "checking" Add to explorer context menu as shown in the following screenshot:

Then, finish the installation. We have just installed Sublime! Are we done? Not yet.

Adding Sublime to the environment

We want to add Sublime to our environment so we can use it straight from the command line. Open Run by pressing WinKey + R and enter sysdm.cpl, as shown in the following screenshot:

Click on OK, the System Properties window should open. Now, go to the Advanced tab and click on the Environment Variables… button at the bottom-right corner. Environment variables should open, look for the Path variable in System variables, double-click it to open the Edit System Variable window, and add your Sublime installation path to the end of the Variable value field prefixed with a semicolon, as shown in the following screenshot:

As we can see, my installation path is D:\Program Files\Sublime Text 3. Click on OK. Now we can run Sublime from the command line by typing sublime_text filename where filename is the file to edit. But the sublime_text command is too long to type every time we want to open a file with Sublime. Go to your installation directory and create a new file named subl.bat. Paste the following code into the file:

@echo off
start sublime_text.exe %*

The first line turns off the echo of the .bat file. This means that we won't see any output when we run the file. The second line will start the sublime_text executable with the given parameters.

Save the .bat file and open a new command line. We can now use the following commands in our command line:

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

That's it; we have Sublime on our Windows PC!

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.

Left arrow icon Right arrow icon

Key benefits

  • Discover efficient, keyboard-driven text editing
  • Recognize the latest build of Sublime Text 3
  • Full of illustrations and diagrams, with clear, step-by-step instructions and practical examples that will help you in building cross-platform applications using Sublime Text

Description

Sublime is the leading platform for developing websites, applications, and software. Sublime Text is a sophisticated, cross-platform text and source code editor. It supports a number of different programming languages and is extremely efficient and feature rich. With Sublime Text, programmers can develop their web applications faster and with more efficiency. This book will put you at the frontier of modern software development. It will teach you how to leverage Sublime for anything from mobile games to missile protection. Above all, this book will help you harness the power of other Sublime users and always stay on top. This book will show you how to get started, from basic installation through lightning fast code navigation and up to the development of your own plugins. It takes you from the early stages of navigating through the platform and moves on by teaching you how to fully customize your platform, test, debug, and eventually create and share your own plugins to help and lead this community forward. The book will then teach you how to efficiently edit text, primarily by using the keyboard. You will learn how to interact with the Sublime Text community using the mailing lists and IRC.

What you will learn

Understand the concepts of advanced search and replace techniques Exercise the use of Code Intelligence in Sublime Apply and control live Linting in Sublime Discover overriding and maintaining key shortcuts Learn to test and debug PHP, JavaScript, Python, and Ruby code using Sublime Develop plugins and publish them

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Dec 24, 2013
Length 110 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849698429
Category :
Concepts :

Table of Contents

15 Chapters
Mastering Sublime Text Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Installing Sublime Text Chevron down icon Chevron up icon
Code Editing Chevron down icon Chevron up icon
Snippets, Macros, and Key Bindings Chevron down icon Chevron up icon
Customization and Theme Development Chevron down icon Chevron up icon
Unravelling Vintage Mode Chevron down icon Chevron up icon
Testing Using Sublime Chevron down icon Chevron up icon
Debugging Using Sublime Chevron down icon Chevron up icon
Developing Your Own Plugin Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.