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

Scroll vim buffer on web view scroll #23

Closed
shyun3 opened this issue Oct 24, 2024 · 2 comments
Closed

Scroll vim buffer on web view scroll #23

shyun3 opened this issue Oct 24, 2024 · 2 comments

Comments

@shyun3
Copy link

shyun3 commented Oct 24, 2024

Hello, I noticed that scrolling my Neovim buffer will scroll the browser Markdown view but not the other way round. Is this intentional? If so, would it be possible to add support for this?

@jannis-baum
Copy link
Owner

Hello! Yes, this is intentional. I'm afraid that with the current architecture it's not possible to add this. The communication we have looks something like this:

browser <-> vivify-server <- vim

I.e. while there is two-way communication between the browser and the server, Vim only talks to the server but not the other way around, meaning it's not possible to send messages to Vim.

Unless lots of people ask for this or something else that requires implementing this backwards communication, I'd honestly prefer not implementing it because it adds a lot of complexity to the system.


That said, you could in theory implement it for yourself without needing to modify Vivify:

You can use Vivify's config to add client-side scripts, which will allow you to use JS to detect the browser window's scroll location and read the source file line numbers of the elements on screen. Then you can make a small Vim plugin that (e.g.) runs a server with an endpoint you can POST to to scroll the editor to a given line. With that, all that would be left is to make that POST request from your custom client-side script :)

In case you want to do this and need support with the client-side script, let me know and I'll do my best to help!

@jannis-baum
Copy link
Owner

Gonna close this, feel free to reply anyways in case there's anything else :)

@jannis-baum jannis-baum closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2024
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

No branches or pull requests

2 participants