Notes - UNIX I

Wednesday, June 10, 1998
VI CONTINUED

Previous Day's Notes | Back to main page | Next Day's Notes

File-matching metacharacters and metasequences.
216-220, 426 Primer
*
Matches any grouping of 0 or more characters.
?
Matches any one character.
[ab]
Pattern-matching sequence.

Any time you delete a line in vi, it sends that line to an anonymous buffer. (yy yanks it into the anonymous buffer and p puts it back.) Yp works, also. The anonymous buffer is invisible to the user.

yy - yank (copy into anon buffer)
y - yank (same as above) p - put last buffered text after cursor
P - put last buffered text before cursor
dd - delete line (moves text into anon buffer)

Cursor movement (must be in command mode):

vi commands
h -left
j -down
k -up
l -right
8j -Moves 8 down.
12h -Moves 12 to the left.
- (dash) -Moves one line up.
[RETURN] -One line down.
G -To beginning of last line.
1G -To beginning of line 1.
#G -To beginning of #th line.
$ -To the end of the line.
H -Head of window.
M -Middle of window.
L -Last of window.
^ -To first nonwhitespace character of line.
0 -To the 0 column of the line (absolute beginning).
w -To 1st character of next word.
W -To beggining of next word, skipping punctuation.
b -To beginning of previous word.
B -To beginning of previous word, skipping punctuation.
e -To end of next word.
E -To end of next word, skipping punctuation.
[CTRL-d] -Scrolls down 1/2 screen.
[CTRL-u] -Scrolls up 1/2 screen.
[CTRL-f] -Scrolls down 1 screen.
[CTRL-b] -Scrolls up 1 screen.
x -Delete character that cursor is on.
X -Delete from character that cursor is on to the beginning of the line.
dd -Delete entire line that cursor is on.
D -Delete character the cursor is on and the rest of the line after.
dw -Delete word cursor is on.
3dw -Delete next 3 words, starting where the cursor is.
db -Delete word to right of character cursor is on.

Searching in vi:
/word
Finds 1st occurrence of word.
/[ENTER]
Repeat of last search command. (In this case, would find the next occurence of word.)
/word
/[ENTER]
Finds the 1st occurrence of word searching backwards.
:s/latinum/mms/

Previous Day's Notes | Back to main page | Next Day's Notes

Last updated: Monday, June 22, 1998 at 4:58 AM