Command | BVI | VI |
File Commands |
:w
:w %.new
:w filename
:w>> existingfile
:w! file
:e newfile
:e!
:f
:f newname
|
Write to the current file
Write to current.new
Write to filename
Append to existing file
Overwrite existing file
Terminate session and edit newfile
Reload the current file
Prints current filename and some additional info
Changes the current filename to newname
|
|
Substitute Commands |
:s/pattern/replace/
:s/pattern/replace/g
:s/pattern/replace/gc |
Search for pattern and replace it once
Search for pattern and replace it global
Search for pattern and replace it global conditional (ask)
|
|
:s\80 af\ff ff\ |
Binary search and replace
|
| Not available |
Edit Commands |
:a m
:c m
:i m |
append
change
insert
bytes, where m is a(scii), b(inary), d(ecimal), h(exadecimal)
or o(ctal). You can type in several (screen) lines of bytes, a line
with only a '.' in it terminates the command.
|
|
Usually not available in vi but in ex (without the m - modifier).
|
Logical Operations |
:and n
:or n
:xor n
:neg
:not
:sl i
:sr i
:rr i
:rl i |
and n
or n
exclusive or n
negate
invert
shift left i bits
shift right i bits
rotate left i bits
rotate right i bits
|
|
Not available.
|
Miscellaneous |
:g/pat/p
:n
:q
:rew
:sh
:so file
:ve
:x
:! command
|
Global search for pattern pat
Next file to edit
Exit session without saving the file
Rewind to first file
spawn a new shell
Read and execute a file with colon commands
Version of the editor
Exit session, save the file if changed
execute a system command
|
|
|
:map
:unm(ap)
:ab(breviate)
:una(bbreviate)
|
|