Re: Vi retaining cursor position until after escape from insert mode



On 23 Jul., 15:28, Antony Scriven <adscri...@xxxxxxxxx> wrote:
On Jul 23, 10:28 am, dirk.froemb...@xxxxxxxxxx wrote:

[About a map! to leave insert mode and replace mode
without moving the cursor.]

(1) map!^X ^M^[a^M^[:--j^V^V!^V|j^V^V!^M

(You don't need the `^V's before the `!'s.)

Yes you do: both --j and !|j might be abbreviations
and lose all your data for you. So other keys could be
mapped, but you can't do anything about that, and I use
abbreviations heavily.

... no one who makes all but the most trivial use of vi
should use this.

Work *is* mostly trivial, so this could still be of use.

This is an nvi-only map. Nvi does some funky stuff with
cursor positioning which is not vi-compatible. Basically
line-wise ex commands try to be more character-wise.

Interesting; maybe the new Vi does improve on the old one.
What I had in mind was operating Vi as a stream editor of
its array of lines, each taken from the infinite alphabet
of all lines of text -- a streamlined editor, so to speak:)

So there's a price: (1) breaks a consecutive dot command,
and it also gives away the autoindent option; much worse,
for ^X = ^[, (1) simply diverges. But that's no big deal,
either, [...]

These are all showstoppers.

Depends on what you are trying to accomplish. I think the
dot command has lost its appeal, now that the cursor is in
a much better position, and dot is susceptible to line boundary
anomalies, anyway: maybe you better yank from the new position
and put the yanked text down rather than dot some command
that has once entered the text but maybe doesn't any more.
Autoindent I don't go for.

Did you try using it on the command-line too?

I'm using it on the shell command-line without any trouble,
but you probably mean the colon command-line for the visual
Ex commands. Well, it's not particularly useful there, but
it doesn't hurt, either; after all, escape is still around.

Plus it marks the buffer as modified, ...

So does plain escape even after entering the empty text.

... it won't work to cancel an `r' command.

So you just keep on using escape for that. But that's not
fair: `r' is meant to quote its arguments other than escape,
which you must quote yourself.

Also check out what happens if you use ^X to cancel `60i'.

It doesn't cancel 60i at all; it accepts the newly entered
text, multiplies it, and neatly separates the 60 copies by
line breaks -- hey, a new feature; it's even more primitive
than the standard one still accessible:)

Without some serious hacking of the source code I doubt
you'll ever find a satisfactory solution, and even then
you'd have to maintain your own versions on every machine
you use.

I need to avoid doing serious work on this and still have
most of the obviously desirable qualities -- at the cost of
some minor side-effects that are not necessarily bad or at
least easy to put up with. It's not perfect, but what is?

This topic had been coming up again and again on Usenet
for decades until only a few years back, with no
satisfactory conclusion I recall.

This can be done quite trivially by simply not concerning
oneself with the issue. Brains are yet more plastic than
software.

Some brains are yet more rusty than tinware and don't want
to exercise over trivial matters like constantly adjusting
arbitrary cursor displacements, if they can help it. Me, I
could not find good enough reasons to justify Vi's choice,
although many people have tried to argue in its favor. I
want a simple editor that works and spare myself the Emacs.

Dirk

.



Relevant Pages

  • Re: Vi retaining cursor position until after escape from insert mode
    ... cursor positioning which is not vi-compatible. ... line-wise ex commands try to be more character-wise. ... it's a good editor (though most folks around ... So does plain escape even after entering the empty text. ...
    (comp.editors)
  • Voice-activated macros for doing stuff in Windows
    ... Voice commands would rule. ... #edit after click ... "line":#select line under pointer ... "angle":#put angle marks around text left of cursor, ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: Simple EDT or TPU init file
    ... Thank you for your TPU insight. ... Clearly we need to put the necessary DCL setup commands into ... to switch the cursor back on when exiting. ... SCROLL changes the editing point by leaving ...
    (comp.os.vms)
  • Re: Rexx / edit macro bug?
    ... LOCATE & CURSOR ISREDIT commands are issued. ...
    (bit.listserv.ibm-main)
  • Re: Bind keypress to shell command?
    ... > to simply bind shell commands to a keypress on a numeric kepad. ... Keybindings are configured by associating keys with ... sequences", because they start with the escape key). ...
    (Debian-User)