This one weird trick will make your stylesheets easy to navigate

By josh / May 23, 2014

A couple of months ago, a image exploded on Twitter.

Hundreds of retweets. Actually made it hard to find new content for the @SublimeTxtTips feed for a couple of days …

The image was a screenshot of a long code file, open in Sublime.

The web dev who took the screenshot had an interesting approach to making it easy to navigate his file: He included block comments with HUGE ASCII art headers for different sections.

Seems weird, right?

Until you see the file in Sublime’s minimap. The ASCII art comments are immediately visable.

And if you use a preprocessor, you can strip them out, meaning no stylesheet bloat.

The developer who came up with this was inserting the artwork by hand, but the SublimeFiglet plugin by Adam Johnson automates the process using the Figlet command line tool.

I interviewed Adam about the process of creating this plugin, and here’s what he had to say.

(BTW, Adam’s SublimeFiglet plugin is only available for Sublime Text 2 at the moment, but it’s pretty simple. If you’d like to see a version available for ST3, grab a copy of Writing Sublime Plugins to see what might be involved with updating it, then send Adam a pull request! )

#

Tell me a bit about yourself (name, current job, blog, Twitter, etc.).

Hi, I’m Adam. I work as a web developer at YPlan, and my blog is at http://adamj.eu.

What’s the name of your plugin? What does it do? (If you have written several, pick your favorite.)

I’ve developed several little plugins, but I’ll talk about SublimeFiglet. It lets you create enlarged ascii-art text, as output by the classic ‘figlet’ commandline program, inline in Sublime.

How did you get the idea for your plugin?

I was working on some incredibly long source code files and wanted to leave large headers that were easy to find, especially with Sublime’s mini-map. Creating them manually with ‘figlet’ on the command prompt worked, but it was a slow process, so I decided it would be a good time to try my hand at creating a plugin.

How much time did you spend writing the first version?

An hour or so. The first version simply ran ‘figlet’ on the string you provided, captured the output, and pasted it back into Sublime where your cursor was – dead simple.

Did you think building a plugin would be difficult? Was it easier or harder than you thought it would be?

I didn’t expect it to be too hard, as I had already looked around in the documentation and the source code of a couple of my favourite plugins. But truth told, version one was done quicker than I expected still!

What was the most challenging part of building your plugin?

The biggest challenge here has been keeping up with pull requests on Github! A user in the community pointed out that ‘figlet’ is also available as a python library and submitted a pull request with it added in to the plugin, which cut out the need to install ‘figlet’ separate. I’ve also had people submitting fixes for particular scenarios where it didn’t work. The challenges have been both making sure that pull requests were merged in correctly, and didn’t break any feature, but also to do any merging in a timely fashion so people are friendly 🙂

What was your favorite part of creating your plugin?

Although I made it sound like a lot of work, my favourite part has definitely been keeping up with the community response for maintenance/improvements. It’s very fun to be contacted by random programmers across the globe submitting improvements to your plugin.

Did you learn anything along the way that you wish you’d know when you were starting out?

That ‘figlet’ was available as a python library, and that integrating it wouldn’t be hard – although it did need to be copy-pasted into the plugin.

Did your plugin grow or change as you built it? Did you have to modify your plans based on what the Sublime plugin APIs could do?

The first version only allowed you to ‘figletize’ text that you input into a prompt; however, I soon realized that this was a slow way of working, and so I extended it to support ‘figletizing’ your current selection. This was also a result of some further reading of the Sublime plugin API.

#

P.S. Yes, the post title is tongue-in-cheek. I sometimes get complaints on Twitter (from people who aren’t subscribers) about being a “spammer.” Might as well lean into it, right? 🙂

P.P.S. Want me to “spam” you with more great Sublime tips? Go here: http://sublimetexttips.com/newsletter

Copy copy copy with this new Sublime feature

By josh / May 22, 2014

I’ll admit it: I’m a copy-paste programmer.

That doesn’t mean I spend my time posting “can i haz all teh codez” comments on Stack Overflow.

And I don’t just swipe huge swaths of sample code from dodgy-looking blog posts and slap them into a production app. (OK, there was that one time…)

But particularly when I’m starting a new file, I’m not above trolling through similar files and grabbing chunks of code to get me started.

When I’m assembling one of these Frankenfiles, the back-and-forth gets old. Open a file. Copy. Switch to my new file. Paste. Open another file …

It would be great if Sublime let me just go on a shopping spree and copy copy copy to grab all the pieces I need, then assemble them later.

Turns out, it does.

The Paste from History command, new in Sublime Text 3, is perfect for this.

Running Paste from History (check under Edit | Paste from History to see the keyboard shortcut) pops up a context menu with a list of the last several items I’ve copied.

This makes it easy to put the code snippets together in the right order in my new file.

What, you’re still running Sublime Text 2? No worries. Just install the Clipboard History plugin and you’ll get a similar feature.

One side note on both of these: They only work on text you’ve copied from within Sublime.

By the way, I cover other new Sublime Text 3 features in the free Sublime Text Tips newsletter. You can get it here:

http://sublimetexttips.com/newsletter

Who else hates using their mouse?

By josh / May 21, 2014

Remember that scene in Princess Bride?

The lithe swordsman unsheathes his weapon and says, not for the last time:

“Hello. My name is Inigo Montoya. You killed my father. Prepare to die.”

That about sums up how I feel about my mouse.

(And don’t even get me started about trackpads …)

One of the best investments I’ve ever made in terms of reducing my need to use the mouse is spending some time learning Vim-style keyboard shortcuts.

If you’ve never used Vim, it’s definitely a unique beast because of its unusual concept of editing modes. Depending on what mode you’re in, a given key on the keyboard will work differently.

In most text editors, pressing the J key does one thing–it inserts the letter j in your text.

In Vim, the J key will insert a j, but only if you’re in insert mode. If you’re in normal mode (navigation mode), J works like the down arrow, moving the cursor down a line. Similarly, K emulates the up arrow. (If you’ve ever used Gmail’s keyboard shortcuts, you might be familiar with this idea already–Gmail got it from Vim.)

This idea of modal shortcuts is a bit hard to wrap your brain around at first, but it provides incredible efficiency once you master it.

When you’re coding or writing, you spend a lot of time navigating–often you’ll spend more time navigating than you spend actually typing new text. Modal shortcuts allow you to navigate efficiently without moving your fingers from the home keys.

Sublime offers many of the same shortcuts in its Vintage mode plugin. This plugin ships with Sublime, although it’s disabled by default.

Vintage mode isn’t a full-fledged emulation of Vim, but I find it provides many of the most useful Vim shortcuts for navigating and chopping up text. (I’m using it right now as I write this.)

For a more faithful Vim experience, you can also try out the Vintageous plugin (ST3 only).

If you sometimes feel like hacking your mouse to pieces, check out the Sublime Text Tips newsletter. You’ll get more free tips that’ll help you learn to work more efficiently while keeping your hands comfortably on the keyboard.

Get it here:

http://sublimetexttips.com/newsletter

Taking the mystery out of creating your own Sublime Text color scheme

By josh / May 20, 2014

Everybody loves a good color scheme.

Whenever I tweet about a new color scheme someone has cooked up, it gets tons of attention.

If you’ve ever taken a peek at a Sublime color scheme file, though, or summoned the courage to try to make some changes, you know it’s not easy to customize the way Sublime highlights code.

Color scheme files are aren’t very intuitive to work with. They’re XML, for starters. ‘Nuff said on that …

Then you have to figure out just the right scope to use for each part of your theme. Scopes are similar to CSS selectors–they’re how Sublime applies colors to different parts of a programming language, like keywords, variable names and comments.

If you want to create your own color scheme, there’s a relatively unknown plugin that makes a lot of this easier.

It’s called ColorSchemeEditor, and it’s available in Package Control for both Sublime Text 2 and Sublime Text 3.

When you run ColorSchemeEditor, it opens the file for the active color scheme. You can then open some source code–say a JavaScript file–and insert the cursor in different source elements. When you select a function name, the plugin will show you which XML element determines what a function name should look like. You can make changes right there, then just save the file and watch Sublime update the appearance of your source code immediately.

Try it out!

For info on more great plugins like this, check out the free Sublime Text Tips newsletter:

http://sublimetexttips.com/newsletter

Will you make this productivity-killing mistake today?

By josh / May 19, 2014

One common lament I hear from readers is, “I love Sublime–I just wish I could remember all those keyboard shortcuts!”

Maybe you feel that way sometimes. You’ll be cruising along, coding “in the zone,” and you might use Goto Symbol to jump to another section of your file to make a quick change. Now you want to go back to where you were editing previously.

You hesitate. Sublime has a Jump Back command, right? But what was the shortcut for that again?

A quick trip to Google, and you “remember”: Oh, yeah, it’s Alt+-.

Cool. You close the tab, jump back to Sublime, and hit the shortcut.

It works. Happy dance.

You dive back into your code …

Stop. You might think you learned a productivity-boosting shortcut, but it’s more likely that the next time you need that shortcut, you’ll come up empty, just like you did this time.

You missed an opportunity to burn that shortcut into your brain and ensure that it’ll be there next time you need it.

Sublime has hundreds of great shortcuts, but many programmers only know and use a handful.

Sure, they may know of many of these shortcuts, but when the opportunity arises to use that shortcut, they can’t remember it and either look it up again or just go with the slower, less efficient manual option.

Next time you happen across a new shortcut that seems like it’s worth learning, don’t just try it once and then get back to work.

Take an extra two or three minutes to practice using it. Repeat the shortcut 10 or 20 times. Try to come up with a couple of different scenarios where it would be useful, and practice those.

If you really want to remember it, make yourself a little reminder somewhere where you’ll see it later so you can repeat your practice over time.

This takes a little extra time, sure. But mastering a few keyboard shortcuts a week will save you significant time in the weeks and months ahead.

P.S. To learn more about how to improve your Sublime Text workflow, check out the free Sublime Text Tips newsletter:

http://sublimetexttips.com/newsletter

Why Goto Isn’t Evil

By josh / May 16, 2014

In a classic XKCD comic, a programmer debates with himself whether to take the time to refactor his program … or use just goto.

He takes the easy road and …

Gets devoured by a velociraptor.

Yeah, goto takes quite a beating.

For Sublime users, though, Goto is anything but evil–it’s one of the most powerful navigation tools at your disposal.

You can use it to breeze through your project files without ever touching the mouse.

You can use it to jump to a specific line in the current file.

And you can even use it to see a list of indexed symbols in your current file.

Try it out: Open a code file, then click Goto | Goto Symbol ….

The list of items you see in the Goto Symbol quick panel depends on the file you’re editing. If it’s a JavaScript file, you’ll see a list of functions. If you’re editing Markdown, you’ll see section headers–really useful if you’re writing a long blog post or a book.

For more ways to improve your Sublime workflow, check out:

http://sublimetexttips.com/newsletter

Prevent copy-and-paste rage with this quick Sublime Text tweak

By josh / May 15, 2014

Tell me if this has ever happened to you.

You go to copy a block of code. It’s a big block–a couple hundred lines, maybe. Enough that getting just what you wanted is a bit of a pain, involving much clicking and dragging. Whew, got it.

Ctrl-C

You tab over to the destination file, find just the right place … There.

Ctrl-C

Dang. Meant to paste …

Ctrl-V

AARRRRRRGGGGG!!! The selection is gone. Your errant Ctrl-C overwrote your carefully selected lines of code with a whole lotta nothing.

Whose bright idea was it to make the keyboard shortcut for “copy” so close to the shortcut for “paste”?

To make sure this never happens to you again, add this to your user preferences:

"copy_with_empty_selection": false

P.S. Find this helpful? As my three-year-old would say, there’s “yots and yots” more in the free Sublime Text Tips newsletter. Check it out here:

http://sublimetexttips.com/newsletter

How to bulk rename files without losing your sanity

By josh / May 14, 2014

Have you ever found yourself needing to rename a bunch of files?

Like maybe you have a folder full of photos, and you’d like to rename them to something more descriptive than DSC_2635.jpg, DSC_2636.jpg, and so on.

Or maybe you have a list of folders that were sequentially numbered … until you deleted one and added a couple more in the middle (with a b suffix to avoid naming collisions).

I had this exact problem when I was getting ready to launch Writing Sublime Plugins–http://writingsublimeplugins.com. I had created almost 30 folders with snapshots of the example plugin, but there were a few gaps and overlaps in the sequence.

Usually in these situations there aren’t quite enough files to make it worth writing a shell script to do the work, but good grief, renaming them by hand is tedious … Right click. Select. Delete. Type type type. Enter. Right click …

In my (highly limited) experience with emacs, one of the features I really liked was the dired mode.

This mode allows you to open any folder on your machine as a text buffer in emacs, then interact with the list of files as if they were just lines of text. Want to rename several files? Just edit that line. Your changes aren’t saved until you commit them, so you can rename multiple files or folders at once.

Like everything in emacs, I found this extremely powerful … but difficult to work with.

Now there’s a new Sublime Text 3 plugin that emulates dired–and it’s easier to use.

This plugin, named simply dired, allows you to open a folder as a tab in Sublime, then manipulate its contents with keyboard shortcuts.

Since the dired tab is just a regular editing pane, you can use most of your favorite shortcuts and editing tricks. (Hint: Multi-select rocks when you want to bulk rename files…)

One really nice touch: The available keyboard shortcuts are always displayed on screen, so it’s easy to see how to do a particular task.

The dired plugin is available in Package Control. Check it out today.

Want more tips like this? There’s a whole lot more here:

http://sublimetexttips.com/newsletter

This plugin makes Sublime’s multi-select even more awesome

By josh / May 13, 2014

Multi-select is one of Sublime’s killer features, so I was pretty excited this week when I stumbled on a new plugin that adds some nice refinements.

MultiEditUtils is a Sublime Text 3 plugin that allows you to:

  • Jump your cursors to the end of the selections, even if you made the selection “backwards” (I do this all the time)
  • Cycle through all instances of a selection–convenient when you’d like to review a list of selections in a long file that doesn’t fit on one screen
  • Select a line of text and split it into characters or words, then insert separators (this one is amazing)

MultiEditUtils is available in Package Control.

If you’d like to understand multi-select and other Sublime features better, subscribe to the newsletter today:

http://sublimetexttips.com/newsletter

Rousting the Vim mafia

By josh / May 12, 2014

“what is this ~~ bulls*** ~~”

I was getting ready for bed one evening, when my buddy Derick Bailey emailed me a screen cap of the above message, pulled from his Twitter feed.

The angry reaction was from Tim Pope, a longtime Vim advocate and author of several excellent and useful Vim plugins.

Tim was apparently minding his own business, checking Twitter, when one of the ads I run to promote this newsletter popped into his feed.

Heh. Ooops.

Several other Vim fans responded to his tweet with varying levels of snark–even disdain. These guys were genuinely angry.

Now, I love a good round of the editor wars as much as anyone, but some people take it waaaaaaaay too far.

Like you’re insulting their mother, or saying their baby is ugly.

Here’s the thing. Just about every popular editor out there is pretty awesome, and one of the best ways to level up your productivity in your editor of choice is to experiment with the other ones.

Can I tell you a little secret? I wrote big chunks of Sublime Productivityhttp://sublimeproducitivity.com–in MacVim.

And I used org-mode in emacs to outline Writing Sublime Pluginshttp://writingsublimeplugins.com.

Partly this was because I needed to keep my Sublime installations clean for testing, so I couldn’t use my favorite plugins and tweaks.

But I also like trying out other editors and learning what they do well.

Vim’s modal navigation shortcuts are wonderfully efficient, once you get them ingrained into muscle memory. (Sublime’s Vintage mode provides a decent emulation of these, and I use it constantly.)

Org-mode in emacs is truly incredible–I’ve yet to see an outlining program that comes anywhere close.

While I enjoy these other editors, I keep coming back to Sublime, because it just fits my preferences and workflow perfectly.

But if you’ve never tried one of these time-tested tools, check them out. I guarantee you’ll find a feature that you love.

And the best part? There’s probably already a plugin that will let you add that feature to Sublime!

To learn more about the best features in Sublime, jump on the Sublime Text Tips newsletter:

http://sublimetexttips.com/newsletter

How one lazy programmer moves files around

By josh / May 9, 2014

These days, my writing workflow is pretty simple.

Don’t get me wrong–like all software developers, I have a tendency to overcomplicate things, and writing is no exception.

I’ve tried dozens of different tools and just as many ways to organized my files.

But that all tended to get in the way of, you know, actually writing, so I’ve cut way, way back.

Now I just have a folder for each of my blogs. In that directory, I have a folder named drafts and another named published.

When I finish a blog post and publish it, I move it from drafts to published.

Mind. Blown. (Right?)

I can’t completely stop being a programmer, though, so naturally I’m looking for the easiest way to move files from one folder to the next, preferably without leaving Sublime Text.

So far, my favorite way to shuffle files from folder to folder is a command that’s available when you install the SideBarEnhancements plugin. (I’ve mentioned this one before–it’s definitely near the top of my must-have plugins list.)

As you might have guessed, SideBarEnhancements adds all kinds of goodies to the side bar. But it also makes some of those commands available in the command palette.

One of these, the File: Move command, is a great way to relocate the file you’re editing. It pops open an input panel at the bottom of your Sublime window and populates it with the full path of the current file. Then you just edit the path–in my case I replace the drafts folder name with published and hit Enter.

No fuss.

That does still seem a little like work to me, though, so I’ve toyed with the idea of setting up a custom build action to do something similar …

P.S. If you also like to fiddle with your workflow, you’ll enjoy the Sublime Text Tips newsletter. You’ll learn dozens of tips and tweaks that cater to your inner lazy programmer.

Get it here:

http://sublimetexttips.com/newsletter

“My favourite part is receiving emails telling me how grateful they are”

By josh / May 8, 2014

James Brooks has written several plugins, including one I’ve used and written about previously, InsertNums, that makes it easy to quickly add a sequence of incrementing numbers. (You can finally stop numbering your BASIC by hand!)

I asked him to share some of what he’s learned in the process. Here’s what he had to say about the pain points involved and the rewards of getting his plugins out there.


Tell me a bit about yourself.

My name is James Brooks or @jbrooksuk everywhere online. I’m currently working for Blue Bay Travel as the Lead Web Developer. I sometimes blog at http://james.brooks.so but I’m lazy and forget to.

What’s the name of your plugin? What does it do?

I’ve developer and contributed to a few Sublime plugins over the last couple of years, InsertNums, Evaluate and TabsToTable for instance. However my latest, Sublime Pebble is being developed to ease writing apps and watch faces for the Pebble watch. Although in its early stages, Sublime Pebble will turn Sublime into the one-stop editor for writing Pebble code.

How did you get the idea for your plugin?

I started writing a watch face for my Pebble watch and I was having to switch back and forth between Sublime and the Terminal to push the app and read the debug logs. It was really annoying.

How much time did you spend writing the first version?

Only a few hours (spread across a couple of days). It’s nowhere near complete but lets me do the basic stuff.

Did you think building a plugin would be difficult? Was it easier or harder than you thought it would be?

When I started writing Sublime plugins I’d only touched an existing Python script that downloaded a bunch of MP3 files automatically. It turned out to be easier than I expected probably due to my experience in other programming languages. The API was the hardest thing to get my head around and I needed to understand Sublime better to realise everything.

What was the most challenging part of building your plugin?

With Sublime Pebble the hardest part was making it run a third-party command through Python. I’d never done something like that before and it took a while to get that working, but I’m glad I was persistent with it.

What was your favorite part of creating your plugin?

Releasing a beta version on the Pebble forums. People had been briefly mentioned it before and I was happy that I’d taken the time to get started on it. Regarding other plugins and colour schemes, my favourite part is receiving emails telling me how grateful they are for it.

Did you learn anything along the way that you wish you’d know when you were starting out?

Python is a great language. It’s flexible and pretty straight forward. The Sublime API docs are sometimes limited in the information they provide which can be a great source of pain. The best advice I can give is to read the source of other plugins and understand how they work. There are some great Sublime plugin developers who can teach you a great deal of things!

Did your plugin grow or change as you built it? Did you have to modify your plans based on what the Sublime plugin APIs could do?

Sublime Pebble started as a plugin which extended the menu bar, but I soon realised that I never use the menu bar (go command palette) and so I switched to that. Thankfully this was pretty straight forward. Not a lot of code was changed due to this realisation.


What plugin ideas do you have? Like James, you can put your own stamp on the Sublime community. You have an opportunity to make life just a little easier for thousands of fellow Sublime users.

If you’d like to take the next step in your journey to Sublime mastery, sign up for the Sublime Text Tips newsletter today:

http://sublimetexttips.com/newsletter

Skip the package unzip two-step with PackageResourceViewer

By josh / May 7, 2014

Sublime Text 3 brought a lot of welcome improvements to the way packages and plugins are managed, like async plugin loading (blazing speed, anyone?).

But … One change has made my life a little harder on an almost daily basis: Packages and plugins are no longer installed as folders that you can easily browse. Instead, they’re tidy little zip files with a sublime-package extension.

Neat. Unless you want to make changes to a plugin, or view its files…

When I was working on Writing Sublime Plugins, this was a huge annoyance.

Viewing a plugin’s files required a clumsy little squaredance: Open that file manager, browse to the package. Rename the package file to end in .zip. Double-click to unzip and mutter in frustration. Rename the zipped package to eliminate naming conflicts. Double click again and view the files.

I wish I’d known about the PackageResourceViewer plugin.

This plugin allows you to launch a command palette interface and view a list of installed packages, then drill down into the plugin’s files from the same command palette. One nice touch: The file list stays open after you hit Enter to load a file, so you can easily open several at once from the same plugin or package.

PackageResourceViewer is available for Sublime Text 2 and Sublime Text 3, and you can install it via Package Control.

To learn about more great Sublime plugins, go here:

http://sublimetexttips.com/newsletter

Quickly and conveniently edit Sublime Text settings (three killer plugins)

By josh / May 6, 2014

Before I found Sublime, I tended to use Notepad++ on my Windows machines. It’s a very capable editor, if an ugly one.

But let me tell you, one thing that got old in a hurry was setting it up every time I installed it on a new machine. I hated a lot of the defaults (made it look even uglier than it needed to be), so each new installation led to five minutes of click-click-click through dozens of tabs.

By contrast, Sublime’s text-only configuration files were a breath of fresh air. I couldn’t believe how easy it was to copy and paste my settings (or sync them with Dropbox, as I cover in Sublime Productivity).

Not everyone sees it the same way, though. One of the most common gripes that new Sublime Text users have is Sublime’s lack of a graphical interface for editing preferences.

Here are three plugins to take a little of that pain away. While they don’t don’t add a full preferences GUI, they do make it much easier to edit preferences quickly.

  • Edit Preferences is for Sublime Text 3 only. It allows you to edit preferences and keyboard shortcuts from a quick panel-style interface.
  • Preferences Editor is similar to the previous plugin, minus the keyboard shortcut support. It does have a cool live preview feature–change the font size, see it in the editor panel before you commit to the change. Sublime Text 3 only.
  • Preference Helper supports both Sublime Text 2 and Sublime Text 3. It also has a cool autocomplete feature that fills in the default value of the setting you’re looking to override.

Love plugins? Me too. Go here to learn about more of them:

http://sublimetexttips.com/newsletter

What’s next, GitHub, “Flappy Octocat”? The Atom text editor is a shameful Sublime Text ripoff

By josh / May 5, 2014

Subscriber Steve S. recently asked me a question on something I’ve wanted to address for a few weeks now:

What do you think of atom.io? It looks very much like Sublime. If I didn’t know any better, I’d think that they stole the source code! I know that the development is slow on Sublime, and the community has asked the dev to consider open sourcing the code, but he hasn’t agreed to that.

So … taking a few deep breaths into a paper bag here…

Frankly, the Atom announcement initially made me nervous. What was going on? Did the Sublime team sell to GitHub? Was Atom going to kill Sublime?

I spent a little time looking at the documentation while I waited for my invitation to arrive, and as I read, I started to get mad.

Then downloaded and played with Atom a bit, and I got furious. If I were Jon Skinner, I’d be doing everything I could to sue GitHub over this. (Unfortunately, I’m not sure what, if any, recourse he has.)

Let’s get one thing straight: Atom is a complete ripoff of Sublime. GitHub took all of Sublime’s innovations and used them as is. They didn’t even bother to rename features or come up with their own keyboard shortcuts. In fact, you could take most blog posts about Sublime Text and “port” them to Atom versions with a simple find-and-replace.

Sure, every editor has derived feature ideas from those that came before, and Sublime is no exception. For example, Sublime borrowed the inspiration for the GoTo feature from TextMate.

But as any high school student learns in writing class, picking the best ideas from multiple sources and combining them in new and interesting ways is a long way from copy-and-pasting an entire term paper and calling it your own.

GitHub crossed the line from flattering imitation to plagiarism–even intellectual property theft with this one.

Unfortunately, the Sublime Text team’s lack of communication has left the door wide open for this type of thing. Hardly a week goes by that I don’t hear from concerned developers asking “Is Sublime Text dead?”

If people weren’t terrified that Sublime was going to suffer the same fate as TextMate, GitHub’s clone would have a lot less appeal.

I don’t think for a minute that Sublime is going to die anytime soon. All indications are that Jon plans to keep working on it.

Regardless, what’s done is done. GitHub is going forward with Atom. That raises the question: Is Atom a Sublime Text killer?

After playing with Atom a bit and talking to several other developers who have used both editors, here’s what I think.

There’s a lot to like about Atom. It obviously shares most of Sublime’s strengths, and GitHub has addressed a few common complaints that devs have voiced about Sublime, such as the lack of a visual preferences editor. I personally like the JSON-based configurations in Sublime, but I can see why it would be nice to have a GUI to work with at times.

GitHub also did a nice job with the native Git integration.

But is Atom a real improvement?

The answer is no, and ironically this is due to one of Atom’s most touted “features.” This will probably get me in trouble, but …

Atom is inferior to Sublime because it’s written in HTML.

Now, before the pitchforks come out … I’m not disrespecting the web or web technologies. The web is a great platform, and JavaScript and HTML can do amazing things.

But I want my text editor to feel rock solid. I’ve yet to use an HTML and JavaScript-based app that achieves this.

A few months back, I tried out Mou.app, which is a dedicated Markdown editor. It had some nice features: It shows a live preview as you work, and you can even style the rendered output anyway you want. Being a total Markdown fanboy, I was really excited when I first fired it up.

Within 30 seconds, I was disappointed. I could tell almost instantly that I was dealing with an HTML-based app. It felt fragile. It was glitchy. The code didn’t scroll smoothly.

What a disappointment.

I’ve yet to see an HTML-based app that creates a native-feeling experience. You can always tell. (It’s possibly that I’ve used some without knowing it, but I usually make it a point to check out any HTML apps that I see held up as examples.)

Atom feels the same way to me. It doesn’t feel solid. There are weird rendering glitches.

I need to trust my tools without question, and I haven’t found an HTML app yet that engenders the same level of trust as a native app.

Atom might steal some marketshare from Sublime. I think it’s a strong possibility that it’ll win Sublime some new fans–people who are initially attracted to Atom by it’s “hackable” appeal, only to find that they prefer the original to the clone.

Time will tell.

Josh

P.S. If you’d like to level up your Sublime Text skills be sure to sign up for the Sublime Text Tips newsletter, where I go deeper into many of those awesome features that GitHub so carefully copied. Worst case scenario, you can always just apply your newfound knowledge to Atom!

Either way, get it here:

http://sublimetexttips.com/newsletter

How to edit your Evernote notes in Sublime Text

By josh / May 2, 2014

Evernote is amazing … and awful at the same time.

On one hand, it’s extremely useful as a collection bucket. You can throw just about anything in there and know that you’ll be able to find it easily. I use the web clipper tool to save articles and ideas for blog posts, and I’ve even started tossing in ebooks and PDFs that I want to keep for reference.

And all that stuff is available from my PC or Macbook, on my iPhone, or anywhere I can get to a computer.

But the experience of writing and editing text in Evernote is … not great. The formatting is limited and glitchy. (It annoys the heck out of me that there’s no easy way to use headers and sub-headers.) There’s no way to set a column width, so I end up with lots of one-line paragraphs that span my entire screen. The keyboard shortcuts are lacking and hard to remember.

I’ve found a solution, though: Edit my Evernote notes directly in Sublime, where I can use Markdown and all of my familiar keyboard shortcuts to fly through my writing tasks.

There are two plugins that make this possible–SublimeEvernote (Sublime Text 2) and Evernote (Sublime Text 3).

Both use the Evernote API to allow you to open notes by searching in a quick panel. You can then edit the note (using Markdown) and send it back to Evernote. You can also create a new note from Sublime and save it to Evernote. Both plugins support editing metadata, such as the note’s title and tags.

The ST3 plugin is based on the ST2 version, but adds a lot of extra features. It’s the one I have installed.

Both are available for installation via Package Control.

P.S. If you’re an Evernote user, you probably also into working efficiently. The Sublime Text Tips newsletter will introduce you to many of Sublime’s advanced features and help you become a coding machine. Here’s where you can get it:

http://sublimetexttips.com/newsletter

So what does it take to write a top 100 Sublime Text plugin?

By josh / May 1, 2014

Before I knew any better, I used to write the HTML for my blog posts by hand. Yeah, I could have done the markup in the WordPress editor, but I did a lot of my blogging while sitting in a stifling hot bus, commuting to my former job in downtown Pittsburgh. So, no Internet. And besides, working with the WordPress WYSIWYG editor at the time was pure P.A.I.N.

I discovered Markdown right around the time I started using Sublime, and I fell in love with it instantly. Sublime and Markdown–what a great way to write! I use that pair for everything these days.

When you’re using Markdown, it’s great to be able to view your work as it’ll be rendered, and there are several Sublime plugins that allow you to open the file you’re editing in the browser for viewing.

One of the most popular of these is called simply Markdown Preview. It’s one of the top 100 most popular plugins for Sublime, and it’s been installed more than 86,000 times.

To find out what goes into making a top 100 plugin, I interviewed the creator of Markdown Preview, Julien Bouquillon.

Here’s what he had to say.


Tell me a bit about yourself (name, current job, blog, Twitter, etc.).

Hi there 🙂 I’m Julien, an avid full-stack web developer sublime-text fan and open-source promoter based in Paris, France and you may know me as @revolunet on the interwebs. I often tweet on @revolunet and sometimes blog on http://blog.revolunet.com. After intense code rushs i love to let off steam by spending time with my family and do some english-style boxing. You should too 🙂

What’s the name of your plugin? What does it do? (If you have written several, pick your favorite.)

My most popular plugin is Markdown Preview; it’s a simple plugin that lets you edit and preview your markdown files in real time right from your favorite editor.

How did you get the idea for your plugin?

Thanks to GitHub, the Markdown syntax became quickly popular and there were no Markdown Preview plugin for Sublime at that time (early 2012). As every open source developer i got used to write more and more README.md files and documentations using that simple but effective syntax, and i was missing an integrated preview tool in my editor.

How much time did you spend writing the first version?

I’m a huge Python fan since a long time and it’s quite easy to implement a basic Sublime plugin so the first plugin implementation which was quite primitive, had only 19 lines of Python and was just a couple of hours work. Most of the time was spent into understanding the Sublime settings/packaging/commands system.

Did you think building a plugin would be difficult? Was it easier or harder than you thought it would be?

Implementing a basic plugin is really a piece of cake with Sublime Text; The plugin API is basic but covers every aspect you need. You can also easily inspect the others plugins source to learn from them, this is very informative.

What was the most challenging part of building your plugin?

The challenges grew with time : More and more features for and by the community, and the release of Sublime Text 3, with a different API, and a different Python version. Also, ST is a multi-OS application so you sometimes have to deal with OS-specific issues that are not easy to test and debug. Most of the headaches came from maintaining the same packaging and the plugin stability over the various OS, versions and configurations. Now the unit testing part is still a mystery for me in the Sublime Text context and i need to dig into a testing framework like https://github.com/guillermooo/AAAPT.

What was your favorite part of creating your plugin?

It’s always rewarding for a developer to have real users on a project, and have them smart enough to submit issues or pull requests on Github. It’s the first time i experienced the real power of open source, in which Github plays a big role. For this reason i now open source as much code as possible. Managing the open-source “flow” is time consuming and not easy but interesting and exciting; Having so much goodwill from anywhere in the world to give a hand to improve your work is simply amazing.

Did you learn anything along the way that you wish you’d know when you were starting out?

I wish i knew Python 3 and read every single Sublime Text changelog to anticipate compatibility issues. A testing framework would also have been useful to prevent basic regression bugs.

Did your plugin grow or change as you built it? Did you have to modify your plans based on what the Sublime plugin APIs could do?

This plugin grew a lot in 2 years; We added the ability to choose the markdown parser and extensions, integrated the github flavoured markdown API, LiveReload for the browser, MathJax support, syntax highlighting, custom templates and CSS… And the Sublime API has never been limiting for this plugin. I only wish we had a common plugin API for ST2 and ST3, or at least a helper class that i started to work but never had time to release properly.

I really encourage you to learn Python which is an easy yet powerful language, and its useful for a LOT of applications. To start creating a ST plugin, choose a simple plugin example, clone it into your ST Packages folder, and code your own 🙂 The ST console is your best friend !


Thanks, Julien!

If you have a plugin idea that you’ve been thinking about but you aren’t quite sure where to start, Writing Sublime Plugins can help speed you on your way. Pick up your copy today:

http://writingsublimeplugins.com

P.S. If you’re more interested in using plugins than writing them, go here instead:

http://sublimetexttips.com/newsletter

Three gorgeous, flat Sublime Text themes (I think you’ll love these)

By josh / April 30, 2014

I remember my very first impression of Sublime Text, and it wasn’t a positive one.

I’d been hearing a lot about how fast and beautiful it was, so I finally broke down and installed the trial.

But when I first launched it, “beautiful” wasn’t the first thing that jumped to mind.

It’s all a matter of taste, of course, but the heavy shadows and gradients didn’t work for me. At the time, I didn’t realize that Sublime was completely reskinnable with themes and skins. Once I realized that, well, objection withdrawn!

I’ve been a fan of flat, streamlined UIs long before Apple “invented” that look with iOS 7, and there are several great themes available for Sublime that are just amazing.

The first one is Flatland. As far as I know this was the first flat theme for Sublime–it’s the first I stumbled across, at any rate:

https://github.com/thinkpixellab/flatland

Spacegray bills itself as a “hyperminimal” theme–it bears a strong resemblance to Flatland, but strips out a lot of the colors:

http://kkga.github.io/spacegray/

The newest theme, Afterglow, just might be my favorite. It combines the simplicity of Spacegray with the light touches of color that I enjoyed from Flatland. I think this might be my new theme of choice:

https://github.com/YabataDesign/afterglow-theme

Have a great day!

Josh

P.S. If you have a friend or coworker who loves Sublime, do them a favor and tell them about this newsletter! They can sign up here:

http://sublimetexttips.com/newsletter

Attention Rails Developers (And Web Developers): Here’s an Awesome Sublime Text Cheat Sheet Just For You

By josh / April 29, 2014

I was patrolling teh Twitterz recently to see what was new, and I stumbled on a fantastic cheat sheet that every Rails developer (and most web designers and developers) could benefit from.

This great resource will show you:

  • 7 of the top plugins for Rails developers
  • How to quickly navigate your code with keyboard shortcuts
  • 4 plugins that all web developers should install

It’s available in HTML and PDF formats, and there’s even a desktop wallpaper version in case you find Sublime keyboard shortcuts more beautiful than sunsets (don’t we all?).

Here’s the link:

Sublime cheat sheet for Ruby on Rails

P.S. If this cheat sheet whets your appetite, be sure to sign up for the Sublime Text Tips newsletter, where I go beyond the cheat sheet level and show you how and when you can use some of Sublime’s best commands.

It all happens right here:

http://sublimetexttips.com/newsletter

Enabling wrap mode in Sublime’s Find, Replace and Find in Files

By josh / April 28, 2014

Newsletter subscriber Turang P. wrote to me a few days ago after the Find feature suddenly got weird on him:

Hi Josh,

Something has happened recently. When I used to use Find to look for something, it would Find until the last instance, then loop around to start from the start.

Now it wont loop and I need to do Find Previous.

Is there a setting that changes this?

This question hits on one of my pet peeves in Sublime’s user interface: The option or mode buttons that appear to the left of search-related panels like Find, Replace and Find in Files.

These buttons use cryptic icons instead of clear labels, and it’s never clear to me whether they’re selected or deselected. To make them even more confusing, most of them are global. If you enable the regular expression setting in Replace, for example, it’ll also be active when you go to use Find later.

These quirks kept me from using Sublime’s search features for quite a while when I first switched to Sublime.

This is definitely one of those cases where icons don’t tell the whole story, and text labels would have been much more effective.

rant mode off

To answer Turang’s specific question, I wrote back that he’d disabled the Wrap setting. This is the icon with the chunky little arrow that loops back on itself (ugh, these icons are so bad I can’t even describe them!). It’s the forth icon from the left when the Find panel is open.

That button needs to be selected to enable wrapping. But is it “selected” when it’s darker or lighter? With the default theme, it’s darker when the button is selected.

Bonus tip: You can hover your mouse cursor over the buttons for a couple of seconds to see their names in a tool tip.

For more about Sublime’s search features, join the Sublime Text Tips newsletter:

http://sublimetexttips.com/newsletter

Page 2 of 6