cmd.hlp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· HLP 代码 · 共 576 行 · 第 1/2 页
HLP
576 行
Entering Commands:
==================
The command window is entered by pressing ':'. Commands
may be up to 768 bytes in length; the command window scrolls.
The following keys are recognized while typing a command:
CTRL_V - insert next keystroke directly.
CTRL_Q - same as CTRL_V
CTRL_O - insert current command after current line in file
ALT_O - insert current command before current line in file
CTRL_D - add the current "dot buffer" to the command string;
this is useful in conjunction with "memorize mode" ("m.").
Once a sequence has been memorized, then this can be
used to make a map command (eg :map CTRL_A <press CTRL_D>)
ALT_L - adds current line in the file, from the current column to the
end of the line, to the command string
CTRL_E - adds current space delimited word in file to command string
CTRL_L - adds current line in file to command string
CTRL_R - adds currently selected column range to command string
CTRL_W - adds current word in file to command string
TAB - try to file name complete on the current string.
The first match is completed, and a window with possible
choices is displayed. Subsequent presses of TAB will
scroll forward through the list of possible matches, and
pressing SHIFT_TAB will scroll backwards through the
list of possible matches. Cursor keys may also be used
ALT_TAB - command completion. Looks backwards through history for
first command starting with what is entered. Subsequent
presses of ALT_TAB get the 2nd last command, and so on.
CTRL_INS- restores last thing typed in the command window (one
level undo).
UP - scroll forwards through command history
DOWN - scroll backwards through command history
RIGHT - move cursor right through command
LEFT - move cursor left through command
CTRL_END- delete to end of command line
END - move to end of command line
HOME - move to start of command line
INSERT - toggle text insertion/overstrike mode
DELETE - delete character
ENTER - process current command
ESC - cancel current command
Commands
========
Some commands take an address range and/or an address; the following
characters have special meaning in an address:
. - current line
$ - last line
% - short for the pair of addresses 1,$
'a - line with mark a set
/regexp/ - search forward for regular expression regexp. the trailing '/'
is only needed if you want to have something following regexp.
if regexp is not specified, then the last search string is used.
?regexp? - like /regexp/, only searches backwards
+ - add next value
- - subtract next value
(if + or - are the first character, then they are assumed to operate
on the current line number, e.g. specifying +1 takes you forward one
line in the file)
Ranges are specified as two addresses n1,n2; eg:
1,5
'a,.
'z+5,$-10
/foo/+5,/bar/-1
Strings are specified either by themselves (if they contain no white space),
or as /string/, if there are spaces. To include a '/' in a string, escape
it (ie, use '\/' instead of '/')
The part of each command surrounded by square brackets must be typed;
the rest is optional.
(range) [>]
- shift specified range to the right "ShiftWidth" spaces.
(range) [<]
- shift specified range to the left "ShiftWidth" spaces.
(range) [!] (cmd)
- if range is specified, then the lines are run through the specified
dos command (the command must take input from standard in and put
its output to standard out) and replaces the lines with the output
of the the dos command.
If no range is specified, then the dos command (cmd) is run.
The global variable %(Sysrc) contains the return code
from the last system command, and %(Syserr) contains
the errno value.
[ab]brev (short) (long)
- create an abbreviation of (short) for (long). If (short)
is typed as a word in insert mode, it is expanded to (long).
See unabbrev.
[al]ias (name) (what)
- create an alias of (what) for (name). This is recognized
on the command line. See unalias.
(addr) [a]ppend
- append lines of text after line '.'. append is terminated by
including a line with nothing but a '.' in it.
Valid in EX mode only (source scripts or 'Q' from command mode)
[cascade]
- cascade all windows
[cd] (dir)
- change to directory (dir). If (dir) is not specified, the
current directory is displayed. (dir) may contain a drive
along with a path.
(range) [c]hange (!)
- delete the lane range, and replace with input text lines.
The input of text is terminated by including a line with
nothing by a '.' in it.
Valid in EX mode only (source scripts or 'Q' from command mode)
[comp]ile (-aA) (script) (compname)
- compile the script (script). If -a is specified, then all
local variables are translated at compile time (rather
than at run time) - this is useful for the startup script.
if -A is specified, all variables (both local and global)
are translated at compile time. The file will be compiled
into a file with the extension ._vi., unless (compname)
is specified. Also see "starting" and "script" help files
for more information.
[com]press
- insert tabs into file to replace leading spaces
(range) [co]py (addr)
- copy the specified range of lines after the line number (addr)
[da]te
- display current date and time
(range) [d]elete (buffer)
- delete line range. If a buffer ('1'-'9', or 'a'-'z')
is specified, the text is deleted into it, otherwise the
text is deleted into the active buffer.
[echo] (line) /msg/
- echos the message /msg/ on line (line) of the message window.
if (line) is coded as "off", then all message window data
is supressed (except for echo commands). "on" turns messages
back on.
[e]dit(!) (file1 (file2 file3...))
- open a new window for file. If a file already is
being edited, then control is transferred to the window for that
file. If no files are specified, then a window containing
a list of files in the current directory is opened, from
which a file may be selected. If (!) is used, then the current
file being edited is discarded and is replaced.
DOS wildcards may be specified in the file names.
[egr]ep "regexp" (file)
- searches for regular expression in the specified wild card
(file). (if (file) is not specified, it defaults to *.c).
When all matches are found, a selection window is presented
with the files that contained regexp. If you are not
using regular expressions, fgrep is much faster.
[eval] <expr>
- evaluates given expression
[execute] <str>
- execute the string <str> (acts as if <str> was typed at
the keyboard). The string that may be added has the same
syntax as the "map" command. See keyadd for a delayed addition of
keystrokes.
[fgr]ep (-c) (-u) "string" (file)
- searches for string in the specified wild card (file). (if
(file) is not specified, it defaults to *.c). Search is
case insensitive, unless -c is specified, in which case
the search is case sensitve. -u uses the CaseIgnore setting
to determine whether or not to be case sensitive in the search
When all matches are found, a selection window is presented
with the files that contained string.
[f]iles
- open a window with a list of all files currently being edited;
a file may be selected from the list
in EX mode, displays the current file status (like ^G)
(range) [g]lobal(!) /regexp/ (cmd)
- for each line with the regular expresson regexp, the command
(cmd) is executed. (cmd) may contain replacement expressions,
if g! is specified, then the command is executed for each line
NOT containing the regular expression.
see substitute for more information.
[help] <topic>
- brings up help for a specified topic. Topics are:
[com]mandline - all command line commands
[keys] - what different keys do
[reg]ularexpressions - how to use regular expressions
[scr]ipts - editor script commands
[start]ing - starting the editor
(addr) [i]nsert (!)
- insert text after the specified line number. The input of
text is terminated by including a line with nothing by a '.'
in it.
Valid in EX mode only (source scripts or 'Q' from command mode)
(range) [j]oin
- join the specified line range together onto a single line.
[keya]dd data
- adds a set of keystrokes to the key buffer, just as if they
were typed by the user. This is useful in a script, for
allowing keystrokes to be executed after the script is exited.
This prevents re-entrance of a script that is hooking
keys in input mode, for example.
Keys are processed in FIFO order.
The string that may be added has the same
syntax as the "map" command.
(range) [l]ist
- list the specified line range
Valid in EX mode only (source scripts or 'Q' from command mode)
[load] (script)
- loads a script into memory for the life of the edit session.
This allows for much faster access to the script, since the
data structures for the script to not have to be built
every time the script is invoked. This is especially important
for hook scripts. (see "scripts" help for more information).
[map](!) (key) (keysequence)
- tells the editor to run the keys (keysequence) whenever (key)
is pressed in command mode. (key) may be one of many special
tokens, e.g. CTRL_A, ALT_TAB etc.
if ! is specified, then the mapping is for insert mode.
Along with normal
ascii characters, the following control characters are allowed:
\h - if this follows a ':' (start command line), then the
command line is not added to the command history, e.g.:
map CTRL_T :\hdate\n
pressing CTRL_T to display the current date,
but it will not be added to the history.
\e - escape
\n - newline (enter)
\x - if it is the first character in the sequence, then the
opening of the command window is suppressed for the life
of the sequence. This prevents the "flashing" of the
command window on the screen if a command line command
is used.
\< - starts a key token. the string between the first <
and a closing > is translated into the appropriate key,e.g.:
map CTRL_W :fgrep \<CTRL_W>\n
press CTRL_W will execute an fgrep command, grabbing the
current word.
Recursion of maps does not occur, so map! a a causes
an "a" to appear when "a" is typed in insert mode.
See unmap.
[mapbase](!) (key) (keysequence)
- works exactly the same as the map command, all keys in the
keysequence work as their base functionality (mappings are
ignored)
(addr) [ma]rk (m)
- set mark (m) at line (addr)
[match] /s1/s2/
- Set what is matched by the '%' command. Defaults are "{","}"
and "(",")". For example, by performing a "%" on the first
'(' in the line:
if( (i=fred(x)) ) return;
moves the cursor to the last ')' in the line.
This command allows you to extend what is matched to
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?