[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

VI Help

Hi all
Well I've been sitting here reading about all the vi controversy and I
see there are a whole lot of you out there who are  utterly lost once
you have typed vi at the console.
I see this as not so much a shortcoming in the program itself but a lack
of help/docs/support or whatever you'd like to call it.
Jean makes a valid point when he says Linux people are not in a
structured learning environment (as a UNIX person would most likely be)
and therefore have to teach themselves.
So maybe a few well placed /written scripts would help in this
So when a user types vi it pops up a command list first and an option to
print ( hehe this makes the assumption that their printer works :)  and
an option menu
e.g.: For vi
hit C to continue vi
hit N to stop this help from appearing next time vi starts
hit ESC to quit vi

And for those of you who want to play with vi ( and it is something I
would highly recommend ) here are some commands for you to play with
vi                        will open an empty buffer with no name
 vi newfile.file   will open a  file of that name  or create and open a
new file  if that does not exist

First and most important is to understand vi has 3 modes
1/ Command mode (default)
2/ Input mode
3/ Colon command mode

you can move around with your arrow keys
to enter text type i
this puts you into input mode
hit ESC to return to command mode
anything you type while in input mode will appear on the screen until
you hit ESC
then you may enter Command mode commands
Such as
x      deletes the character under the cursor
dd    deletes the current line
o       will open a new line below the current one in "input mode"
r       will let you replace a single character
R       lets you replace or over-write as you go
u      undo last command

remember you have to enter "input mode"  before you can delete text with
backspace etc.

now the part that confuses most .....
ESC from input mode
and type a colon      :
this will put you into Colon command mode and a : will appear on the
last line
First thing most people want to  know is how to quit
so when you have the : you can enter any of the following commands (
don't type the : as it is already there )
:wq    saves and quits
:q!       quits without saving

:w  filename   will save the buffer to the named file ( a bit like "save
as" )
:r    filename    will insert the named file into the current file after
the current line

there are many more commands but I just want to give you the basics here

I don't disagree that it is a little confusing at first but once learned
I think vi is a very handy and flexible editor but this will give users
out there the chance to decide for themselves whether vi is for them or
Or at the very least let them escape from the black magic hole that is
vi if they stumble in by mistake :)

Keep up the good work

P.S  Hey Jean ===>All Blacks  34  South Africa 18 ........  Yahoo again