Anna Klein wrote:

> On Wed, Feb 10, 2010 at 5:02 AM, Christian Brabandt <cbli...@256bit.org>wrote:
> 
> > Hi Ben!
> >
> > On Di, 09 Feb 2010, Ben Fritz wrote:
> >
> > > > Is there an event (or something similar to it) which captures the
> > > > insertion or deletion in Vim? Or, basically, an event to notify the
> > > > buffer is modified, and to provide the information of the
> > > > modification.
> > > >
> > > > For example, a user do a paste on the buffer. Then, the event will
> > > > provide me what the string is pasted. Another example, a user do a
> > > > replace. Then, then the event will provide me what string is deleted,
> > > > what the replacement is, and also the position of that string.
> > > >
> > > > Is there such event in Vim? or maybe a workaround for it. Something
> > > > similar to "startDocumentListen" in h nb-events.
> > > > Can anybody advise me on this matter?
> > > >
> > >
> > > Sadly, Vim does not have this functionality. It is possible to see
> > > that the buffer has changed using b:changedtick in an autocmd like
> > > CursorHold or CursorMoved, but I don't think there is a good way to
> > > determine what the change was.
> 
> Yes, Ben. It is not sufficient enough to know that a change occurs, without
> knowing what the change is.
> 
> > :h todo.txt explains some autocommands, that should be added, e.g. a
> > BufChange and InsertCharPre/Post autocommand.
> 
> Christian, as the autocommand is on the todo list with unclassified
> priority, will there be a timeframe for its implementation?
> 
> In netbeans.txt, I found two nb-functions which are exactly what I want.
> insert off text
> remove off length
> Does that mean that actually they have been developed somewhere?

If your goal is to keep track of what text is added and deleted, the
netbeans interface is indeed the way to do this.  It's not particulary
easy to use, but it has the functionality.

The autocommands will only trigger before/after a change, they won't
have a way to know exactly what was inserted or deleted.  It's unlikely
that these autocommands will be added in the near future, because it
will be very tough to handle side effects (e.g. when an autocommand for
text being inserted then changes text).

-- 
'Psychologist' -- Someone who looks at everyone else when
an attractive woman enters the room.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to