Isaac Cambron

@icambron

Back to blog

What I want from Sublime

Jul 21, 2012

I’ve been using Sublime Text 2 for 7 months now, and it well past time for me to take a step back and evaluate things. In general, it’s a great editor, but there are now one too many things about that bug me. I wanted to write them up. Maybe someone will tell me how to fix them. Maybe they’ll actually get fixed by the author. Maybe I’ll just feel better having gotten it off my chest.

If any of this sounds nitpicky, I should point out that I spent like 10 hours per day in this program, so what might seem like minor nuisances add up very quickly. Programming is really just a particular kind of text editing, and we ought to have really well-oiled text editor programs. That’s partially for efficiency, and that’s partly for our happiness. If you were to respond to that by pointing out that if I feel that way, I should really invest more time customizing my editor, I wouldn’t disagree. I should probably dig in, learn my way around the API super well, and make it do what I want it to do. But since it’s easier to complain about it on the internet, I’m going to do that. Then I’ll look into fixing it.

It may also be that there are configuration options I don’t about that could fix this stuff. If so, I’d love to hear them.

Here’s my laundry list.

I want set_mark, yank, and so on to work a bit differently

One thing I think is profoundly annoying are the disjunctions between cut and delete-to-mark and between paste and yank.

For the uninitiated, in Emacs-speak, you set a mark (usually with ctrl+space), which is a sort of bookmark in the document. Then you move your caret around to wherever you want and then you “kill the region” (which really just means “cut”) between your caret and the mark you set before. Later you can “yank” (basically paste) that text back in. So the big difference here is that the region you keep is modal instead of being an explicit selection (the other big difference is that Emacs keeps a full history of your kills so you can do fancier stuff, but that’s not important here).

Sublime has support for this: you can set a mark, you can kill the region, you can yank the region, and you convert the region into a selection. So far so good, but here’s the issue: kill/yank and the more standard copy/paste use completely separate buckets to hold stuff. That might sound useful, but in practice it means I have to keep track of (and map) four commands instead of two. Want to paste in something from another program? Use paste. Want to paste in something I killed? Yank. Want to cut something I have selected with the mouse? Use cut then paste, not kill then yank. And we haven’t event talked about copy. So that’s annoying.

I could get around this by by setting a mark, going where I want to go, using the select_region command, and then cutting. Then I could always use paste. That would work, but it’s an extra command (and keybinding) just to kill some text. It’s also a deeper problem than just kill/cut: more complicated manifestation is that I can’t use to create a region and then hit Tab to add a tab to each line, because that command works on the selection, not this weird other region thing. The issue is that regions and selections are different things.

Slight aside: I’ve been using EmacsKillRing plugin that partially fixes at least the cut/paste part of this and adds some other Emacsy goodness, but it doesn’t really solve the issue that the region isn’t a first-class selection, and it has plenty of other issues too.

Anyway, what I want—I think, anyway—is just a select lock command. Instead of set_mark, I just want to say:

Look, I want my selection to start here. Wherever I go with caret, have the selection follow me, like how it does if I hit shift+up. Then treat my actions like you normally would. Cut cuts, Copy copies, etc.

That would add a total of one command and (for my purposes), get rid of all the kill/yank/region stuff. I’m a total noob when it comes to customizing ST2, but it seems kinda hard to implement as a plugin: would each command that moves the caret need to be aware of it? Do the actions that get rid of the selection have to be aware of it? It seems like I’d have to create my own versions of a lot of editing features to make it work. Or is there something simple I could be doing here?

The spellcheck face needs to be customizable

This is really only a problem for me when I’m writing blog posts, but since that’s what I’m doing right now, I’m going to complain about it. Spell-as-you-type uses a red squiggly underline, which is very painful to look at with a dark background:

My eyes!

I was unable to find a way to change that, and I did find some posts to the effect of “yeah, you can’t change that”. Bummer.

Opening an already-open file should move it to the right group

Sublime has groups, which allow you to split the screen. Files can be moved from group to group so that you can manage your workspace. And you can switch between them easily with the keyboard:

Splities

Another nice feature of ST is the “find a file dialog”, which allows you to open any file in your project via an autocompleting search. The cool thing is that if you already have the file open, it just pulls open that tab. The trouble is that these two features don’t play well together. If I want to edit an already-open file to the front of my selected group but the file is in some other group, Sublime will open another view on that file.

While it can occasionally be useful to see different parts of a file side by side, that’s the exception. One consequence is that you end up with a lot of clutter. If you have three groups and you’re working with five files, after enough switching you’ll have fifteen tabs open instead of just five. Another is that Sublime is a little quirky with more than one instance of a file open. For example, closing a tab triggers the “Don’t you want to save this?” dialog even if there are other instances open. There are other quirks like that. And that EmacsKillRing plugin we talked about earlier is totally broken in this scenario.

What Sublime should really do is move the file to the current group if it’s open already.

Deleting a file should close the file

This is the issue that probably causes me the most anguish on a day-to-day basis. You can delete files by right-clicking them off the side bar and clicking delete. Except that it’s not. If you have the file open, it’ll stay open. “Fine”, you say, and close it. But ST will think “Hmm, that file is different on disk, in that it doesn’t exist there. I’d better confirm Isaac really doesn’t want to save this!” and gives me a dialog about whether I want to save the file I JUST DELETED. Like, my intention is literally the opposite of what you’re asking about. In fact, it’ll do this even if I don’t have the file open, because when I right-click on the side bar item, ST opens it in a sort of preview mode, which is normally superuseful, but annoying here because when I close the preview I have to deal with this goddamn dialog.

If I delete a file, ST should close it.

Fewer dialogs

Sublime mostly gets out of your way, in that most of the dialogy things are expand out of the top or bottom of your screen and steal focus, as opposed to being a big rude modal dialog. That’s a great thing. But Sublime does have big rude dialogs, like “There’s a new version of Sublime. Would you like to upgrade?” or “This file has been edited. Would you like to save it?”, etc (neither of those are verbatim.) Not only are they jarring, but they’re also not very keyboard friendly, and reaching for my mouse to answer a question that could be Y/N makes me sad. Some sort of notification toaster would be better.

Some keyboard holes

I really hate using my mouse. Looking up, that’s actually what most of this is about. In general, Sublime does a good job here, but there are some holes. One in particular is search results. You can search your hole project, and results are displayed in a buffer. It’s really nice and Emacsy and well done:

Next, find things

But it doesn’t have good keyboard support. You have to actually click on those yellow boxes with your mouse; there’s no shortcut for that. You can actually iterate through all the results by hitting F4 as many times as you like, which is also nice, but not the same as being able to simply go to the right occurrence in the results and jump to it is frustrating.

I also haven’t figured out how to pull up the right-click menu with the keyboard, which would be really nice for selecting spelling alternatives.

Conclusion

Some of this I can probably fix with some Python hacking and some patience. Some of it will actually have to be changes in the product. In the meantime, it puts me in this annoying state of almost having a really great editor, but not quite.

Source