emacs Editing Mode

This section describes how to edit commands using the emacs bindings. Be sure to select those bindings before trying any of the commands described below:

% bindkey -e

In emacs mode, editing commands are always active. Any character that is not an editing command is inserted into the edit buffer. Otherwise, the command is executed.

emacs Cursor Motion Commands

Before making a change (e.g., adding or deleting text), you position the cursor. The emacs cursor motion commands are shown in Table 7-1.

Table 7-1. Cursor Positioning Commands (emacs Mode)

Command

Description

CTRL-B

Move cursor back (left) one character

CTRL-F

Move cursor forward (right) one character

ESC b

Move cursor back one word

ESC f

Move cursor forward one word

CTRL-A

Move cursor to beginning of line

CTRL-E

Move cursor to end of line

Try these commands by entering the following line, leaving the cursor at the end:

% echo this is a command

Then, enter the editing commands below; you should see the cursor move, as shown:

% echo this is a comman       Type CTRL-B
% echo this is a ommand       Type ESC b
% cho this is a command       Type CTRL-A
% 

Get Using csh & tcsh 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.