Electric Type

Multimedia

About Us

News

Help

Introduction to vi

Page 3 — Moving Around

You've got the file, now how do you edit it? Look a little more closely: The command prompt is probably highlighting the first character of the file. I'm going to move it down to "friend." Here's what it looks like again:


<HTML>

<HEAD><TITLE>vi is fun!</TITLE>

</HEAD>



<BODY bgcolor="#FFFFFF" text="#0000CC" link="#CC0000" vlink="#000000">

This is a list of the crucial keys in vi. 

Remember: the escape key is your friend.

O means to go into insert tect mode one character to the right

r means to replace something

x means to delete something

x means to delete something

E means to revert to the last saved version

I means to insert text. This is what we use to begin typing

these four keys are used in edit mode: h j k l

w means to overwrite the last version

q means to quit without changing anything

</BODY>

</HTML>



"commands.html" 18 lines, 295 characters

You can move a vi prompt one of two ways: Use the arrow keys or use four letter keys in the keyboard. I recommend learning how to use the letter keys: It's faster, and it doesn't rely on a "properly" set terminal like the arrow keys do. So, using the arrow keys, we can move the cursor in four different directions:

to move down: press j
to move up: press k
to move to the left: press h
to move to the right: press l

You will have to tap each key for the number of lines or characters you want the cursor to move. In this case, I want to move down seven lines and then to the right. So I would hit j seven times, and hold down the l key until I got to the word "friend."

Not every file you're going to work in will be so small; some will be a couple hundred lines long. If you look at the last line of our file, you'll see that the editor tells you how many lines there are in the file. If you want to jump down, you can type : (line number), where the line number is the actual numeral. So if I wanted to jump down to line 16 (the line beginning with "q"), I'd type:

: 16

hit Enter, and there I'd be.

next page»


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.