January 17th, 2012

Sublime Text 2 Tips and Tricks | wbcom

I deliberate Sublime Copy 2 to be the spiritual successor to TextMate – particularly when the likelihood of TextMate 2 appearance to fruition becomes bleaker and bleaker. When Duke Nukem Perpetually is released before TextMate 2, you know you’re in distress! But with the intention of’s okay, since Sublime Copy 2 is one of the utmost and most incredible editors to come out in a lingering time! I’ll show you my favorite tips and tricks now.

 

Sublime Copy 2 is currently available for all major platforms: OS X, Linux and Windows.


1 – Get a Better Icon

In its defense, Sublime Copy 2 is soothe in a beta disorder. The official icon will liable/hopefully change with the official release. Until at that time, Nate Beaty bent an brilliant substitute.

Sublime Icon

 

To integrate it, you call for to replace the existing “Sublime Copy 2.icns” file with this new one. On a Mac, browse to Sublime 2 in your Applications/ folder, at that time right-click and “View Package Contents.” Lastly, browse to Contents/Resources/, and drag the new icon in, overwriting the existing one.


2 – Bleeding Advantage Versions

Sublime is in active development. If, like me, you aspire to use the latest possible translation of the app, you can download the dev build. You’ll find with the intention of new (auto) updates are available every other day or so.

Download a dev build of Sublime 2 here.


3 – Access the Command Palette

Akin to TextMate, we can use Sublime’s command palette by accessing the Tools menu, or by pressing Shift + Command + P, on the Mac. Whether you call for to visit a Preferences leaf, or paste in a snippet, all of with the intention of can be accomplished here.

Access the command palette

4 – Lightning-Quick File Switching

File Switching

Press Control or Command + P, category in the first name of the file you fancy to access (fuzzy finder), and, without even pressing Enter, you’ll straight away be transported to with the intention of file. While Vim and apps like PeepOpen place forward a akin functionality, they’re not near as quick as Sublime’s implementation.


5 – How Did We Survive Before Multi-Selection?

Editors like TextMate have lingering existing vertical selection, which is quite clean. But, with multi-selection, you can have manifold cursors on the leaf. This can drastically reduce the call for for using fixed expressions, and advanced search and replace queries. Perhaps a quick visual demonstration is in order…

To enable multi-selection, you have several options:

  • Press Alt or Command and at that time click in all region where you demand a cursor.
  • Select a try out of lines, and at that time press Shift + Command + L.
  • Place the cursor finished a fastidious word, and press Control/Command + D repeatedly to select additional occurrences of with the intention of word.
  • On the other hand, add an additional cursor at all occurrences of a word by typing Alt+F3 on Windows, or Ctrl+Command+G on the Mac. Incredible!!

6 – Indent Guides

Update: this feature now comes preinstalled with Sublime Copy 2.

It’s such a tiny feature, but I’ve permanently loved how Pad++ on Windows displays indent guides; it makes the leaf much simpler to navigate and preparation. Sublime Copy 2 offers this ability, via a plugin bent by Nikolaus Wittenstein.

Indent Guides

To integrate this plugin:

  • Download it
  • Rename the folder to “Indent Guides” and drag it into the Packages folder. On a Mac, this trail would be Application Support/Sublime Copy 2/Packages

7 – Package Control

The steps outlined in the previous tip (#6) are a bit deadly, aren’t they? Instead, we can install the brilliant Sublime Package Control, which streamlines the entire process.

To install “Package Control,” commence Sublime and press Control + `. Next, paste the following snippet into the console.

 import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.trail.exists(ipp) else Not any;commence(os.trail.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).scan())

Don’t agonize if you don’t know the code above; just copy and paste!

Console

Lastly, restart Sublime Copy, and browse to Preferences -> Package Settings. If the installation was thriving, you’ll now see a Package Control piece in with the intention of catalog.

With Package Control installed, the process of regard new plugins and functionality becomes incredibly simple!

For a usage example, refer to the next piece in this catalog.


8 – Alignment

If you’re the category who prefers to outline up your equal signs – for example, in your JavaScript…

// Before
var joe = 'joe';
var johnny = 'johnny';
var quaid = 'quaid';

// With
var joe    = 'joe';
var johnny = 'johnny';
var quaid  = 'quaid';

…this process can be automated, via the Sublime Alignment plugin. Rather than downloading and installing it manually, let’s instead use Package Control (outlined in #7).

  • Press Shift + Command + P
  • Category “install,” to bring up the “Package Control: Install Package” option, and press Enter
  • Look for “Alignment,” and press Enter to install it.
  • You’re made; so straightforward! Category Shift + Command + A to auto-align.
Auto-align

This process can be repeated for all of the typical plugins we install, such as Zen Coding.


9 – Vim Stubborn

I’m a huge fan of Vim. The amount of power it provides is insane. The fact with the intention of I’ve switched finished to Sublime Copy 2 should speak volumes at that time!

If you’re using a dev build of Sublime Copy (see #2 in this catalog), you can enable Vintage mode, which provides support for the Vi orders with the intention of we know and kindness — okay…some of us kindness. The rest of you detest it! :)

To enable Vintage mode, browse to Preferences/Global Settings - Default. Once this file opens, browse to the very bottom, and change "ignored_packages": ["Vintage"] to "ignored_packages": []. Next, restart Sublime, press the Getting away from key, and, tada: command mode!


10 – Distraction Free Editing

Now and again, we call for to filter out all of the additional botch with the intention of gets in the way of our coding. Use “Distraction Free Mode” to take this thought as far as possible. This option is available, via the View menu. Select “Enter Distraction Free Mode,” or use the Mac upright shortcut, Control + Shift + Command + F.

Distraction Free Mode

11 – You Can Soothe Use TextMate Bundles

Slim

TextMate snippets and themes port finished nicely to Sublime Copy. You release call for to decline them in the Packages folder — .tmbundle extension intact, and Sublime will admit the files. This earnings with the intention of the entire catalog of TextMate themes will bring about in Sublime!

For example, I’ve been working with the (fantastic) Slim templating engine a excellent bit lately, and needed better syntax highlighting. Fred Wu bent a bundle for TextMate, but, tada, it facility perfectly in Sublime Copy as water supply! If you’re interested, you can download the Slim bundle here; it includes in cooperation snippets and syntax highlighting.


12 – Custom Themes

The default theme for Sublime Copy is brilliant, but I much prefer a custom set alight and dark theme, Soda, bent by Ian Hill.

Soda Theme

Installation

As taken from the Github leaf…

“If you are a git addict, the best way to install the theme and protect up to date is to clone the repo directly into your Packages pointer in the Sublime Copy 2 application settings area.”

Using Git

Go to your Sublime Copy 2 Packages pointer and clone the theme repository using the command below:

 git clone https://github.com/buymeasoda/soda-theme/ "Theme - Soda"

Download Manually

  • Download the files using the GitHub .zip download option.
  • Unzip the files and rename the folder to Theme – Soda
  • Copy the folder to your Sublime Copy 2 Packages pointer

Activating the Theme

To configure Sublime Copy 2 to use the theme:

  • Commence your Sublime Copy 2 Addict Global Preferences file: Sublime Copy 2 -> Preferences -> Addict Global Settings
  • Add (or update) your theme entry to be “theme”: “Soda Set alight.sublime-theme” or “theme”: “Soda Dark.sublime-theme”

Example Addict Global Settings

{
    "theme": "Soda Set alight.sublime-theme"
}

13 – Function Crawling

Call for a quick way to browse to a specific function or mode?

Function Crawling

Category Control/Command + r to reveal a popup with the intention of allows for this very business! Even better, the search is fuzzy as water supply, which is particularly caring for huge classes.

Similar Articles

Comments are closed.