One of the most common questions I’m asked by Treehouse students is, “Which text editor should I use?” That’s a really great question with no simple answer. However, I can understand why it’s confusing. Wikipedia’s comparison of text editors is ridiculously lengthy and feels beyond human scale. Yet it makes sense that there’s an abundance of variety, because a text editor is a programmer’s most important tool and it mostly comes down to personal preference.
What is a text editor?
A text editor is a computer program that allows you to create and edit files that contain plain text. This is very different than a robust word processing program like Microsoft Word, Apple Pages, or Google Docs, because they add special formatting that’s hidden to the user. When you’re writing computer code, you don’t need or want any special formatting. In fact, your code probably won’t work at all unless it was written and saved in a plain text environment.
For completeness, I should also point out that a text editor is not the same thing as an IDE (integrated development environment). While almost every IDE has the capability of creating and editing plain text documents, they also include a wealth of other features and powerful capabilities. Some people do prefer these power tools, but they can sometimes come at the expense of other factors like flexibility, ease of use, or code that is both lean and performant. IDEs also tend to take up more screen space for all of their various panels and widgets, which can factor in to the decision for some people. A more everyday text editor lacks these capabilities in exchange for maximum flexibility.
Which text editor should I use?
Imagine that you’re in a restaurant and you ask, “What kind of wine should I get?” The server might recommend some reds and whites, but you may ultimately want them to make the decision for you. There’s too many to choose from, so if you’re inexperienced, you’re naturally inclined to draw upon the experience of another.
Text editors are a similar beast. The text editor you use depends on a couple of factors, but primarily it comes down to personal preference. While there’s no simple answer to “Which text editor should I use?” there’s one simple rule that can guide you in making the choice:
You should use the text editor that makes you the most efficient.
If you’re comfortable with your tool, it (hopefully) means that you’re also able to get work done quickly. The tool should disappear and allow your ideas to fly. Most text editors aspire to this vague goal, but it’s a moving target because everyone has slightly unique preferences and needs. Now, let’s get a bit more practical and take a look at a few of the most popular text editors that the pros use.
Price: $70 USD, free trial
Platform: Windows, Mac, and Linux
When choosing a text editor, you should try out a few to see which ones you like. However, if you just want a great all around text editor, then download Sublime Text. Currently in its 2nd version with version 3 on the way, this is a popular choice amongst web professionals because of its simplicity and low learning curve. It works on Windows, Mac, and Linux, it has great syntax highlighting, nice default themes, and a few built-in power features. We use Sublime Text 2 in most Treehouse videos and it works great for us.
Platform: Windows, Mac, and Linux
Vim is notorious for being difficult to learn, but rewarding. It has a high learning curve and isn’t really suitable for beginners. If you’re just starting to program, you’ll have enough to learn as it is, so you might not want to pile on additional difficulty. However, if you’ve been coding for several years and you’re ready for more powerful tools, vim might be for you. Its power is in its extensive customization and keyboard macros. Even after learning the basics of vim, many programmers feel they’re able to code more efficiently.
Price: $54 USD
Platform: Mac only
TextMate is a text editor for Mac OS X that has been around for quite some time. This is very similar to Sublime Text, but with the addition of source control and other file navigation features. Feature overlap is perfectly fine though, because as I mentioned earlier, a lot of choosing a text editor comes down to personal preference. After 6 years of work and lots of anticipation, the source code to the 2.0 version was released to the public. Even though the product is open source, its creator likens this to DRM-free music in that it allows you to do more with it. You can download TextMate for free, but future versions may require a license, so it’s best to purchase one.
Price: $75 USD, free trial
Platform: Mac only
Coda leans a lot more towards an IDE than other text editors I’ve listed. The reason I’m including it in this list is because it’s primarily targeted at web development, which makes it slightly unique. Most other text editors are intended to be general purpose and should work with any plain text file. Coda is absolutely packed with features, so if you’re coming from another programming environment with a more robust IDE (like Xcode) then Coda might be a good transitional program for you. In addition to a text editor, Coda includes an FTP client, MySQL management, and more.
Platform: Windows only
Many web professionals get their start with Notepad, the text editor that’s included with Windows. This makes sense, because Windows is a popular operating system and the included text editor is easy to access. If you’re comfortable with Notepad but you’re ready to step things up a bit, you might enjoy Notepad++. It includes syntax highlighting, tabbed files, and lots of other features that feel more like an enhancement to Notepad rather than a separate program.
As I mentioned previously, there’s no shortage of variety when it comes to text editors. If you have others you’d like to recommend, please mention them in the comments!