Kamis, 24 Januari 2008

Quick Reference to vi Editor

Andrew Bedno Resumé Samples References

Quick Reference to vi Editor

vi is the standard editor shipped with Unix systems, and used by system administrators and others world wide. Its commands however are cryptic, due in part to its ancient origin on dumb terminals. This document lists most of the basic necessary vi commands. For the whole story, use man vi.

escape   Terminates insert, append, change modes.
: Drops to bottom line command prompt.

i Begin inserting at cursor.
A Begin appending at end of line.
x Delete character at cursor.
D Delete to end of line.
dd Delete current line.
cw Change word, press escape when done.
. Repeat most recent change or deletion.
dw Delete word.
u Undo most recent deletion no change.

Ctrl-G Show the current line number, and other info.
Ctrl-F Move down one screen.
Ctrl-U Move up one screen.
0 Move cursor to beginning of line.
$ Move cursor to end of line.
w Move cursor forward one word.
b Move cursor back one word.

:number Jump to specified line number.
:+number Jump forward number lines.
:-number Jump backwards number lines.
:$ Jump to end of file.

/text Search forward for .
?text Search backwards for .
n Repeat most recent search.
:set ignorecase Ignore upper/lower case when searching.

:!command Execute a Unix shell command.
:!sh Runs a subshell, "exit" returns to vi session.

:1,.d Delete from beginning of file to current line.
:.,$d Delete from current line to end of file.
:.,+3d Delete current line and next three lines.
:n1,n2d Delete from line to line .
:n1,n2w name Write a block of lines to another file.

:e name Change to editing a different file.
:r name Read a file into the current file at current line.
:w Save file.
:w name Save file to another name.
:w! Save, even if set for read only or already exists.
:q! Quit, discarding any changes.
ZZ Exit and save.


taken from http://bedno.com/andrew/resume/samples/t-vi.htm

Tidak ada komentar: