-
Notifications
You must be signed in to change notification settings - Fork 56
Opfunc decorator #17
base: master
Are you sure you want to change the base?
Opfunc decorator #17
Conversation
Conflicts: plugin/snake/__init__.py tests.py
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.