Section 8.6. Command Editing


[Page 307 (continued)]

8.6. Command Editing

Most modern command shells feature some easy method of recalling and editing previously issued commands. The original C shell did not provide this, but tcsh does. The easiest way to recall a previous command is to strike the up arrow button on your keyboard. This brings the most recently typed command onto your command line. You can back up and change something, hit Return to issue the command again, or hit the up arrow key again to go further back in the list. The down arrow key will move you forward in the command list.

It is sometimes preferable to use commands you're already accustomed to using to edit. So tcsh provides both a vim and emacs-style interface to command editing. By default, Emacs key sequences are used (i.e., Control-P for up, Control-D for down, see "Editing a File: emacs" on page 93 for more information). You can use the tcsh built-in command bindkeys to change this to vim key sequences (use the command bindkeys -v). When using vim-style key sequences, you must first type an Escape character to tell the shell you wish to edit your command history (think of your shell as command "insert mode"; you type an Escape to get out of insert mode just as you would in vim). After typing the Escape, you can move up and down in the command history with "k" and "j," respectively, just as you would in vim (for more information see "Editing a File: vim" on page 82).




Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net