Re: Help w/ vi command mode
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 03/26/04
- Next message: Ed Morton: "Re: Help w/ vi command mode"
- Previous message: Paul Roseboom: "Help w/ vi command mode"
- In reply to: Paul Roseboom: "Help w/ vi command mode"
- Next in thread: Charlie Gibbs: "Re: Help w/ vi command mode"
- Reply: Charlie Gibbs: "Re: Help w/ vi command mode"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Mar 2004 20:59:27 GMT
On Fri, 26 Mar 2004 15:05:11 -0500, Paul Roseboom <proseboom@uscd.com> wrote:
>
>
> I've been using emacs for a while, and am just trying vi but finding
> it very hard to use. I've read some good online resources, but have a
> couple basic questions.
>
> Is "command mode" what I enter if I type "Q", represented by the : at
> the bottom? Or is command mode what I'm in when I start vi? When I
> enter ZZ after it starts, it exits right away as I expect, but if I
> enter ZZ from the : prompt I get "not an editor command".
>
> And a simple question.. if for example I want to cut lines 10-12 out
> of my program and paste them after line 30 do I use 'y' and 'p'?
>
> Thanks very much!
>
Depending on which vi you are using, putting
set showmode
in a file called ~/.exrc will give you an indicator of which mode you are in
at the lower right hand corner.
When you open a file you will be in command mode.
If you enter ":" while in command mode, you will enter ex mode.
While in command mode you can switch to insert mode with "i" (insert before the present line)
or "a" (append after the present line). To get back to command mode hit "Esc" or "Ctrl-[".
There should be a tutorial on your box. Check in /usr/share/doc/. Or google for it.
comp.editors is basically a vi/nvi/elvis/vim group.
:wq
will write and close the file.
As for cutting and pasting, there are a number of different ways to do this, depending on
which vi you are using.
For a number of consecutive lines, 2 in this case:
Put the cursor on the first line and, in command mode, do "2dd", then move to where you want
to paste the text and hit "p".
But you REALLY need to get one of the tutorials and work with it. In 20 minutes you will be
competent for normal editing and at least able to understand most of the answers to your
questions.
AC
- Next message: Ed Morton: "Re: Help w/ vi command mode"
- Previous message: Paul Roseboom: "Help w/ vi command mode"
- In reply to: Paul Roseboom: "Help w/ vi command mode"
- Next in thread: Charlie Gibbs: "Re: Help w/ vi command mode"
- Reply: Charlie Gibbs: "Re: Help w/ vi command mode"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]