Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Opfunc decorator #17

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Opfunc decorator #17

wants to merge 15 commits into from

Conversation

averagehat
Copy link
Contributor

This is not ready to merge, but I am opening it up for input.
This works well enough for my purposes (I don't need to replace the text just to get it), however, the behavior when replacing the text doesn't always work as expected. I suspect this is because there is something I don't understand about how visual selection/replacement works in vim/snake.

For example, sometimes when making a selection with "V", the first character that was selected ends up outside of the replacing test instead of being replaced. The same thing seems to happen in normal mode sometimes.

@@ -51,7 +51,7 @@ def dispatch_mapped_function(key):
except KeyError:
raise Exception("unable to find mapped function with id() == %s" % key)
else:
return fn()
return fn(*args)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, but I can't see this working without a change to register_fn, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you have to pass the extra args from within a vim command, which is a mess. I just kept register_fn as it is and omitted the closing paren in the returned string in order to pass the extra vim args. A bit of a hack. I suppose register_fn could optionally format those keyword arguments itself, but I don't know if that would be used at all because AutoCommand context handles those situations where it might be useful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants