home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
util
/
edit
/
vim
/
doc
/
difference.doc
< prev
next >
Wrap
Text File
|
1994-08-09
|
21KB
|
493 lines
This is a summary of the differences between VIM and vi. It is not complete.
see also reference.doc and look for comments in {}.
The most interesting additions:
Vi compatibility.
When the 'compatible' option is set, all options are given a vi-compatible
value. Vim will behave like the "real" vi as much as possible.
Multi level undo.
'u' goes backward in time, 'ctrl-R' goes forward again. Set option
'undolines' to the number of changes to be remembered (default 100). Set
'undolines' to 0 for vi-compatible one level undo.
When all changes in a buffer have been undone, the buffer is not considered
changed anymore. You can exit it with :q, without <!>.
Multiple windows and buffers.
Vim can split the screen into several windows, each editing a different
buffer or the same buffer at a different location. Buffers can still be
loaded (and changed) but not displayed in a window. This is called a hidden
buffer. Many commands and options have been added for this facility, see
windows.doc.
Repeat a series of commands.
'q'<c> starts recording typed characters into named register <c> (append to
the register if register name is upper case). A subsequent 'q' stops
recording. The register can then be executed with the '@'<c> command. This is
very useful to repeat a complex action.
Flexible insert mode.
The arrow keys can be used in insert mode to move around in the file. This
breaks the insert in two parts as far as undo and redo is concerned.
CTRL-O can be used to execute a single command-mode command. This is almost
the same as hitting ESC, typing the command and hitting 'a'. For undo/redo
only those inserts are remembered where something was actually inserted.
Visual mode.
Visual can be used to first choose a piece of text and then give a command
to do something with it. This is an (easy to use) alternative to first giving
the operator and then moving to the end of the text to be operated upon. 'v'
and 'V' are used to start Visual mode. 'v' works on characters and 'V' on
lines. Move the cursor to extend the Visual part. It is shown highlighted on
the screen. By typing 'o' the other end of the Visual text can be moved. The
Visual text can be affected by an operator:
d delete
c change
y yank
> or < insert or delete indent
! filter through external program
= filter through indent
: start ":" command for the Visual lines.
Q format text to 'textwidth' columns
J join lines
~ swap case
u make lowercase
U make uppercase
Block operators.
With Visual a rectangular block of text can be selected. Start Visual with
CTRL-V. The block can be deleted ('d'), yanked ('y') or its case can be
changed ('~', 'u' and 'U'). A deleted or yanked block can be put into the
text with the 'p' and 'P' commands.
Online help.
':help' command and help key (F1 for MSDOS) display several pages of concise
help. The name of the help file can be set with the "helpfile" option.
Command line editing.
You can insert or delete at any place in the command line using the cursor
keys. The right/left cursor keys can be used to move forward/backward one
character. The shifted right/left cursor keys can be used to move
forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end
of the command line.
The command lines are remembered. The up/down cursor keys can be used to
recall previous command lines. The 'history' option can be set to the number
of lines that will be remembered.
Command line completion.
While entering a command line (on the bottom line of the screen) <TAB> can be
typed to complete
what example where
- a command :e<TAB> at start of command line
- a tag :ta no<TAB> after :ta
- an option :set sc<TAB> after :set
- a filename :e v<TAB> after any command that accepts a filename
If there are multiple matches, CTRL-N (next) and CTRL-P (previous) will walk
through the matches. <TAB> works line CTRL-N, but wraps around to the first
match.
The 'wildchar' option can be set to the character for command line
completion, <TAB> is the default. CTRL-D can be typed after an (incomplete)
wildcard; all matches will be listed. CTRL-A will insert all matches.
CTRL-L will insert the longest common part of the matches.
Horizontal scrolling.
If the 'wrap' option is off, long lines will not wrap and only part of them
will be shown. When the cursor is moved to a part that is not shown, the
screen will scroll horizontally. The minimal number of columns to scroll can
be set with the 'sidescroll' option.
Text formatting.
The 'textwidth' (tw) option can be used to automatically limit the line
length. This supplements the 'wrapmargin' option of Vi, which was not very
useful. The 'Q' operator can be used to format a piece of text ("Q}" formats
a paragraph). Commands for text alignment: ":center", ":left" and ":right".
Edit-compile-edit speedup.
The ":make" command can be used to run the compilation and jump to the first
error. Alternatively Vim can be started with the "-e" option from the
compiler. A file with compiler error messages is interpreted. Each line in
the error file is scanned for the name of a file, line number and error
message. Vim starts editing at the first error. Optionally the name of the
error file can be given with "-e errorfile". The ":cn" command can be used to
jump to the next error. ":cl" lists all the error messages. Other commands
are available (almost the same as with Manx's Z editor). The 'errorfile'
option has the name of the file with error messages. The 'errorformat' option
can be set to a scanf-like string to handle output from many compilers. The
'makeprg' option contains the name of the program to be executed with the
":make" command. The 'shellpipe' option contains the string to be used to put
the output of the compiler into the errorfile.
Command line options:
When Vim is started with "-v" (View) then readonly mode is used (includes
"-n").
When Vim is started with "-b" (Binary) then some options are set to be able
to edit binary or executable files.
When Vim is started with "-s scriptfile", the characters read from
"scriptfile" are treated as if you typed them. If end of file is reached
before the editor exits, further characters are read from the console.
The "-w" option can be used to record all typed characters in a script file.
This file can then be used to redo the editing, possibly on another file or
after changing some commands in the script file.
The "-n" option disables the writing of a ".swp" file (see below).
The "-c command" option does the same as the the "+command" option.
The "-T terminal" option sets the terminal type.
The "-e" option starts Vim in quickfix mode.
The "-o" option opens a window for each argument. "-o4" opens four windows.
In command mode:
Missing command: 'Q' (go to Ex mode).
Missing Ex commands: append, change, insert, open, recover and z.
The command characters are shown in the last line of the screen. They are
removed when the command is finished. If you do not want this (on a slow
terminal) reset the 'showcmd' option.
If the 'ruler' option is set, the current cursor position is shown in the
last line of the screen.
'u' and CTRL-R accept a count for the number of undos/redos.
'U' still works after having moved off of the last changed line and after
'u'.
Nulls in the file are replaced by <LF> internally. This allows editing of
binary files (more or less).
Characters with the 8th bit set are displayed. The characters between '~' and
0xa0 are displayed as "~?", "~@", "~A", etc., unless the "graphic' option is
set.
'=' is an operator to filter lines through an external command (vi: lisp
stuff). The name of the command can be set with the 'equalprg' option. The
default is "indent".
'][' goes to the next ending of a C function ('}' in column 1).
'[]' goes to the previous ending of a C function ('}' in column 1).
']f', '[f' and 'gf' start editing the file whose name is under the cursor.
CTRL-W f splits the window and starts editint the file whose name is under
the cursor.
'*' searches forward for the identifier under the cursor, '#' backward.
'K' runs the program defined by the "keywordprg" option, with the identifier
under t