Command Line Editing

<< Click to Display Table of Contents >>

Navigation:  TCC > Command Line >

Command Line Editing

The command line works like a single-line word processor, allowing you to edit any part of the command at any time before you press Enter to execute it (or Esc to erase it).

 

The command line as typed (before alias and variable expansion) can contain up to a maximum of 65,535 characters. See Command Line Length Limits.

 

You can use the following editing keys (among others) when you are typing a command (the words Ctrl and Shift mean to press the Ctrl or Shift key together with the other key named). The keystrokes listed here are the default values; the keys can be edited with the OPTION / Keyboard dialog.

 

Cursor Movement Keys:

 

DirectiveDefault        Description

 

Left Left        Move the cursor left one character on the input line
Right Right        Move the cursor right one character on the input line
WordLeft Ctrl-Left        Move the cursor left one word
WordRight Ctrl-Right        Move the cursor right one word
BeginLine Home        Move the cursor to the start of the line
EndLine End        Move the cursor to the end of the line
ArgLeft Alt-Shift-Left        Move the cursor left to the previous argument
ArgRight Alt-Shift-Right        Move the cursor right to the next argument

 

Insert and Delete Keys:

 

DirectiveDefault        Description

 

Ins Ins        Toggle insert / overstrike mode
Del Del        Delete the character at the cursor
Backspace Backspace        Delete the character to the left of the cursor
DelWordLeft Ctrl-L        Delete the word to the left of the cursor
DelWordRight Ctrl-R        Delete the word to the right of the cursor
DelArgLeft Ctrl-Alt-L        Delete the argument to the left of the cursor
DelArgRight Ctrl-Alt-R        Delete the argument to the right of the cursor
DelToBeginning Ctrl-Home        Delete from the cursor to the start of the line
DelToEnd Ctrl-End        Delete from the cursor to the end of the line
EraseLine Esc        Delete the entire line
Paste Ctrl-V or Shift-Ins        Paste line from clipboard
Ctrl-Shift-V        Insert a " & " between lines of a multiline paste
Argument0Ctrl-0        Get argument 0 from previous command line
Argument1 Ctrl-1        Get argument 1 from previous command line
Argument2 Ctrl-2        Get argument 2 from previous command line
Argument3Ctrl-3        Get argument 3 from previous command line
Argument4 Ctrl-4        Get argument 4 from previous command line
Argument5 Ctrl-5        Get argument 5 from previous command line
Argument6 Ctrl-6        Get argument 6 from previous command line
Argument7 Ctrl-7        Get argument 7 from previous command line
Argument8 Ctrl-8        Get argument 8 from previous command line
Argument9 Ctrl-9        Get argument 9 from previous command line
Redo Alt-Y        Redo the last Undo
Undo Alt-Z        Undo the last edit
PrevArgument Ctrl-B        Recall the last argument from the previous command line

 

Highlighting:

 

DirectiveDefault        Description

 

SelectFromHome Shift-Home        Mark from the beginning of the line to the cursor
SelectLeft Shift-Left        Add the character on the left to the selection
SelectRight Shift-Right        Add the character on the right to the selection
SelectToEnd Shift-End        Mark from the cursor to the end of the line
SelectWordLeft Ctrl-Shift-Left        Add the word on the left to the selection)
SelectWordRight Ctrl-Shift-Right        Add the word on the right to the selection
CopyCtrl-Y        Copy the highlighted text to the clipboard
Ctrl-C        Copy the highlighted text to the clipboard (if anything is highlighted); otherwise cancel the command

 

Execution:

 

DirectiveDefault        Description

 

ExecLine Enter        Execute or accept a line
LineToEnd Ctrl-Enter        Copy the current command line to the end of the history list, then execute it
Ctrl-C or Ctrl-Break        Cancel the command line without saving it in the history list

 

Tab Completion:

 

DirectiveDefault        Description

 

NextFile Tab or F9        Get the next matching filename during tab completion
AddFileF10        Keep tab completion entry and add another
DirectoryCompletionShift-F6        Toggle between the default files + directories filename completion, and directories only
FileBrowse F5        Display the Windows file browse dialog
FolderBrowse Alt-F5        Display the Windows folder browse dialog
LFNToggle Ctrl-A        Toggle tab completion between long filename and short filename modes on LFN drives
OriginalFile Alt-F9        Restore the original filename
PATHCompletionCtrl-F6        Toggle between completing files found in the local directory, and completing them in the local directory + all of the directories in PATH
PopFileF7 or Ctrl-Tab        Open the tab completion window
PrevFile F8 or Shift-Tab        Get the previous matching filename
RepeatFile F12        Repeat the previous matching filename

 

Command and Directory History:

 

DirectiveDefault        Description

 

HistWinOpen PgUp        Open the command history popup window
DirWinOpen F6        Open the directory history popup window
EndHistory Ctrl-E        Display the last entry in the history list
LastHistory F3        Return the last history entry
DelHistory Ctrl-D        Delete the current history list entry and display the previous entry
SaveHistory Ctrl-K        Save the command line in the command history list without executing it
NextHistory Down        Get the next command from the command history
NextDirHistory Shift-PgDn        Get the next directory from the directory history
PrevDirHistory Shift-PgUp        Get the previous directory from the directory history
PrevHistory Up        Get the previous command from the command history
PrintHistory Ctrl-P        Print the command history

 

Miscellaneous:

 

DirectiveDefault        Description

 

Help F1        Display the Help topic for the current command
HelpWord Ctrl-F1        Display the Help topic for the word at the cursor
ParentDirectory Ctrl-Shift-Up        Change to the parent directory
AliasExpandCtrl-W        Expand all aliases on the command line
VariableExpand Ctrl-X        Expand variables on the entire command line
VariableExpandWordCtrl-Shift-X        Expand variables for the current word
CommandDialog Alt-F2        Display the command dialog for the first argument on the command line
CommandEscapeAlt-255        Do not interpret the next keystroke as a command line editing key
Regex Ctrl-F7        Display the regular expression analyzer dialog
SingleStep Ctrl-F5        Toggle batch debugger single-stepping
FontMax Ctrl-Plus        Increase the console font size
FontMin Ctrl-Minus        Reduce the console font size
ConsoleHeightMaxCtrl-Alt-Shift-Down        Increase the console window height
ConsoleHeightMaxCtrl-Alt-Shift-Up        Decrease the console window height
ConsoleWidthMaxCtrl-Alt-Shift-Right        Increase the console window width
ConsoleWidthMinCtrl-Alt-Shift-Left        Reduce the console window width
MoveConsoleDown Alt-Win-Down        Move the console window down
MoveConsoleUp Alt-Win-Up        Move the console window up
MoveConsoleLeft Alt-Win-Left        Move the console window left
MoveConsoleRight Alt-Win-Right        Move the console window right

 

To highlight text on the command line use the mouse or hold down the Shift key and use any of the cursor movement keys listed above. You can select a complete word by placing the cursor anywhere in the word and double-clicking with the mouse. Once you have selected or highlighted text on the command line, any new text you type will replace the highlighted text. If you press Bksp or Del while there is text highlighted on the command line, the highlighted text will be deleted.

 

TCC does not turn off the selection if you use the left or right cursor keys (or Shift-Left, Shift-Right, Shift-Ctrl-Left, or Shift-Ctrl-Right). So selection (marking) from the keyboard (Shift-Left / Shift-Right) allows you to go back to the selection (inside the selection or immediately before or after) and resize it with Shift-Left / Shift-Right) again.

 

While you are working at the prompt you can use the clipboard to copy text between TCC and other applications (see Highlighting and Copying Text for additional details). You can also use Drag and Drop to paste a filename from another application onto the command line.

 

Most of the command line editing capabilities are also available when you are prompted for a line of input. For example, you can use the command line editing keys when DESCRIBE prompts for a file description, when INPUT prompts for input from an alias or batch file, or when LIST prompts you for a search string.

 

If you want your input at the command line to be in a different color, see the Windows tab of the configuration dialogs.

 

TCC will prompt for additional command line text when you include the escape character as the very last character of a typed command line. (The default escape character is the caret "^".) For example:

 

echo The quick brown fox jumped over the lazy ^

More? sleeping dog. > alphabet

 

Sometimes you may want to enter one of the command line editing keystrokes on the command line instead of performing the key's usual action. For example, suppose you have a program that requires a Ctrl-R character on its command line. Normally you couldn't type this keystroke at the prompt, because it would be interpreted as a "Delete word right" command. To get around this problem, use the special keystroke Alt-255. You enter Alt-255 by holding down the Alt key while you type 0255 on the numeric keypad, then releasing the Alt key. This forces TCC to interpret the next keystroke literally and place it on the command line, ignoring any special meaning it would normally have as a command line editing or history keystroke. You can use Alt-255 to suppress the normal meaning of command line editing keystrokes even if they have been reassigned with key mapping directives, and Alt-255 itself can be reassigned with the CommandEscape configuration option.

 

Alternative Keyboard Input Method:

 

The method mentioned above for Alt-255 can be used to generate other characters. You must use the number keys on the numeric keypad, not the row of keys at the top of your keyboard. When this Alt + keypad approach is used in a Unicode environment, TCC will assume that a 3-digit decimal value means an ASCII character, while a 4-digit decimal value mean a Unicode glyph. Make sure that your hardware, character set, code page and font all support the desired combination. Use caution with this method if you plan on manipulating the generated character in other Windows components. See the section on ASCII, Key Codes and ANSI X3.64 Commands for some additional information.