Make Sublime’s Find double-plus good

When you hit friction in your workflow, you have two choices.

Option 1: Take to Twitter! Gripe and complain.

Option 2: Do something about it. Write a plugin that fixes the problem, then share it with thousands of other developers and earn their gratitude.

I often take the easier Option 1, but plugin author Todd Wolfson took the high road.

Feeling limited by Sublime’s build-in Find feature, he decided to learn him some Python and fix what was broken.

Here’s what Todd had to say …

#

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

My name is Todd Wolfson. I am a senior engineer at Uber and an open source enthusiast. My blog is http://twolfson.com, my Twitter is https://twitter.com/twolfsn, and my GitHub is https://github.com/twolfson.

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

I have written a few plugins but the most prominent one is Find++. It adds a few commands to Sublime Text to make searching different file sets more streamlined (e.g. current file, open files, entire project).

How did you get the idea for your plugin?

For years I developed on Windows, making Notepad++ my editor of choice. It allowed me to search open files in a keystroke or a folder in a mouse click. When I moved over to Linux, I picked up Sublime Text. However, switching between these options required multiple mouse clicks, impairing my workflow. To solve this problem, I started development on Find++.

How much time did you spend writing the first version?

The first version took me a very long time. I was a Python novice and the Sublime Text documentation is not straight forward. Most of my time was spent scrounging StackOverflow or digging through other plugin code. In fact, I never got the first revision fully working; it wasn’t until I started at Uber that my Python knowledge expanded and I pumped out the plugin in a weekend.

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

Going into it, I had no idea and knew that I needed to explore the feasibility of what I wanted. It was definitely hard but I learned enough to make future plugins a breeze. Additionally, I found some cool features like Sublime Text has a .tmLanguage for Find in Files (Packages/Default/Find Results.hidden-tmLanguage).

What was the most challenging part of building your plugin?

The hardest part was finding the APIs I wanted to use. There is no expansive documentation for every nook and cranny of Sublime Text (and it doesn’t help that it’s closed source). However, with enough searching, I found what I needed.

What was your favorite part of creating your plugin?

Playing with the finished product. At work, it helped me find the important and relevant parts of a code base, making me 300% more efficient. It removed a constraint that was holding me back and I was thrilled.

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

Plenty; I wish I had understood that Sublime Text is light on internals and heavy on key bindings/commands out of the box. I wish I had known more Python; looking over the source code from 1 year ago, I see a lot of room for improvement.

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 original concept was that I would have to override Find in Files functionality. After reviewing the APIs and seeing what was possible, it became “How do I wrangle the existing functionality?”. After enough exploring, I discovered a way that worked for me which is what you see today.

What is your favorite plugin?

Quick File Creator, hands down. It adds a shortcut to create a new file via directory listing (same prompt used in Find++) which removes friction from creating abstractions and features.

What resources did you use to learn about Sublime Text’s API?

#

Todd’s Find++ is available in Package Control for Sublime Text 2 and 3.

P.S. For more about how to write your own plugins and achieve Sublime mastery, check out:

http://sublimetexttips.com/newsletter

Leave a comment

Your email address will not be published. Required fields are marked *