[wellylug] reinstall gone wrong! (vi vs emacs)

Jonathan Harker jharker at massey.ac.nz
Wed Apr 9 09:45:46 NZST 2003


On Tue, 08 Apr 2003 17:13, Rose McGillicuddy wrote:
> I'm rather anxious about vi because I don't know how to get out of
> it.  I tried exit, q, and quit and ended up doing a reboot with
> CtrlAltDel, so hope that has not done anything drastic.  I was
> looking at that file at the time. Thanks

(without wanting to start a vi vs. emacs holy war)

For your situation I wouldn't bother with vi just yet. It is useful to 
know since 1. every flavour of unix has vi, 2. if you lose your 
partitions and only have / mounted, vi will work (unless it has been 
symlinked to /etc/alternatives -> /usr/bin/vim!), 3. the vi command set 
is used in other programs.

Use emacs for a while until you get the hang of things a bit more. To 
edit a file, go

emacs filename

Tutorial - press control h for help, then press t for the tutorial.
Save - press control x then control s
Exit - press control x then control c.
Menus - Press F10. like the menus in a windows program.

so saving and exiting from emacs is

control-x control-s control-x control-c

If you insist on using vi, it is quite arcane for the beginner, and 
there is no onscreen help as you go. To edit a file, go

vi filename

There are two (actually more, but never mind about that) modes for when 
you are typing at the keyboard. In "command mode", pressing keys will 
execute commands. When you enter "edit mode", typing will enter text 
into the file. In vi you start in command mode. You can use these 
commands to get started:

Move the cursor - arrow keys, or the h j k l keys.
Delete characters at the cursor - x
Delete a whole line - dd (that's press d twice)

These commands enter "edit mode":
   Start typing text at the cursor - i
   Start typing at the end of a line - A (that's shift a)
   Insert a blank line and start typing - O (shift o)

Once you are in edit mode, to get back to command mode, press Esc 
(escape key).

To get to the prompt - press : (that's shift ; the colon)

saving and quitting is done at the command prompt, so you have to get to 
the command prompt by typing escape colon

To save the file - w
To quit - q
To quit, even when you haven't saved the file - q!
To save and quit - wq

The prompt is kind of a mini command prompt, so you need to press enter 
after these commands. So, if you're editing away, and you want to save 
and quit, type Esc :wq (enter)
That's these five keystrokes:

escape  colon  w  q  enter

Memorise this sequence until it is an involuntary movement - if you 
choose vi, you'll be doing it an awful lot. After a while you'll find 
that when you go back to Windows, your Word documents all have :wq on 
the end  :-)

HTH
Jon


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/0XFolB/TM
---------------------------------------------------------------------~->

  .-.   Wellington
  /V\   Linux
 // \\  Users       
/(   )\ Group
 ^^-^^
        http://wlug.paradise.net.nz/

To unsubscribe from this group, send an email to:
wellylug-unsubscribe at egroups.com
  

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the wellylug mailing list