DEV Community

loading...
Cover image for Why TextMate 2 is My Favorite Code Editor for Mac (Part III)

Why TextMate 2 is My Favorite Code Editor for Mac (Part III)

davidmles profile image David Morales Originally published at davidmles.Medium Updated on ・6 min read

In this last part of the series, I’m going to compare two of the features I use most in my work: project search and open quickly.

Project search

In an IDE, you have many tools to know where a method is implemented or which file it belongs to. In a text editor, there is usually no easy way to do this, although there may be tools that emulate these features.

TextMate 2, being a native editor for Mac, follows a classic style on the platform: it opens a window to perform the search, and everything happens inside.

Project search in TextMate 2

It supports regular expressions, ignore case, ignore whitespace, search in a directory, search history (as a clipboard), search specific file-types, and more. The search results are precise, grouped by file, which can be collapsed or removed from the list. Finally, you can select the desired files to replace what you are looking for with another string.

What I like about this system is that once you double-click on a result, the window is placed in the background, and when you open it again, it remains in the same state.

Another thing I like about this editor is that when you type in the replace box, you can see in the search results how they will be replaced.

In Sublime Text 3, the search feature appears below, supporting the same features as TextMate 2. The results are displayed in a completely different way: they show in a text file as if it was just another one of the project. They are grouped by file and can be collapsed, just as you can collapse the implementation of a function in any other file. To delete a search result, just select it and remove it as if it was regular text.

Project search in Sublime Text 3

Double-clicking one opens the related file in a new tab, leaving the results on its tab so that you can return to it. Unlike TextMate 2, typing in the replace box does not show how it will look.

The project search in Atom is very similar to Sublime Text 3, with the incentive to show how the text substitution looks, as you can see in the following screenshot. I’ve marked to replace TopTopic with Foo, and it uses a color scheme like a diff in a version control system.

Project search in Atom

Visual Studio Code follows the same style as Sublime Text 3 and Atom but using a side panel for search controls. It offers standard search features, as well as previewing how the text replacement looks like, by crossing out the search term.

Project search in Visual Studio Code

In the case of Brackets, this feature is a mix of the previous editors. The search controls are in a top panel and the results in a bottom panel. You can collapse results but not remove them. Perhaps it lacks search options, and the font used in the results is too small. Like Sublime Text 3, there is no text substitution preview.

Project search in Brackets

Open quickly

Although a code editor offers a file browser, we often know the filename or part of it. There is a feature to open this file quickly.

In TextMate 2 we have the Open Quickly feature, which opens with Command+T. We can search for compound names without having to type spaces or points, and after pressing enter, we have the file open. If we also know the line, we put a colon and the line number, as you can see in the screenshot.

Open Quickly in TextMate 2

But what’s great is that it learns as we use it. As you can see from the screenshot, the editor is suggesting draft.rb. What if I prefer to open another file with that name? Select it, and the next time you type draft, that file will be suggested as the first option. This is a beautiful and time-saving feature.

In Sublime Text 3, we have the Goto Anything feature, which opens with Command + P. A list of results is displayed as you type, but the selected suggestion automatically opens the file, allowing you to view its contents while still using this feature, as you can see in the screenshot.

Goto Anything in Sublime Text 3

What I don’t like is that if we add the line number, the list of results disappears, focusing on the open file.

The filename learning feature works just as well as in TextMate 2.

Atom has the Find File feature (internally called fuzzy-finder), which is opened with Command + P. As in other occasions, this window obfuscates the editor, not being able to see what is open.

It works in the same way as TextMate 2, keeping the list of results if you add the line number.

Find File in Atom

What doesn’t work is the learning feature we saw earlier. Selecting another result does not pre-select it when searching for the same term again, even when activating the Alternate Scoring option. You can enable the Preserve Last Search option, which, like the previous editors, causes the last file opened to be displayed as the first option in the list.

This feature in Visual Studio Code is called Go To File, and it opens with Command + P. It works a little differently than what we have compared so far. The basic functionality is the same: it suggests files with the approximate name of what we are looking for. But once the file is opened, if we search again, the panel is divided in two, as you can see from the screenshot.

Go To File in Visual Studio Code

At the top are the recently opened files that match the search term, and below the regular results. It is an inferior alternative to the learning feature used in TextMate 2 and Sublime Text 3 since after choosing a different suggestion than the default one, it is not remembered later on.

The line number search works the same way as in TextMate 2.

Finally, in Brackets there is also this useful feature, called Quick Open, in this case, opening with the combination Shift + Command + O.
A list of results appears on the right side of the editor, leaving space in the middle so you can see what you have opened at the moment.
The functionality is the same as in the other editors, being able to search by line number without losing the list, as you can see in the screenshot.

Quick Open in Brackets

As you might expect, you don’t have the learning feature that TextMate 2 and Sublime Text 3 implement.

Conclusion

These have been the features that I use the most every day. I have left many other features that you can find in these code editors, such as text-processing, symbol searching, and other automations. Don’t forget that you can add even more features by installing extensions.

My usual code editor is TextMate 2, and due to its stagnant development, I have downloaded these editors on more than one occasion to test the features I have compared in this series of articles. In my case, I always keep using TextMate 2, possibly because what I use the most is better implemented in this editor, in my opinion.

However, all of them are very valid options. We must remember that the truly free ones are non-native: Atom, Visual Studio Code, and Brackets. TextMate 2 and Sublime Text 3, although they can be used for free, require a license if you are going to use them in the long run.

Discussion (0)

pic
Editor guide