📄 vi.doc
字号:
specified, it will convert all DOS '\r\n' end-of-lines to this
convention when reading a file, in addition to recognizing a single
'\n' as an end of line. When writing files, by default Calvin will
write end-of-lines in the DOS manner. A consequence of this is that
Calvin can read a file with Unix<tm> end-of-lines and interpret it
correctly without you even noticing. You can even use Calvin to
convert from Unix<tm> format to DOS format by doing `vi file' and
immediately `:wq'.
You can also convert back to Unix<tm> format by doing:
vi file
:set binary
:wq
This is a little less convenient, but you probably won't have occasion
to use this feature often.
HELPFUL HINTS
In addition to ending insert and last line modes, the Escape key can be
used to delete a partially complete command. It also momentarily
enlarges the cursor. This makes it easier to see--it is easy to lose
the cursor after a locate operation.
To insert an escape code into the file, use control-[ or Alt-27, or
precede it with ^V in insert mode.
One feature that Calvin currently lacks is the ability to change all
occurrences of a given string to another string. This can be done with
alternate uses of the "n" and "." commands (and a little patience).
MEMORY USAGE
By default, Calvin will use all available memory in the lower 640K to
store the file being edited and yanked text, etc. You can also get
Calvin to use disk space as well, by means of the `:set directory'
option described below. In either case, however, it is always a
possibility that you will run out of memory. In that case, you will
receive the message `Out of memory--save what you have, immediately.'
It is strongly suggested that you do so, as the editor will be in an
unstable state; continuing to use it after such a message would likely
result in loss of data.
THE NAME
As noted already, Calvin has formerly been called "Free VI." Since the
appearance of Stevie and Elvis, I decided that a more unique name was
necessary. Hence the name "Calvin", which has the requisite two-letter
substring, as well as the string "Cal", indicating that it came from
"Cal" (University of California), Berkeley. (And also, it's seven
years old :-> ).
------------------------------------------------------------
The above is a tutorial introduction to some of the most common Calvin
commands. A list of all Calvin commands appears in the command summary, below.
COMMAND SUMMARY
------- -------
Colon commands:
:edit name edit new file
:edit +<n> name edit new file, starting at line <n>
:edit +/pattern name edit new file, starting at the first occurrence
of the given string.
:edit! [+colon_command] name
discard corrections and edit new file
:edit[!] [+colon_command] # edit the file last edited.
:file print file name, status, and length.
:file name change the name of the file being edited to
`name'.
:next edit the next file in the command line
:quit quit the editor
:quit abort (quit without saving corrections)
:read file read the given file and insert it after the
current line
:<n>read file read the given file and insert it after line
<n>.
:r synonym for :read
:r !command read in the output of the given DOS command
:rewind return to editing the first file given on the
vi command line (cf. :next)
:set option=value set the given option to the given value
the `=' may be replaced by a space (useful in
EXINIT).
:set option set the given boolean option to TRUE
:set nooption set the given boolena option to FALSE
:set option? print the current value of the option
:set all print the values of all options
:set print the values of all options which are not
equal to their defaults
:shell escape to DOS (return via EXIT)
:version print Calvin's version number. Currently the
message printed is: "Calvin version 2.1. (C)
Copyright 1987, 1988, 1989, 1990, 1992 by Paul
Vojta. For copying conditions, please see the
documentation file."
:wq [file] synonym for :write followed by :quit
:write write the current file to disk, using the name
it was edited using
:write file write the current file to disk, using the name
given
:write !command pipe the current file into the given DOS
command; note the spacing.
:<n>,<m>write [file] write lines <n> through <m> to disk
:w synonym for :write
:x synonym for :wq (if the current file has been
changed), or :quit (if not)
:<n>= print the value of <n>
:<n> move to line <n>
:!command execute the given DOS command
:!! execute the last DOS command
Command names (and :set options, below) may be abbreviated by shortening them,
provided they still refer to a unique command. They may be combined on one
line by separating them by `|'.
Addresses (written as <n> or <m> in the above list) may be given by one of the
following:
<line number>
/pattern/
?pattern?
'a, ..., 'z
. (refers to the current line number)
$ (refers to the end of the file)
You may also use the following synonyms in visual mode:
ZZ :x
^6 :e #
^G :f
Options for the :set command:
autowrite (synonym aw) (default false)
If the file has been modified, then automatically write it to
disk for any :edit, :quit, :rewind, or :next commands.
binary (default false)
Read and write files in binary mode (that is, without end-of-
line conversions). See the section END-OF-LINE CONVERSIONS.
cpmeof (default false)
Under early versions of DOS, text files were supposed to end in
^Z (Control-Z). This option causes Calvin to write a ^Z at the
ends of files that it creates.
directory (default none)
Directory to use for storing temporary files. This option may
only be changed once.
dosesc (default false)
Causes the Escape key to act as a line delete character instead
of as the character which ends insert mode. (You can always
leave insert mode by using the End key.) The usual line delete
character is ^U (Control-U).
eolateof (default true)
Indicates that the file being edit ends with an end-of-line
character. Usually this is the case. This flag is
automatically set or cleared when editing a file, and is
automatically cleared when doing a line change command at the
end of a file.
ignorecase (synonym ic) (default false)
Causes Calvin to ignore the case of letters when searching for
strings.
marginbell (synonym mb) (default 0, none)
Causes Calvin to beep when you reach the indicated column in
insert mode.
printable (default 126)
Gives the highest character value to be printed as is, instead
of being translated into, e.g., \127.
showmode (default false)
Causes Calvin to show its mode (e.g., INSERT MODE) in the lower
right-hand corner of the screen.
tabstop (default 8)
Indicates the number of characters per tab stop.
thoroughshell (default False)
Instructs calvin to use the COMSPEC variable to load the
command interpreter when running every DOS command, not just
the internal ones. This is useful if you use a different
command interpreter, such as 4dos, which has a different set of
internal commands or other features which you wish to use.
vidcompat (default 0)
Indicates the compatibility lever for video operations.
Setting it to a higher value may cause some screen-related
problems to go away if you have slightly non-standard hardware.
With vidcompat=1, Calvin does not use the alternate screen
feature of CGA adapters, and with vidcompat=2, it does not save
and restore the screen after editing.
Character motions:
h or Backspace or Leftarrow back <n> character(s)
Space or l or Rightarrow forward <n> characters
j or ^J or ^N or Downarrow down <n> lines, same column
k or ^P or Uparrow up <n> lines, same column
$ down <n-1> lines, end of line
0 beginning of line
^ first non-white character in line
w next <n> words
b back <n> words
e end of <n>th word from here
W, B, E same as w, b, e, with blank-delimited words
| move to column <n>
% match (), [], or {}.
`x character of mx command (x=any lower case letter)
`` start of last /?nNGHML%' or ` motion
/string search
?string backwards search
/<cr> or ?<cr> forward or backwards search, same pattern
/string/+3 the third line past the next occurrence of the given string
n repeat last search
N repeat last search, opposite direction
fx find next <n>th occurrence of x
Fx find previous <n>th x
tx next <n>th x (not inclusive)
Tx previous <n>th x (not inclusive)
; repeat last f, F, t, or T
, reverse of ,
Line motions:
+ or <cr> <n>th next line (first nonwhite)
- <n>th previous line
current line or <n-1>st next line
H or Home top of screen (or <n>th line on screen)
M middle of screen
L or End last line of screen (or <n>th line from bottom)
nG go to <n>th line (end default)
'x line of mx command (x=any lower case letter)
'' start of last /?nNGHML%' or ` motion
Operators:
d<motion>, dd, D delete
c<motion>, cc, C change
y<motion>, yy, Y yank
(Note that in this implementation 'Y' is equivalent to
'y$' instead of 'yy').
!<motion>, !! filter through a DOS command
Insert Mode:
i or Insert insert before current character
a insert after current character
I insert before first nonblank character in line
A append to end of line
o open after current line
O open before current line
Other modification commands:
x or Delete delete character; same as "d "
X delete previous character; same as "dh"
s delete character and enter insert mode; same as "c "
S delete line and enter insert mode; same as "cc"
r replace <n> characters by the given one
J join two lines
p put yanked text
P put yanked text before current line or character
u undo previous command
. repeat previous command
Screen commands:
^L redraw screen
^F or PgDn forward <n> screens
^B or PgUp back <n> screens
^U, ^D up (or down) 1/2 screen (<n> changes the number of lines
counted as 1/2 screen)
^Y, ^E up (or down) <n> lines
z<cr> or zh redraw with current line (or <n>th line) on top
z. or zm redraw with current line (or <n>th line) in middle
z- or zl redraw with current line (or <n>th line) at bottom
z+ redraw with current bottom line (or <n>th line) at top
Miscellaneous:
mx mark here as mark `x' (Cf. 'x and `x above.)
(x = any lower case letter)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -