📄 cmds.gml
字号:
.param a
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis move
.seethis put
.seethis yank
:cmt. .seethis *key=1 d
:cmt. .seethis *key=1 p
:cmt. .seethis *key=1 P
:cmt. .seethis *key=1 y
.alsosee end
.endfunc
.begfunc ECHO
.syntx * ECHO <.line>. <.msg>.
.begdescr
Echos the message &parm2 on line &parm1 of the message window.
.np
If &parm1 is specified as
.param off
:cont.,
then nothing is echoed into the message window from then on.
.np
If &parm1 is specified as
.param on
:cont.,
messages will start to appear in the message window again.
.np
&parm2 may be surrounded by double quotes (") or a forward slash (/)
if it contains any spaces.
.enddescr
.xmplsect begin
.begxmpl echo 1 "hello world"
The words
.param hello world
will appear on line 1 of the message window.
.endxmpl
.begxmpl echo off
Disables output to the message window.
.endxmpl
.begxmpl echo on
Enables output to the message window.
.endxmpl
.begxmpl echo 2 /Line 2 message/
The words
.param Line 2 message
will appear on line 2 of the message window.
.endxmpl
.xmplsect end
.endfunc
.begfunc EDIT
.syntx * Edit '"!"' <.files>.
.begdescr
Edits the specified files &parm2.
:period.
&parm2 may be a single file or a list of files.
.np
Each file name may contain file regular expressions, see the section
:HDREF refid='fmrx'.
in the chapter
:HDREF page=no refid='rxchap'
for more information.
.np
If &parm1 is specified, then the current file is discarded before editing
the new file(s).
.np
If a file is already being edited,
then control is simply transferred to the window with that file.
If the file is already being edited and you specified a different path,
then a new copy of the file is read from the disk and is edited, unless
.keyref samefilecheck 1
is set.
If
.keyref samefilecheck 1
is set, then control is transferred to the window with the original copy
of the file.
.np
If you wish to have have multiple views on the same file, the
.keyref open
command is available.
.np
If &parm2 is not specified, then a window containing
a list of files in the current directory is opened.
:INCLUDE file='fsdesc'.
.enddescr
.xmplsect begin
.begxmpl edit test.c
Edits the file test.c.
.endxmpl
.begxmpl edit! test2.c
Discards the current file, and edits test2.c.
.endxmpl
.begxmpl edit test.(c|h)
Edits the file test.c if it exists, and the file test.h if it exists.
.endxmpl
.begxmpl edit ([a-c])*.c
Edits all files in the current directory that start with the letters
a, b or c and have the extension .c.
.endxmpl
.begxmpl edit *
Edits all files in the current directory.
.endxmpl
.begxmpl edit
Gives a file selection display:
.figure *depth='2.47' *scale='59' *file='vi016' File Selection Display
.endxmpl
.xmplsect end
.alsosee begin
.seethis open
.seethis read
.seethis view
.seethis visual
.alsosee end
.endfunc
.begfunc EGREP
.syntx * EGRep <.regexp>. <.files>.
.begdescr
Searches the file list &parm2 for the regular expression &parm1.
:period.
.np
&parm1 may be surrounded by double quotes (") or a forward slash (/)
if it contains any spaces.
.np
&parm2 may be a single file, a directory, or a list of files. &parm2 may
contain file regular expressions, see the section
:HDREF refid='fmrx'.
in the chapter
:HDREF page=no refid='rxchap'
for more information.
.np
If &parm2 is not specified, it defaults to the setting of
.keyref grepdefault
:period.
If a directory is specified for &parm2, then the files in that directory
are searched, based on the setting of
.keyref grepdefault
:period.
.np
When all matches are found, a selection window is presented with
all the files that contained &parm1.
:period.
.np
If you are not using regular
expressions, the
.keyref fgrep
command is much faster.
For more information on regular expressions, see the chapter
:HDREF refid='rxchap'.
:period.
.enddescr
.xmplsect begin
.begxmpl egrep ((if)|(while)) *.c
Searches all files in the current directory ending in the extension .c
for the regular expression
.param ((if)|(while))
:period.
.endxmpl
.begxmpl egrep [a-z]a+
Searches all files specified by
.keyref grepdefault
for the regular expression
.param [a-z]a+
:period.
.endxmpl
.begxmpl egrep [a-z]a+ ..\c
Searches all files in the directory ..\c specified by
.keyref grepdefault
for the regular expression
.param [a-z]a+
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis fgrep
.alsosee end
.endfunc
.begfunc EVAL
.syntx * EVAL <.expr>.
.begdescr
Evalutes a given mathematical expression, and displays the result on
line 1 of the message window. For a full explanation of the rules
for formulating the expression &parm1, see the chapter
:HDREF refid='scripts'.
:period.
.enddescr
.xmplsect begin
.begxmpl eval 5+7*3
Evaluates
.param 5+7*3
and displays the result (26) in the message window.
.endxmpl
.begxmpl eval (5+7)*3
Evaluates
.param (5+7)*3
and displays the result (36) in the message window.
.endxmpl
.begxmpl eval ((12+3)*100)/50-3
Evaluates
.param ((12+3)*100)/50-3
and displays the result (27) in the message window.
.endxmpl
.xmplsect end
.endfunc
.begfunc EXECUTE
.syntx * EXECUTE <.str>.
.begdescr
Execute the string &parm1.
:period.
This causes the editor to behave as if
the string &parm1 was typed at the keyboard.
.np
Special keys in the string are indicated as follows:
:INCLUDE file='spmapkey'
:cmt. .np
:cmt. See
:cmt. .keyword keypush
:cmt. for delayed execution of keystrokes.
.enddescr
.xmplsect begin
.begxmpl execute dd
Acts as if
.param dd
were typed, and the current line gets deleted.
.endxmpl
.begxmpl execute :eval 5*3\n
Acts as if
.param :eval 5*3<.ENTER>.
was typed, and the number 15 gets displayed in the message window.
.endxmpl
.xmplsect end
.alsosee begin
.seethis keyadd
.seethis map
.seethis mapbase
.alsosee end
.endfunc
.begfunc EXITALL
.syntx * EXITALL
.begdescr
Exits all files. For each file that has been modified, you are prompted
as to whether you want to save the file or not.
.enddescr
.alsosee begin
.seethis quitall
:cmt. .seethis *key=1 CTRL_C
.alsosee end
.endfunc
.begfunc EXPAND
.syntx * EXPAND
.begdescr
Replaces all tabs in the current edit buffer with spaces.
.enddescr
.endfunc
.begfunc FGREP
.syntx * FGRep '"-c"' '"-u"' <.string>. <.files>.
.begdescr
Searches the file list &parm4 for the string &parm3.
:period.
.np
The search is by default case insensitive, unless
.param -c
is specified, which forces the search to be case sensitive.
Specifying
.param -u
causes the setting of
.keyref caseignore 1
to determine whether or not to be case sensitive in the search.
.np
&parm3 may be surrounded by double quotes (") or a forward slash (/)
if it contains any spaces.
.np
&parm4 may be a single file or a list of files. Each file name may
contain file regular expressions, see the section
:HDREF refid='fmrx'.
in the chapter
:HDREF page=no refid='rxchap'
for more information.
.np
If &parm4 is not specified, it defaults to the setting of
.keyref grepdefault
:period.
.np
While searching for the item, &edvi. displays a window that shows
all files being searched.
When all matches are found, a selection window is presented with
all the files that contained &parm4.
:period.
.enddescr
.xmplsect begin
.begxmpl fgrep window *.c
Searches all files in the current directory ending in the extension .c
for the string
.param window
:period.
This will produce out similar to the following:
.figure *depth='2.47' *scale='59' *file='vi023' Grep Result display
.endxmpl
.xmplsect end
.alsosee begin
.seethis egrep
.alsosee end
.endfunc
.begfunc FILES
.syntx * Files
.begdescr
Opens a window with the a list of all files current being edited.
Files that have been modified will have a '*' beside them.
A file may be selected from this list either with the keyboard or
with the mouse.
.enddescr
.xmplsect begin
.begxmpl files
Displays following screen
.figure *depth='2.47' *scale='59' *file='vi017' Current file list
.endxmpl
.xmplsect end
.endfunc
.begfunc FLOATMENU
.syntx * FLOATMENU <.id>. <.slen>. <.x1>. <.y1>.
.begdescr
Activates the floating (popup) menu &parm1 (&parm1 may be 0, 1, 2 or 3).
.np
The floating menus are defined using the &cmdline command
.keyref menu
(See the section
:HDREF refid='menucmd'.
).
.np
&parm3, &parm4 specify the coordinates of the upper left hand corner
of the floating menu. (0,0) specifies the upper left hand corner
of the screen.
.np
&parm2 defines the length of a string that the menu is around; the
floating menu will try to appear around the string (&parm1 may
be 0). This is useful if you wish to pop up a menu around some
selected characters on a line, for example.
.np
If &parm2 is non-zero, then the coordinates
is assumed to be the lower right-hand side of the string that the menu
is popping up around.
.enddescr
.xmplsect begin
.begxmpl float 0 0 10 10
Bring up floating menu 0 at location (10,10) on the screen. There is
no string, so the menu position will simply cycle around (10,10)
in an attempt to position itself.
.endxmpl
.begxmpl float 0 6 50 20
Bring up floating menu 0 at location (50,20) on the screen. This
is assumed to be on the lower right hand side of a string of length 5
(i.e., it is assumed that the string is on line 19 and starts at column
45). If the menu cannot fit by opening at (50,20), it will try to open
at all other corners of the string.
.endxmpl
.xmplsect end
.alsosee begin
.seethis menu
.seethis input
.seethis get
.alsosee end
.endfunc
.begfunc GENCONFIG
.syntx * GENCONFIG <.filename>.
.begdescr
Writes the current editor configuration out to the file &parm1.
:period.
If &parm1 is not specified, then the file name "ed.cfg" is assumed.
.enddescr
.endfunc
.begfunc GLOBAL
.syntx <.line_range>. Global '"!"' /<.regexp>./ <.cmd>.
.begdescr
For each line in the range &range that matches the regular expression
.param <.regexp>.
:cont.,
the editor command &parm3 is executed. &parm3 may contain replacement
expressions, see the chapter
:HDREF refid='rxchap'.
for more information.
.np
If &parm1 is specified, then the command &parm3 is executed on every line
that does NOT match the regular expression
.param <.regexp>.
:period.
.np
If &range is not specified, then the
.keyword global
command operates on the entire line range of the current edit buffer.
.enddescr
.xmplsect begin
.begxmpl g/printf/d
Deletes all lines in the current edit buffer that have the word
.param printf
:period.
.endxmpl
.begxmpl g!/[a-c]123/ d
Deletes all lines in the current edit buffer that DO not match the
regular expression
.param [a-c]123
:period.
.endxmpl
.begxmpl g/(abc)*/ execute Iabc\e
For every line that matches the regular expression
.param (abc)*
:cont.,
execute the keystrokes
.param Iabc<.ESC>.
(this will insert the characters abc at the start of the line).
.endxmpl
.xmplsect end
.alsosee begin
.seethis substitute
.alsosee end
.endfunc
.begfunc HELP
.syntx * HELP <.topic>.
.begdescr
Starts a view-only edit buffer on help for a specified topic. Possible
topics are:
:DL break.
.*
:DT.COMmandline
:DD.All &cmdline commands.
:DT.KEYS
:DD.What different keystrokes do in &cmdmode
:period.
:DT.REGularexpressions
:DD.How to use regular expressions.
:DT.SETtings
:DD.Everything that can be modified with the
.keyref set
&cmdline command.
:DT.SCRipts
:DD.&edvi.
.keyword script
guide.
:DT.STARTing
:DD.How to start the editor: switches, required files.
.*
:eDL.
.enddescr
.xmplsect begin
.begxmpl help com
Gives help on &cmdline commands.
.endxmpl
.begxmpl help
Gives list of help topics.
.endxmpl
.xmplsect end
.endfunc
.begfunc INSERT
.syntx <.line_number>. Insert
.begdescr
Inserts text after a the specified line number &range.
:period.
Insert is terminated when a line with nothing but a '.' is entered.
.exmode
.enddescr
.alsosee begin
.seethis append
.seethis change
.alsosee end
.endfunc
.begfunc JOIN
.syntx <.line_range>. Join
.begdescr
Joins the lines in the specified range &range into a single line
(lines are concatenated one after another).
.enddescr
.xmplsect begin
.begxmpl .,.+2 join
Joins the current line and the next 2 lines into a single line.
.endxmpl
.xmplsect end
:cmt. .alsosee begin
:cmt. .seethis *key=1 J
:cmt. .alsosee end
.endfunc
.begfunc KEYADD
.syntx * KEYAdd <.string>.
.begdescr
Adds a set of keystrokes &parm1 to the key buffer just as if they
were typed by the user. The processing of these keystrokes is deferred
until &edvi. finishes its current processing, and is ready to process
keystrokes again.
This is different than the
.keyref execute
command, which processes the keystrokes immediately.
.np
.keyref Keyadd
is useful in a script,
because it allows keystrokes to be executed after the
script is exited.
This prevents re-entrance of a script that is being executed by a
mapped key in input mode, for example.
.np
Keys are processed in FIFO order. Multiple
.keyref keyadd
commands cause more keys to queue up for processing.
.np
If you need to use one or more special keys (e.g. ENTER, F1, etc) in &parm1,
they may specified as follows:
.np
:INCLUDE file='spmapkey'
.enddescr
.xmplsect begin
.begxmpl keyadd dd
Acts as if
.param dd
were typed, and the current line gets deleted.
.endxmpl
.begxmpl keyadd :eval 5*3\n
Acts as if
.param :eval 5*3<.ENTER>.
was typed, and the number 15 gets displayed in the message window.
.endxmpl
.xmplsect end
.alsosee begin
.seethis execute
.seethis map
.seethis mapbase
.alsosee end
.endfunc
.begfunc LIST
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -