Re: vi key bindings

Thanks Chaals.

Based on a brief look at Amaya's help page for Thot keyboard shortcuts,
it looks to me as though the infrastructure for Thot keyboard shortcuts
is missing three facilities that are needed to have nice vi editing key
bindings.  For that matter, this probably applies to other editors too,
like emacs; substitute "emacs" for "vi" below if you like.  What seems
to be needed is:

  (1) the ability to store state, e.g., for the designer of the
      keyboard shortcuts to create her own variables,

  (2) the ability to evaluate condition expressions, and

  (3) the ability to read state from the edit engine, e.g., what
      line number we're on.

With (1), we could, for example, store whether we're in vi insert mode
or vi edit mode.  With (2) the behavior of a given key could depend on
whether we're in insert mode.  With (3) we could implement things like
"set a mark here" (to explain what this is to non-vi users: setting a
mark is like placing a bookmark in a particular spot in the source).

Without (1) - (3), the utility of having vi key bindings in Amaya is
going to be pretty limited.  I don't need a really fancy set of vi key
bindings, but I do want the basics, like having insert mode.

Here are some more general considerations that I also wonder about.

To get a nice way of editing web content using vi keys,
which of the following is better:

  (a) start with a vi clone and add browsing capabilities, or

  (b) start with something like Amaya and attach vi key bindings to it?

For (a) there's elvis, a vi-clone that can display html but not
xml+css, mathml, or other things.

Also for (a) there are possibilities like attaching a vi clone to a
web browser so that the web browser periodically renders what's in the
vi source editor.  Updates could be done, say, once a second, or once
every 5 seconds.  This is probably much easier than (b).  The only
drawback I can think of is that this might be awfully slow, eat lots
of CPU time, and destroy the interactivity of the source editing.
These things could be awful, or they could be no problem at all --
one would have to see how it is in practice.  Other than that, I don't
know any advantages to (b) over this method.  Having used Amaya only
for browsing the Amaya help, it'd be nice to understand what some
of the advantages of (b) might be.  Anyone?

To implement (b) it's necessary that Amaya have capabilities like (1)
- (3).  To get these capabilities, is it better to adapt the existing
Amaya infrastructure directly, or is it better to get Amaya to allow
the use of an extension language like Perl inside of files like what
are now keyboard shortcuts?

There's a third posibility:

  (c) establish one or more protocols by which editors and renderers
      communicate, and implement the protocol(s) in various editors
      and renderers.

With (c) one could hook up any editor that obeys the protocol to any
renderer that obeys the protocol.  This would be much better than (a)
or (b) in the long run.  It sure is painful to see all this work being
repeated for every type of renderer that anyone designs, and for every
type of editor that anyone designs.  With m editors and n renderers,
method (c) requires only m+n work, instead of m*n work now (or, more
realistically, what happens is that most of the m*n pairs don't get
implemented).  The major drawback of (c) is that it's probably more work
than either (a) or (b) for a single tool like Amaya, and it's not likely
to provide the capability that I want any time soon, namely, to have the
ability to browse and edit XML + CSS side by side, using vi key bindings.


On Wed, Apr 23, 2003 at 10:12:29PM -0400, Charles McCathieNevile wrote:
> here are some thoughts  which I have been pondering a few years too long:
> The browse and edit modes of Amaya suggest that you could replicate a lot of
> the vi behaviour. Essentially you would need to apply one set of keyboard
> shortcut modes in browse mode, and a different set in edit mode.
> There are also some things that would take a bit of real coding I suspect -
> the power of vi is in the things that keystrokes can do, and Amaya doesn't
> have all those functions as I understand it.
> There was a discussion on this list a while ago (I will look for a reference,
> but I think it was around the tme of release 7) about having a different set
> of shortcuts for different languages, when Irčne kindly gave some pointers
> for where to make changes in the code to support this.
> cheers
> Chaals
> On Wed, 23 Apr 2003, Andrew wrote:
> >
> >Is there a way to use the vi text editor key bindings in Amaya?
> >
> >If not, might this be added?  There would probably be a lot of interest
> >in this.  For example comp.editors has lots of posts like, "Does anyone
> >know of editors that let me edit XML using vi key bindings?"  Also, elvis,
> >a vi clone, can display html side by side with the html source that's
> >being edited, and this seems to be quite a popular feature of elvis,
> >suggesting that there's a lot of interest in simultaneously editing and
> >browsing editing html / xml / css - like stuff using vi key bindings.
> >
> >
> >Andrew
> >
> -- 
> Charles McCathieNevile  tel: +61 409 134 136
> SWAD-E         fax(france): +33 4 92 38 78 22
>  Post:   21 Mitchell street, FOOTSCRAY Vic 3011, Australia    or
>  W3C, 2004 Route des Lucioles, 06902 Sophia Antipolis Cedex, France

Received on Thursday, 24 April 2003 08:20:14 UTC