Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vi in Apple Terminal question

1 view
Skip to first unread message

g

unread,
Feb 12, 2004, 4:10:59 AM2/12/04
to

I am used to using vi on sun machines. Normally, while in insert mode,
if I hit an arrow key the first kit is taken as <Esc> and then the
second actually does the arrow movement. I'm used to this. I like
this. On the sum if $TERM is set to dtterm, this works. (If it is not
it inserts a new line with just an A, B, C or D on it.)

On my powerbook, running 10.2.8, when I run vi it acts differently and
I'd like it the other way. On my mac, when in insert mode and I strike
an arrow key, it does the arrow key movement ans stays in insert mode.
I don't like this.

I have tried many settings and tried mapping keys; both a horrible
failure probably because I don't really know what I'm doing. (don't tell
anyone)

Does anyone know what I'm talking about?
Does anyone know how to adjust it the way I'd like it?

TIA

G

Robert Goulding

unread,
Feb 12, 2004, 12:10:15 PM2/12/04
to
g <m...@here.ch> wrote in message news:<402b42e2$1...@nntp.unige.ch>...

> I am used to using vi on sun machines. Normally, while in insert mode,
> if I hit an arrow key the first kit is taken as <Esc> and then the
> second actually does the arrow movement. I'm used to this. I like
> this. On the sum if $TERM is set to dtterm, this works. (If it is not
> it inserts a new line with just an A, B, C or D on it.)
>
> On my powerbook, running 10.2.8, when I run vi it acts differently and
> I'd like it the other way. On my mac, when in insert mode and I strike
> an arrow key, it does the arrow key movement ans stays in insert mode.
> I don't like this.
>
> I have tried many settings and tried mapping keys; both a horrible
> failure probably because I don't really know what I'm doing. (don't tell
> anyone)
>

If you're using vim, this is as simple as

imap <Up> <Esc>k

and so on for Down, Left and Right (if I've understood you correctly).

R.

g

unread,
Feb 13, 2004, 4:02:50 AM2/13/04
to

You have, sort of. I am using standard vi, not vim. Not yet. I was
having trouble mapping. It wasn't until late yesterday that I read that
you press <Ctrl-V><Arrow> to get the ^[[A and <Ctrl-V><Esc> to get ^[.

The default mappings are... and you can see that the arrow keys are
mapped to <Esc>"Direction"<Append>. I'll just put a couple of
:map! ^[[A ^[k
in my .exrc as well as some others that seem promising. Thanks.

I don't want to get a big argument started here, but, in brief, why
would I want to use vim instead of vi?

Thanks again.
g

Default...
:map
^[[2~ i insert at cursor
^[[3~ x delete character
^[[5~ ^B page up
^[[6~ ^F page down
^[[A k cursor up
^[[B j cursor down
^[[C l cursor right
^[[D h cursor left
:map!
^[[A ^[ka cursor up
^[[B ^[ja cursor down
^[[C ^[la cursor right
^[[D ^[ha cursor left

Sven Guckes

unread,
Feb 13, 2004, 4:53:00 PM2/13/04
to
* g <m...@here.ch> [2004-02-13]:

> why would I want to use vim instead of vi?

for the same reasons you switch
from a beetle to a limousine.

but anyone who cannot afford a name probably
won't be able to buy anything, anyway.

then again, vim is free..

Sven

--
$ vim -c ":help vi-differences"

Bob Harris

unread,
Feb 13, 2004, 6:24:45 PM2/13/04
to
In article <402c927a$1...@nntp.unige.ch>, g <m...@here.ch> wrote:

> I don't want to get a big argument started here, but, in brief, why
> would I want to use vim instead of vi?

99% vi compatibility when you want it. This makes Vim a natural choice
as an editor on systems that do not have vi, if your fingers know and
love vi.

Operating system support for everyone's UNIX/Linux, Amiga, MS-DOS,
Windows (all flavors), OS/2, Atari, OpenVMS, BeOS, MacOS, MacOSX (which
I use if I have to write anything extensive on my Mac), etc...

Multi-level undo (and redo).

GUI interface available (gvim) with support for mice, scroll bars,
menus, etc...

Split windows and multiple active buffers.

Syntax coloring for different programming languages.

Side-by-side visual differences (vimdiff & gvimdiff).

Instant Macros by executing the commands once while recording them, then
execute the Macro to repeat the commands.

Visual selection mode that highlights the text, plus rectangular select!

Command history for ex mode commands and the ability to edit them for
reuse.

Search pattern history and the ability to edit previous patterns for new
searches.

Very very Long line support with either line wrapping or left/right
window scrolling.

Paragraph and C comment reformatting.

Built-in :make command for Edit-Compile-Edit-Compile...

Cscope support.

Improved auto-indenting for C language source.

Search for patterns in the current file as well as #include files.

Automatically execute commands to customize the environment based on the
file name or type.

A powerful scripting language for customizing the environment during
initialization or for writing your own new commands.

The ability to save state across editing sessions via the .viminfo file.

0 new messages