Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] buffer: support attachment in hosted plugins #340

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented Jun 8, 2018

Warning: very rough sketch, but the intention is that multiple plugins can register buffer notifications on the same or different buffers without stepping on each other's toe.

At least the following works: (script for quick test, but does work the same in rplugin)

import vim
b = vim.current.buffer
def cb(buf, changedtick, lines):
     global l
     l = lines

b.attach(cb)

Not sure how to best represent the update, plugins will likely want to use the full new buffer state, but likely they also want to know start, old_end, new_end

def detach():
for i in range(len(a.callbacks)):
if a.callbacks[i] is cb:
del a.callbacks[i]
Copy link
Member Author

Choose a reason for hiding this comment

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

NB: should detach when callbacks goes to zero.

@pierreprinetti
Copy link

Hi 👋
What's the current status of this work? What is left to do before merging (on top of a rebase)?

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.

2 participants