Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 22:05:08 +0100
From:      Cliff Sarginson <csfbsd@raggedclown.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: vi question
Message-ID:  <20020307210508.GB484@raggedclown.net>
In-Reply-To: <E16j4bb-0001cW-00@gull.prod.itd.earthlink.net>
References:  <OE136NoNBpsiLEMv9TL00016cbd@hotmail.com> <E16j4bb-0001cW-00@gull.prod.itd.earthlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 07, 2002 at 02:34:51PM -0600, Bob Giesen wrote:
> On Thursday 07 March 2002 01:11 pm, Seth Hieronymus wrote:
> > Is there any way to stop vi from going back into command mode when
> > I arrow over to the first column (while in insert mode)?
> 
>    I don't think so.  You could use Vim, instead; this seems to work 
> as you'd like it to.
>    More to the point is that you're using arrow keys in vi, which is 
> optimized for fast typing (little wasted motion and little need for 
> Ctrl- or Alt-key combinations).  Personally, I find it faster to just 
> switch between command and insert modes and use the h,j,k, and l keys 
> instead of the arrow keys...  Ymmv, of course, but you might want to 
> give it a chance, if you haven't already.
> 
Mmm, this is one of the mysteries of vi.
The arrow keys *may* work, they do for me, on most of the computers
I use. It depends on terminal type, terminal emulation, and the 
position of the stars.

But on some systems, they exhibit the behaviour you mention.

This has to do with the <esc> character.
The <esc> brings you back to command mode as you know.
<esc> is also the "lead-in" character for "escape-sequences"
the left arrow for example is:
^[[D

^[ = <esc>.

Now vi should wait a little while to see if <esc> is just <esc> or
whether it is a lead in to an escape sequence..which of course happens
very fast, so the wait only has to be very short. However sometimes vi
just does not seem to wait long enough.

Because of this oddity most "vi veterans" use the keyboard movement keys
and just switch mode as a matter of habit...because this will always
work.

As mentioned above I don't think other vi clones suffer from this
abberation, try them (vim or nvi).

You see "vi" is not a screen editor, it is a front end into a
line-editor; this upsets people used to "real" screen editors.

-- 
Regards
   Cliff Sarginson -- <csfbsd@raggedclown.net>

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020307210508.GB484>