Request: make text insert atomic for undo/redo and repeatingEdit
When I use paredit (in Clojure), my insertions of text seem to be broken up into multiple commands, as evidenced by the behavior of undo/redo and repeating (i.e. the
For example, I enter insert mode and insert the following text:
(def foo (+ 1 2))
...then escape back to normal mode. If I then hit
., I would expect the same text to be inserted again, but instead, only
+ 1 2 is inserted. In a similar vein, I have to hit
u (undo) 3 times to fully undo my insert.
So, my request is, can you make text insertion atomic with respect to these commands?
I've identified a way to do this. The
<C-R>= command, which inserts an expression while remaining in insert mode. For example, from normal mode, typing this:
...inserts the string
u undoes the entire insertion,
<C-R> redoes it, and
. repeats the whole thing. (Credit to Karl Guertin's AutoClose plugin for the technique.)
So I think redesigning the paredit.vim plugin around this mechanism should make this work in a way that's fully compatible with what users expect from undo/redo and repeat. --Kyptin (talk) 16:40, February 17, 2014 (UTC)
- There is a plugin at repeat.vim which the author of this script might find useful for that, although it requires remapping "
.". JohnBeckett (talk) 05:16, February 26, 2014 (UTC)
- repeat.vim seems to be supported by paredit.vim now, and most issues I've had are fixed by it, however commands such as
ct.still seem to be broken up into a separate delete and insert, so the dot command does not work. I don't know enough about vimscript to hazard an attempt at a pull-request - can anyone help? @rsslldnphy, 6 October, 2014