![]() 8.7. Command-Line Manipulationcsh and tcsh offer a certain amount of functionality in manipulating the command line. Both shells offer word or command completion, and tcsh allows you to edit a command line. 8.7.1. CompletionBoth tcsh and csh provide word completion. tcsh automatically completes words and commands when the Tab key is hit; csh does so only when the filec variable is set, after the Esc key is hit. If the completion is ambiguous (i.e., more than one file matches the provided string), the shell completes as much as possible and beeps to notify you that the completion is not finished. You may request a list of possible completions with Ctrl-D. tcsh also notifies you when a completion is finished by appending a space to complete filenames or commands and a / to complete directories. Both csh and tcsh recognize ~ notation for home directories. The shells assume that words at the beginning of a line and subsequent to |, &, ;, ||, or && are commands and modify their search paths appropriately. Completion can be done midword; only the letters to the left of the prompt are checked for completion. 8.7.2. Related Shell Variables
8.7.3. Related Command-Line Editor Commands
8.7.4. Related Shell Built-ins
8.7.5. Command-Line Editing with tcshtcsh lets you move your cursor around in the command line, editing the line as you type. There are two main modes for editing the command line, based on the two most common text editors: Emacs and vi. Emacs mode is the default; you can switch between the modes with: bindkey -e Select Emacs bindings bindkey -v Select vi bindings The main difference between the Emacs and vi bindings is that the Emacs bindings are modeless (i.e., they always work). With the vi bindings, you must switch between insert and command modes; different commands are useful in each mode. Additionally:
8.7.5.1. Emacs modeTable 8-1 through Table 8-3 describe the various editing keystrokes available in Emacs mode. Table 8-1. Cursor Positioning Commands (Emacs Mode)
Table 8-2. Text Deletion Commands (Emacs Mode)
Table 8-3. Command Control (Emacs Mode)
8.7.5.2. vi modevi mode has two submodes, insert mode and command mode. The default mode is insert. You can toggle modes by pressing Esc; alternatively, in command mode, typing a (append) or i (insert) will return you to insert mode. Tables 8-4 through 8-10 describe the editing keystrokes available in vi mode. Table 8-4. Commands Available (vi's Insert and Command Mode)
Table 8-5. Editing Commands (vi Insert Mode)
Table 8-6. Cursor Positioning Commands (vi Command Mode)
Table 8-7. Text Insertion Commands (vi Command Mode)
Table 8-8. Text Deletion Commands (vi Command Mode)
Table 8-9. Text Replacement Commands (vi Command Mode)
Table 8-10. Character-Seeking Motion Commands (vi Command Mode)
![]() Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|