emacs Editing Mode

If you are an emacs user, you will find it most useful to think of emacs editing mode as a simplified emacs with a single, one-line window. All of the basic commands are available for cursor motion, cut-and-paste, and search.

Basic Commands

emacs-mode uses control keys for the most basic editing functions. If you aren’t familiar with emacs, you can think of these as extensions of the rudimentary “erase” character (usually BACKSPACE or DEL) that UNIX provides through its interface to users’ terminals. For the sake of consistency, we’ll assume your erase character is DEL from now on; if it is CTRL-H or something else, you will need to make a mental substitution. The most basic control-key commands are shown in Table 2.1. (Important: remember that typing CTRL-D when your command line is empty may log you off!) The basic keyboard habits of emacs-mode are easy to learn, but they do require that you assimilate a couple of concepts that are peculiar to the emacs editor.

Table 2-1. Basic emacs-Mode Commands

Command Description
CTRL-BMove backward one character (without deleting)
CTRL-FMove forward one character
DELDelete one character backward
CTRL-DDelete one character forward

The first of these is the use of CTRL-B and CTRL-F for backward and forward cursor motion. These keys have the advantage of being obvious mnemonics. You can also use the left and right cursor motion keys (“arrow” keys), but for the rest of this discussion we will use the control keys, as ...

Get Learning the bash Shell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.