Text files

Basic features for text editors

These are basic skills you should be able to do with your text editor.

Whatever text editor you decide to use, you must learn to do these things efficiently.

If you’re programming, you are going to spend a lot of time editing source code. Using the menus for basic functions like these will be much too cumbersome. There will be keyboard shortcuts for them: learn them!

Keyboard shortcuts might differ for different programs, but often there are similarities (for example, Control-Z for undo is common).

Save file

Many programs auto-save for you, but that’s less common in text editors. So make sure you know how to save the file after you’ve changed it.

Moving around the file is usually done with the arrow keys (or clicking with the mouse). But you can often scroll up and down by whole pages too, or jump to the next word, or either end of the line.

Jump to line

When you have an error in your program, it’s very common to know what line number it’s on. You must be able to quickly and reliably jump to a specified line. It’s also handy if you can see what column you’re on too: most text editors show this somewhere in the interface.

Find

Searching for a string in the file is very useful. Be aware if you are searching case-sensitively (yes is not the same as Yes or YES).

Most editors support regular expressions which are a powerful way to describe patterns of text. If you learn regular expressions, they will be very useful (both for searching text, and programming).

Find and replace

Related to Find, it’s often useful to be able to find text and then replace it.

Indent

It’s surprisingly common to need to indent (or un-indent) blocks of text, and many text editors support this.

Undo/redo

It’s common to be able to undo your work if you make any mistakes.

Programmers use version control systems for a more sophisticated way of handling this, but you will also find undo to be useful.

Cut and paste

Cut (or copy) and paste text to move it around. You’ll need to be able to select it first (if you’re using a mouse, click and drag is common).

Some text editors support dragging as a quicker method of moving selected text without passing it through the paste buffer.

Show invisibles

When you are programming, sometimes invisible characters can catch you out: these include non-printable characters, spaces and tabs. If they are part of a string, they can look identical to strings that are not the same. Editors often allow you to display invisible characters so you can see if this is happening.