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
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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.

eBook
₱941.99 ₱1346.99
Paperback
₱1683.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering Sublime Text

Chapter 2. Code Editing

This chapter will guide us from Sublime's basic features to its most advanced ones, and explore techniques to use while editing code. We will also install two important plugins for most languages and master Sublime's Shortcuts Map.

In this chapter we will cover the following topics:

  • Discovering Search and Replace

  • Mastering Column and Multiple Selection

  • Navigating through Project, Files, and Classes

  • Using the must-have SublimeCodeIntel

  • Linting with SublimeLinter

  • The must-know Shortcuts Map

Discovering Search and Replace


Search and Replace is one of the common actions for any text editor. Sublime Text has two main search features:

  • Single file

  • Multiple files

Before covering these topics, let's talk about the best tool available for searching text and especially, patterns; namely, Regular Expressions.

Regular Expressions

Regular Expressions can find complex patterns in text. To take full advantage of the Search and Replace features of Sublime, you should at least know the basics of Regular Expressions, also known as regex or regexp. Regular Expressions can be really annoying, painful, and joyful at the same time!

We won't cover Regular Expressions in this book because it's an endless topic. We will only note that Sublime Text uses the Boost's Perl Syntax for Regular Expressions; this can be found at

Tip

I recommend going to http://www.regular-expressions.info/quickstart.html if you are not familiar with Regular Expressions.

Search and Replace – a single file

Let's open the Search panel...

Mastering Column and Multiple Selection


Multiple Selections is one of Sublime's coolest features; TextMate users might be familiar with it. So how can we select multiple lines? We select one line like we usually do and select the second line while holding Ctrl or command on OS X. We can also subtract a line by holding the Alt key or command + Shift keys on OS X. This feature is really useful and it is recommended that you play with it. The following are some shortcuts that can help us feel more comfortable with multiple selections:

Multiple selection action

Windows/Linux

OS X

Return to Single Selection Mode

Esc

Esc

Undo last selection motion

Ctrl + U

command + U

Add next occurrence of selected text to selection

Ctrl + D

command + D

Add all occurrences of selected text to selection

Alt + F3

Control + command + G

Turn Single Linear Selection into Block Selection

Ctrl + Shift + L

Shift + command + L

Column Selection

The Column Selection feature is one of...

Navigating through everything


Sublime is known for its ability to quickly move between and around files and lines. In this section, we are going to master how to navigate our code quickly and easily.

Go To Anything

We already learned how to use the Go To Anything feature, but it can do more than just searching for filenames. We can conduct a fuzzy search inside a "fuzzily found" file. Really? Yeah, we can. For example, we can type the following inside the Go To Anything window:

isl#wld

This will make Sublime perform a fuzzy search for wld inside the file that we found by fuzzy searching isl; it can thus find the word world inside a file named island.

We can also perform a fuzzy search in the current file by pressing Ctrl +; in Windows or Linux and command + P, # in OS X. It is very common to use fuzzy search inside HTML files because it immediately shows all the elements and classes that match, accelerating navigation.

Symbol search

Sometimes we want to search for a specific function or class...

Using the must-have SublimeCodeIntel


SublimeCodeIntel is a must-have plugin. Its main features are:

  • The Jump to Symbol Definition feature, which allows a user to jump to the file and line of the defining symbol

  • It Imports autocomplete and displays the available modules/symbols in real time

  • The Function Call tooltips display information in the status bar about the working function

Installing SublimeCodeIntel

We can easily install this plugin using the Package Control utility that we installed earlier. Let's open it up by pressing Ctrl + Shift + P in Windows or Linux and command + Shift + P in OS X. Choose Install Package and install the SublimeCodeIntel plugin. We will then need to restart Sublime.

When it first starts, SublimeCodeIntel needs to build an index of the languages you're using. Depending on the number of modules/libraries you have installed and the size and complexity of the project you're working on, this can take some time. Be patient though, it will be well worth it when it's ready...

Linting with SublimeLinter


Linting is a term for flagging suspicious and non-portable constructs, likely to be bugs in any written language. SublimeLinter is a plugin that supports linting and has the following linters built in:

  • C/C++: This lints via cppcheck

  • CoffeeScript: This lints via coffee –s –l

  • CSS: This lints via built-in csslint

  • Haml: This checks syntax via haml –c

  • HTML: This lints via tidy

  • Java: This lints via javac –Xlint

  • JavaScript: This lints via built in jshint, jslint, or gjslint (if installed)

  • Lua: This checks syntax via luac

  • Objective-J: This lints via built in capp_lint

  • Perl: This lints via Perl::Critic or syntax and deprecation check via perl-c

  • PHP: This checks syntax via php –l

  • Puppet: This checks syntax via puppet parser validate

  • Python: This is a native, moderately-complete lint

  • Ruby: This checks syntax via ruby –wc

  • XML: This lints via xmllint

Installing SublimeLinter

We can install this plugin by using the Package Control that we installed earlier. Let's...

The must-know shortcuts map


The following is a must-know shortcuts map for Sublime Text:

General

General shortcuts for Sublime's basic features are as follows:

Command

Windows/Linux

OS X

Open the command palette

Ctrl + Shift + P

command + Shift + P

Toggle Side Bar

Ctrl + KB

command + KB

Show scope in status bar

Ctrl + Shift + Alt + P

Control + Shift + P

Python Console

Ctrl + `

Control + `

New Window

Ctrl + Shift + N

command + Shift + N

Tabs

Shortcuts to control tabbing in Sublime:

Command

Windows/Linux

OS X

New Tab

Ctrl + N

command + N

Close Tab

Ctrl + W

command + W

Open last closed Tab

Ctrl + Shift + T

command + Shift + T

Next Tab

Ctrl + Tab

Control + Tab

Previous Tab

Ctrl + Shift+Tab

Control + Shift + Tab

Bookmarks

Bookmarks are similar to the favorites option while surfing in the Web; we can toggle bookmarks on lines and then jump between them. Here are the shortcuts for using Bookmarks:

Command

Windows/Linux

OS X

...

Summary


By now we should have mastered code editing and keyboard shortcuts; we can now work on any project in any language with the help of Lint and Code Intelligence.

It is important to know that SublimeLinter and SublimeCodeIntel do not support all kinds of projects and languages. They are also not the right choice for you if you are developing in a specific language; there may be a plugin that fits your requirement better. In the next chapter we are going to learn what Snippets, Macros, and Key Bindings are, and even make our own snippet!

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.

Who is this book for?

This book is for developers with experience in any type of programming language, and for those who want to start using Sublime Text or perfect their existing skills. No knowledge of Sublime Text or any other code editor or IDE is expected.

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
Estimated delivery fee Deliver to Philippines

Standard delivery 10 - 13 business days

₱492.95

Premium delivery 5 - 8 business days

₱2548.95
(Includes tracking information)

Product Details

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

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Philippines

Standard delivery 10 - 13 business days

₱492.95

Premium delivery 5 - 8 business days

₱2548.95
(Includes tracking information)

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 4,490.98
Mastering Node.js
₱2806.99
Mastering Sublime Text
₱1683.99
Total 4,490.98 Stars icon

Table of Contents

8 Chapters
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

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5
(12 Ratings)
5 star 41.7%
4 star 8.3%
3 star 25%
2 star 8.3%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




Ernest C. Liedtke Nov 10, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book.
Amazon Verified review Amazon
mac champion Jan 22, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The information inside is nothing you can't find with Google, but its organization and the tips it contains really open your mind to how configurable and powerful Sublime Text really is.
Amazon Verified review Amazon
Parsa E. Nov 06, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
i love it
Amazon Verified review Amazon
Chris Thackrey Jun 06, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Nothing you can't find online (free video series on Udemy that covers all the content with more depth.) But this book makes a great cliffnotes for SublimeText enthusiasts that want to become more efficient. I'd buy it again.
Amazon Verified review Amazon
D Sep 28, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Awesome book ! recommended.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela