Skip to content

Conversation

ilya-bobyr
Copy link

repeat.vim was written to be used as either an autoloaded script or a normally loaded script.

In particular, as mappings used to be defined by the autoload script, they would only be actually injected if any other plugin has used the repeat functionality.

In practice, this creates problems as the mapping is not stable. One cannot define a custom mapping to <Plug>(RepeatUndo), as the existence of the mapping from <Plug>(RepeatUndo) is subject to the prior execution of any code that uses the repeat functionality.

Similarly, when loading a session that was stored when u was remapped to <Plug>(RepeatUndo) is almost guaranteed to be an issue. As u is already remapped, but the plugin has not constructed the next step, mapping <Plug>(RepeatUndo) to the correct function.

Just setting up the mappings seems like a solid solution to these problems. While it is a bit less efficient, if the user has enabled this plugin, they probably rely on it, and so the optimizations are most likely negligible.

Also updated the installation instructions. I would imagine most people use plugin managers today. And so it is no longer useful, in my mind, to be able to decide if the plugin will be eagerly or lazily loaded. It just complicates the installation process.


This should address #84 without a hack.
Someone can just create a mapping and exact it to always work.

My main concern is the breakage during session restore.

`repeat.vim` was written to be used as either an autoloaded script or a
normally loaded script.

In particular, as mappings used to be defined by the autoload script,
they would only be actually injected if any other plugin has used the
repeat functionality.

In practice, this creates problems as the mapping is not stable.  One
cannot define a custom mapping to `<Plug>(RepeatUndo)`, as the existence
of the mapping from `<Plug>(RepeatUndo)` is subject to the prior
execution of any code that uses the repeat functionality.

Similarly, when loading a session that was stored when `u` was remapped
to `<Plug>(RepeatUndo)` is almost guaranteed to be an issue.  As `u` is
already remapped, but the plugin has not constructed the next step,
mapping `<Plug>(RepeatUndo)` to the correct function.

Just setting up the mappings seems like a solid solution to these
problems.  While it is a bit less efficient, if the user has enabled
this plugin, they probably rely on it, and so the optimizations are most
likely negligible.

Also updated the installation instructions.  I would imagine most people
use plugin managers today.  And so it is no longer useful, in my mind,
to be able to decide if the plugin will be eagerly or lazily loaded.  It
just complicates the installation process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant