Monday, April 16, 2018

Detecting `undo` and `redo` from TextChanged

 
The plugin I'm working on updates the buffer after every change and uses :undojoin.  Unfortunately, sometimes the change *is* an undo, in which case, :undojoin kills the history.  What's the best way to detect whether the operation is an undo or redo for this purpose?

The only thoughts I have are to  nmap u and <C-r> (ick), or to somehow check the number returned by getchangelist()... although I getchangelist('%')[1] doesn't seem to ever return the current change, as far as I can tell.

Thanks,
-Jason

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment