Inserting text on the right side of the cursor and the repeat command
I was recently playing around with Tim Pope's surround.vim and noticed
that it suffers the same problem that my unreleased AutoClose.vim.
Namely, the plugin provides an i_ctrl-gs mapping which inserts an
opening string and a closing string, placing the cursor between the
two. For example, typing <c-g>s'foo results in 'foo|' appearing in the
doucment (with the | being the cursor). My plugin behaves similarly,
typing 'foo gets you 'foo|' and typing ' gets you 'foo'|.
This is fine, this is good, but when you try to repeat the insertion
(.) after a surround.vim <c-g>s you don't get 'foo' like you expect,
but rather some odd behavior related to how he implemented his insert
function. My problem manifests itself differently -- I'd get ''foo on
a repeat -- but the cause is the same.
I'm not aware of any plugins that insert text on the right side of the
cursor without breaking repeat. I've avoided releasing AutoClose
because of this*. Is such a thing possible?
* Well, this and the issue of how to insert single openers/closers
without having to toggle the plugin or use ^v.