On Sat, Apr 5, 2014 at 5:17 PM, Benjamin Fritz <[email protected]> wrote:
> On Sat, Apr 5, 2014 at 4:09 PM, Bram Moolenaar <[email protected]> wrote:
>>
>> Ben Fritz wrote:
>>
>>> On Saturday, April 5, 2014 2:02:23 PM UTC-5, Bram Moolenaar wrote:
>>> >
>>> > You can record into a register and replay that.
>>> >
>>>
>>> This is not an option for the desired use case, of creating a plugin
>>> to automatically insert closing parentheses and the like as you type
>>> the opening character. For that we need to be able to move the cursor
>>> in insert mode without breaking undo and without knowing in advance
>>> that we need to be recording a macro. One cannot start recording a
>>> macro with a mapping, 'q' does not function in a mapping according to
>>> the help. So the user would manually need to start recording before
>>> typing every single time, so mapping every insert-mode entry key would
>>> not only be annoying, it wouldn't work. Plus, one would want a plugin
>>> such as this to be itself recordable in a macro, which can't be done
>>> if you must record a macro to accomplish the task.
>>
>> I have no clue how you could repeat the changes a plugin makes with ".".
>> The plugin could do anything, with any kind of advanced logic. How
>> would "." know what to repeat? It can't possibly know that you inserted
>> ")" in a specific place and repeat that.
>>
>
> Well at least we could join the undo sequence so u/<C-R> work properly
> afterward. Potentially repeat.vim can help here.
>
> I know that by abusing setline() in previous versions of Vim,
> delimitMate and other plugins managed to get this working.
>
> But now nobody seems to have found a working hack.
I found a working hack[1] (except it doesn't work for visual-block mode :)
Speaking of which, does anyone know how to detect visual-block mode?
There was a suggestion[2] to call visualmode(1) in an autocmd:
autocmd InsertLeave * call visualmode(1)
...and then check for mode() == 'i' && visualmode() == '^V'. But that
could have side-effects for other plugins or the user's mappings.
[1] https://github.com/Raimondi/delimitMate/issues/138#issuecomment-35458273
[2] https://github.com/Raimondi/delimitMate/issues/138#issuecomment-35588257
> It would be better to support it intentionally. For example, with an
> insert-mode command to chain two changes together.
>
> :undojoin works for arbitrary ex commands. Why can't we have something
> similar for insert mode segments?
It was discussed some time ago on either vim_use or vim_dev, but I
can't find the thread.
Justin M. Keyes
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.