Have you just become aware of text editors and are starting to understand why you’d need one? This article is intended for readers who need a text editor, and a helpful basic overview about them to get started.
What’s a Text Editor?
A text editor is an application used for editing text files, having no function for adding visual formatting such as bold or italics, to the edited text. If your editor application allows you to set formatting on text, as you can do with an app like MS Word, Apple Pages or Mellel, it’s not a text editor specifically, but rather what might be termed a “word processor”.
You might be looking for a text editor if you’re in the following categories:
- those just getting started in coding and programming
- those who have been told to find and use one
- those who want to edit in text, a future-proof format (c.f. MS Word’s proprietary format)
- those who need to edit text-based markdown content files
You’ll probably find this out anyway, but Mac, Windows and *
have text editors built in. In the case of Mac, it’s “Text Edit” in the GUI (which ironically defaults to saving rich text) and
vi in the Terminal.
On Windows, you have “Notepad” and on *
, you usually have a default in the GUI, and various ones in the Terminal such as
nano. Since Macs are based on *
, there’s a wide range of stuff available in the Terminal, which you can install via
Common Editor Features
Text editors almost always feature certain common aspects that you’ll observe in one form or another, such as these:
- Save text files in a specific encoding, such as UTF-8 (preferred) or Japanese “Shift JIS”.
- Control which line endings are used in a file, such as LF which works for * nix , or, CRLF for Windows.
- Display line numbers, and wrap each line at a certain number of spaces, in addition to giving feedback about file stats like number of words, line, characters and so on.
- Replace tab characters with spaces, which is useful when the project you’re working on requires that.
- Search and replace in a file or folder of files, on some text string, or using regular expressions.
- Organize your files and folders in “projects”, and display multiple open files in tabs, whether vertically- or horizontally-oriented.
- Control display of the file with a split-screen view or text “folding”, making it easier to jump back and forth and see what you’re doing, especially in a large file.
- Autocompletion during editing, to allow you to type the beginning of an often-used code fragment, having it automatically replaced by the full expression.
- Tools for text manipulation, like:
- quick switching between lowercase, title case or upper case
- straighten quotes or make quotes “smart”
- sort lines and remove duplicate lines
- commenting and un-commmenting in a language-sensitive manner
- Some kind of automation or macro feature, to let you repeat sets of oft-used commands.
- A “scratch pad” to let you store snippets of code you often use.
- Some level of customization, perhaps via a plugin system, which allows you to tweak the features to your liking.
Other key points
There are a few other important matters to consider as well:
- Is the editor cross-platform? Is there a version for Mac, Windows and/or Linux?
- Is the editor open source or closed source?
- Large file handling. Will the editor choke when you try to open a multi-gigabyte log file?
- How big is the team that is working on it? Are they going to be around for the future?
- What is the support forum like, and are there complaints that tell you a specific story?
- Does the editor support Editor Config? It’s a great way to stay consistent from project to project or even editor to editor.
- Can you back up the editor’s settings? Is it easy to restore?
- Is it like what you’re used to? This is not so relevant at the beginning, but if you switch editors later, your productivity will dip while you get used to new keyboard shortcuts and ways of doing things. If you have time, try
vimfor a couple days, then switch to
emacsfor a couple days, to see what I mean.
Editors to consider
Here’s a list of a few editors I’ve tried either briefly, or in production for months or years:
Cross Platform Editors
- Atom.io, Github’s editor for the 21st century.
- Sublime Text
- Visual Studio Code
- Brackets, Adobe’s editor for web dev.
- Caret, a free Chrome app available on the Chrome Web Store. Support wiki is here. Caret’s settings are saved to Chrome’s sync storage, meaning that your configuration will be synchronized across multiple computers wherever you’re logged into your Google account.
There’s also a special editor for cleaning up text, called TextSoap. It’s not really a programmer’s editor, but is really useful nevertheless, as a part of, say, an article editing workflow.
These are editors specifically optimized or built for editing markdown files:
|Cross-platform||Github’s Atom.io editor handles markdown via plugins.|
|Windows||Markdown Pad 2|
Integrated Development Environments
Is your Editor part of an IDE? Sometimes an editor is at the center of a full IDE , which often includes more tools that allow you to handle all the tasks needed in a software development life cycle:
- Integration with git or other source control systems.
- Integration with syntax checkers (aka “linters”) to check your source code, or tools to output a “minimized” version of a file.
- Integration with compilers.
- Integration with a Terminal app.
Some editors don’t really bill themselves as an IDE , but they attempt to allow you to set up something close or equivalent, via plugins.
Here are a few IDEs to possibly consider:
|Cross-platform||Eclipse, for Java and C/C++ dev.|
|Cross-platform||Visual Studio, for Windows dev originally, but more flexible as of 2016.|
|Mac||XCode, for Cocoa, Cocoa Touch and Swift dev.|
You might also look into “cloud IDE ” services such as the following:
These provide an integrated development environment in a web browser, so that you can get started quickly, without worrying about what’s on your machine. Some of these services offer free options.
Master the Basics
Once you decide on an editor, you should master its basics.
Besides the features you can access by hunt and peck through the menus, take the time to learn the keyboard shortcuts it provides. You can also learn using cheat sheets like this one for Atom (more are out there; just search), or simply looking at the menu and practicing the shortcut the next time you use that feature.
If you’re on Mac, do check out “Cheatsheet”. Once you install it, just press and hold the cmd key, to have a Cheatsheet pop up for that application (assuming it knows about the app). Another great one is Kapeli Dash, which is a tour de force collection of developer documentation.
Besides the basics of how to use whatever text editor you choose, there are a few guidelines to keep in mind:
- Use Editor Config for editor setting consistency. Not all editors support it, but it’s really useful, so you should use one that does.
- Use Linters to check your code for errors.
- Save files in plain text, utf-8 encoding only.
- Set your editor to use only unix-style LF (
\n) line endings.
- Use 2 spaces per indent, to show structure. Don’t use tabs.
- Use line length of 80 or less.
If you’re not sure why, just use the above parameters as a starting point. You can adjust as you learn more or, work on other projects as a team member.
I hope this information helps someone.
- See a massive editor comparison list on Wikipedia.
- 1 Nov 2016 - Nitrous is closing, so I’ve removed the link to their service.
- 27 Mar 2016 - Vihan Bhargava on Google+ pointed out that ASCII is not an encoding. Thank you Vihan for pointing this out. I was thinking ANSI while typing ASCII . But it is more proper to mention an encoding like ISO 8859-1 or Shift JIS, I think. Duly edited.
The banner photo is a cropped, monochrome version of 19th century work bench with many tools, Auckland on Wikimedia Commons, by Jorge Royan.