Download ZagNet User`s Manual 1999-2000

Transcript
WARNING: UNIX does not maintain multiple versions of a file like VAX systems do. Unless
you specifically write to a different file, you are modifying the original file. Once the changes
have been written to the file, there is no way to recover the previous contents of the file.
VI COMMAND QUICK REFERENCE
vi
vi file
Running vi
Runs vi and starts a new file
Runs vi and opens file
^B
^F
^U
^D
^Y
^E
Scrolling
Scroll backward one screen
Scroll forward one screen
Scroll backward a half screen
Scroll forward a half screen
Scroll backward one line
Scroll forward one line
W
B
(
)
{
}
Context Movement
Move forward to beginning of a word
Move backward to beginning of a word
Move to the beginning of a sentence
Move to the end of a sentence
Move to beginning of prev paragraph
Move to beginning of next paragraph
i
a
I
A
O
o
ESC
Inserting Text*
Insert before current character
Insert after current character
Insert at beginning of current line
Append to end of current line
Insert new line above current line
Insert new line below current
Return to command mode
x
X
dw
db
dd
:n,md
D
Deleting Text
Delete current character(s)
Delete previous character(s)
Delete current word(s)
Delete previous word(s)
Delete line(s)
Delete lines n through m
Delete from cursor to end of line
Writing Files
:wq
Write to current file and quit
:w
Write to current file without quitting
:w file Write to new file without quitting
:w!
Write to file, ignoring read-only status
Getting More Help
man vi Displays the man page for vi editor
man ex Displays the man page for ex (line oriented editor)
h
j
k
spc
^
+
$
0
G
Line/Character Movement
Move backward one character
Move down one line in same column
Move up one line in the same column
Move one right one character
Move to first real character in previous line
Move to first real character in current line
Move to first real character in the next line
Move to the end of the current line
Move to the first character of the current line
Goto line number (if # entered) or end of file
/
?
Movement by Search
Search forward for text following ‘/’
Search backward for text following ‘?’
r char
R text ESC
s text ESC
S text ESC
cw text ESC
C text ESC
J
Changing Text
Replace current character with character
Replace current character(s) with text
Substitute current character with text
Substitute entire line with text
Change current word to text
Change rest of current line to text
Join next line(s) to end of current line
nyy
p
P
Copying and Placing Text
Yank (cut) n lines and place in buffer
Put yanked text after cursor
Put yanked text before cursor
u
U
Undo
Undo last command
Restore current line to original state
:q
:q!
:e!
Quitting and Resetting vi
Quit (must save first)
Quit without saving changes
Re-edit current file, discarding unsaved changes
*Inserting commands will remain in insert mode until the ESC key is pressed.
Page 36
Text Editors on Barney (pico, vi, emacs)