Introduction

I think a text editor is the most important and most versatile tool an advanced computer user has. I also think you should not have different text editors for different tasks—i.e., an IDE for C++, a different one for Java, an editor specifically tailored for editing TeX files, and so on. In my oppinion, everyone should have an “allround” text editor, if only for the stuff you don’t want to open your IDE for.

Ever since Kile broke down on me in the middle of writing my bachelor’s thesis, I’ve been using vim exclusively. Over the years I learned lots of commands and tricks, customized it with plugins, modified plugins and made some useful additions on my own. I was very happy with it, and we were getting along nicely, me and vim.

Recently, Sublime Text started to gain a lot of popularity among my friends. I had read about it, but brushed it off quickly. It wasn’t going to be as cool or powerful as vim, and even if it were, why should I relearn all those commands. I was envious of the minimap, so I made one for vim, and found out that it looks nice, but is not useful to me (I know some who use it a lot in Sublime, but I din’t. I kept it on at all times when I tried sublime, but never found it really helpful).

A while later I saw more and more people around me use Sublime Text, most of them former vim users. So I talked to them, and found out some of them just never knew enough vim to be comfortable, but others have been power-using vim for years, and just like Sublime better now.

I finally decided to give it a shot. I’ve been using the evaluation version for about a month now, while making a list of things that I like better on Sublime, and things that I miss from vim.

GUI Beauty

The first thing I noticed: Sublime is fast, and it looks good.

Let’s face it—vim sometimes just feels old. The fact that gvim is little more than a fancy text terminal running vim doesn’t help, and probably makes it slower than it should be. It also makes some stuff (near-)impossible: A minimap, or good looking indent guides for instance. Sublime draws fine dotted lines that can be hidden when the cursor’s outside of the indented area. This makes it easy for me to see what’s between your { and }. In vim, you can set listchars so you can see the indent tabs, but you can’t do anything like that using spaces.

There also is a plugin which highlights your indentation using different background colors. Both ways cause so much visual clutter on my screen that I can’t concentrate on the actual contents of the file. It’s the same with the ruler marking the 80th (or whatever number you like) column. In vim you just have a different highlight for that column, which most of the time defaults to a big red bar. You can set it to produce “awkward underscores” or just the letter in that position turning red (which doesn’t help if it’s whitespace). But not the fine dotted line Sublime can display there.

What’s especially nice about Sublime is the persistence of vision while scrolling. When jumping to another part of the file, the screen does not instantly refresh, but instead visibly (and fluently) scrolls there. This and the well-visible minimap marker is very practical to me (guess that’s the one useful thing about the minimap—it’s a really wide scrollbar. I know roughly how far I jumped and where I ended up, which helps me to find my way around a file. In vim, there are only line numbers, a percent display and, if activated, relatively narrow scrollbars, all of which update instantly and thus only give you a feel for how far you jumped if you conciously pay attention to them. Semi-relatedly, for some reason I don’t understand, I happen to accidentally push PgDn every once in a while. On vim, pressing PgUp afterwards takes me back somewhere into the general vicinity of where I came from, while on Sublime, PgUp takes me back to the exact spot I came from, which is much less destructive to my train of thought.

A fun thing about Sublime you might not have noticed: The thumb-buttons on the mouse (forward / back) allow you to cycle through the open tabs. Before I tried Sublime I tried to implement the same behaviour in vim, but faild. Now I know that it’s not as practical as I thought.

Quick Navigation

I had to re-learn some things. I knew full well there was a “vintage mode” which provided a limited amount of vim commands in sublime, but I decided to leave that deactiavated at first, so I can see and learn how Sublime works without constantly thinking “that doesn’t work the way it’s supposed to” (i.e. “that doesn’t work the same way as in vim”).

What struck me most is that there’s no hotkey for “Save all”—there’s not even a :wa in vintage mode. I often edit multiple files, and after I make some changes, I go :wa and head to the terminal where I run the build process. It took me a while to realize I could use the menu mnemonics in the same way as the :-commands in vim. And “Alt-f l” is even shorter than “:wq”, even if you forget that you have to use a shift key for the :, too.

If you don’t like menu mnemos, there’s the Ctrl-Shift-p command palette which gives you quick access to a lot of commands. While it’s not as powerful as vim’s command line, it’s certainly easier to use, because it tells you what it can do instantly, and you just have to vaguely remember or guess the name of the thing you’re trying to do.

What’s really cool is the Ctrl-p “open anything” function, which basically allows you to quickly open any file in your source tree. I use it a lot, and I really like it. Like the command palette, it searches with just enough fuzziness to be compatible with my style of typos. I wonder whether there’s something similar for vim.

Window Management

Seeing that list, Sublime has a lot going for it, but I still miss vim for several reasons:

The handling of buffers, tabs, windows and splits in vim suits my style much better than the layouts of Sublime: In Sublime, I can only choose between several “layouts”, there is no way to just “:split” something. If I want two views of the same file, I have to open the file twice. Which adds all the fun associated with saving to that file from multiple tabs. The hierarchy of “groups (i.e. splits) contain tabs” is also not suitable to my style. When I write C++ code in vim, I usually have one tab for each pair of .cpp and .h file, which is :vsplit, one split contains the .cpp and the other contains the .h file. This is not possible in Sublime, though I quickly got used to just pressing Alt-o to toggle between header and implementation. Sublime’s handling of splits and tabs feels to stiff for me. I often split the window containing the .h file further, to allow me to view a different .h file which contains stuff relevant to what I’m doing at the moment. In vim, this only requires a few keystrokes, but in Sublime it’s not easily possible. I realize that I don’t really need it in Sublime: I don’t have a split with the .h file constantly open, so I can just press Ctrl-Alt-2 to split the window and drag the relevant tab into the newly generated region (probably there’s also keyboard shortcuts that do this).

Still, vim is much more flexible when it comes to this, and I like this flexibility. Sublime has no notion of “an empty tab you can fill with buffers”—it works the other way around, having “an empty region you fill with tabs”. I can’t get used to that, maybe because tabs for me feel like different contexts I can switch between, much like some people use virtual desktops.

Files and Contents

A small thing that disturbs me a lot is the notion Sublime has of a “changed file”. When I open a file and change something, both Sublime and vim notice that and mark the file a changed, giving the Tab a little plus or dot. When I undo that change again, vim notices and removes the plus. Sublime only removes the little dot when I explicitly use the “Undo” command. Typing a character and deleting it using Backspace or Del still keeps the file as “changed” in Sublime’s way of handling things.

I don’t like my files to contain trailing spaces, or lines that just contain a few spaces and nothing else. Vim can highlight trailing spaces, making it easy to avoid or remove them. Sublime has a plugin which should do the same, but this never worked the way I like it, and stopped working altogether after a week or so. There’s a “remove trailing spaces when saving a file” feature that might be a solution to this problem, but I feel it might bite me in the rear end one day, so I avoid it. I also noticed the auto-indentation of Sublime is much more prone to insert lines only containing spaces than vim’s auto-indentation.

Indentation

Which brings us to the next point: Indentation. I like the way vim’s auto-indentation works, and I can’t even say why. Maybe I’m just so used to it, but I’d say, it just works. Can’t say the same thing about Sublime though: Just indenting while I’m typing works fine, but auto-indenting a block of text is a mess: I couldn’t figure out what I was doing wrong, but I never got reindent (which is conveniently bound to the = key in vintage mode, along with == and %=) to really work. There was the rare case where it worked, but most of the time everything but the first three lines got indented a level too far, or not correctly indented at all.

Sublime has an autodetection mechanism for whether your file is indented using tabs or spaces, which is used for the auto-indenter from then on. I sometimes edit files on which multiple people with different editor settings have worked on in the past, and the files therefore have parts indented with tabs, and other parts indented with spaces. On those files, the autodetection naturally fails, and using reindent or Ctrl-] (the equivalent to » in vim) results in badly mixed indentation, containing tabs and spaces on the same line sometimes. And since reindent does not just convert one to the other, but tries to keep as much of the mess as possible, it’s not easily fixed either. Luckily there is a “Convert indentation to Spaces” option in the menu.

Multicursors

When someone shows off how cool Sublime is, they will most likely first bring up the minimap, and then the multicursors. Both features look cool, and at first I thought, “wow! That’s the FUTURE! I absolutely need those multicursors!”—I even tried to find and/or make a vim plugin that gives me multicursors (spoilers: Couldn’t make it work right).

Well, in Sublime I worked with them for a while, and yes, they are practical. But when I took a step back I soon noticed that I can do alsmost everything I use them for just as quickly and effortlessly in vim: Vim has macros, visual block mode, even the . key is enough most of the time (plus little things like ciw or viwp). And if those are not enough, just use a regex. Vim lacks the instant visual feedback, and the capability to do all the changes at the same time. But that doesn’t mean it’s slower or more complicated to do them. It just doesn’t look as cool.

I’m not saying Sublime can’t do it “the vim way”—I’m just saying that I feel somehow encouraged to use the multicursors when I probably shouldnt, because a regex or macro would have been quicker. Sometimes they are useful, but I can do without them. Maybe someone makes a vim plugin that works one day.

Smooth Visuals

About looking cool: Sublime’s cursor blinks really smoothly, especially if you set it to “phase”. But it’s only one pixel wide, with no apparent way of changing that (you can set it to a huge block though). In vim the cursor is at least a little wider, which greatly increases visibility. In Sublime I sometimes “loose” the cursor, so maybe the wider line is what I need, and maybe I should not use “phase” mode in Sublime.

There’s a powerful autocompletion built into Sublime. Vim doesn’t have that, but there are a lot of plugins you can use, and I’m quite happy with just Supertab. On a slow file system, Supertab lags a bit before the autocompletion menu pops up. Sublime lags after the autocompletion, which is just as bad. And the fact that Sublime’s autocompletion menu pops open without me doing something is not nice in vintage mode: Sometimes Esc brings me back to command mode, sometimes it just closes the autocompletion menu that might have popped up smoothly and sneakily and leaves me in insert mode. I suppose I could set the autocompletion so that it only pops up when I press tab or something, but I did not look into that yet.

Strange Syntax

I noticed that when I use tabcompletion in insert mode, and press . to repeat the command afterwards, the completion is broken. This might be a result of Sublime literally repeating what I typed, including the invocation of the tabcompletion, but not taking into account that it reorders the results when it’s used.

I’m still not really sure how n and F3 work. Sometimes I’m back into navigation mode just at the right time, so I can press n to search on, but sometimes I search for nnnn or hammer jkjkjk into the search bar desperately trying to find the cursor (which is still in the search bar for some reason). I guess I stopped looking to the bottom of the screen. What makes things worse is that the syntax of the Ctrl-R command and the normal search are not consistent: When using Ctrl-R, you have to press Return to stay where you are. In the Ctrl-F search, you have to press Esc, because Return takes you to the next result. But if you press Esc in Ctrl-R mode you end up where you came from. The arrow keys also have different meanings in each of the modes. Probably this only confuses me because in vim I used the / or *-search for anything, and it only occurs to me now that jumping to a symbol is different from searching for a piece of text. But both commands are used to jump around in a file, so maybe it’s not a good idea that the functions of Return and Esc are practically reversed.

And the feel?

But most important for me is the “feel” of such a tool: Sublime feels just like a fancy text editor to me, with a nice and round GUI, very smooth, but I’m still working on the text with just my bare fingers, plus Ctrl-X and Ctrl-V. Vim on the other hand, to me feels like a powerful tool. It gets out of my way when I want to edit a file, while at the same time giving me all the things I need to do more than just entering text. With Sublime, I often have moments of “what just happened?” or “how do I get there now?”—with vim I can go to exactly where I want to go, I can customize it, often on-the-fly just by hacking something into the command line (yay instant keybindings!), I can see my extra spaces and the autoindentation does what it’s (in my oppinion) supposed to do. Sublime is much better at “inter-file” navigation, but the “intra-file” navigation lacks the clarity of vim’s navigation mode. Despite the cool multicursors and the minimap, I still feel like I can get stuff done more efficiently in vim.

Maybe with some months or years of use, I would become just as “fluent” in Sublime as I have become in vim (where I’m still just scratching the surface of what it can do, by the way), but I think a month’s test-drive should be enough to evaluate whether it’s the right thing for me. I know my way around Sublime now, there might be some (or a lot of) tricks I can’t do yet, but I have decided that for myself that I feel most comfortable sticking to vim. Maybe I’ll try some other text editors in the future, but for now, I concluded that vim best suits my style.