|
|
|
|
|
-Current Notification
To receive notification of changes to the
Slackware -Current ChangeLog via email, send an
email to "mrgoblin@userlocal.com" with the subject
"subscribe slacklog" and your email address in the
body of the message.
|
|
|
|
|
|
Back to
Main Page
Go to Slackware Forums
|
Basic VI Commands
Author: Douglas (Doug) Palovick
Homepage:
Palovick.com
email: doug@palovick.com
What is VI and is it for you?
VI is an extremely powerful text editor (not to be confused
with a word processor). Here you will find basic VI commands
for use within the VI, or vim, editor. If
you are a newbie and would prefer a simple alternative to vi you
may want to check out pico, which comes packaged with pine (pine is a user friendly
console email client).
Ok, now onto some VI basics..
Opening a file/starting vi
- To start vi, all you need to do is type "vi" (minus the
quotes, always minus the quotes from here on through)
- Lets say I wanted to open a file named foo.txt that resides in
the same directory I am currently in. I would type "vi foo.txt"
- Now lets say i wanted to open inetd.conf which lives in the
/etc directory. I would type "vi /etc/inetd.conf". The directory
path to inetd.conf is always the same, no matter what directory you are
in.
Quitting VI
- First lets make sure you are in what is called "command
mode". We do this by pressing the Esc key.
- Now we press " : ". You should see a little prompt at the
bottom of your page. Now press "q" and hit enter.
- If it will not let you quit, it is because you have made some
changes to the file and you must press ":", then "q!", then enter
to force vi to quit (warning, this will disregard any changes you
have currently made).
- If you would like to save the changes you have made within
you vi session press ":", then "wq", now press enter. If vi ever complains that you're trying to make changes to a read-only file, try "w!" or "wq!".
- If you ever have any problems with doing this or other
"command mode" commands hit the Esc key once or twice to make sure
you are in command mode and try again.
Basic command mode commands for inserting text
- First make sure you are in command mode by pressing
the Esc key and then make sure you press ":" before you try any
of the commands bellow. Please note that after you enter one of these
commands in command mode you will be put into insert
mode, which will enable you to enter new text into the file.
In order to get back to command mode you will have to
press the Esc key again.
- c
- Add changes to file. This is a commonly used
command for editing a file with vi. When this option is invoked,
you rewrite over the text you want to change by backing up over it
using the del key. Simply re-type over the text you have
backed up over. When you use the left arrow key to back up over
text you can not rewrite over the text you backed up over,
but just insert new text at the point where you stopped backing
up. Make sense? If not, no worries, you'll catch on.
- a
- Append text after the cursor.
- A
- Append text at the end of the line.
- d
- delete text
- i
- Insert text before the cursor.
- I
- Insert text at the beginning of the line.
- R
- Allows you to overwrite over text.
More to come.
|
|
|
|
|