MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.85k stars 38 forks source link

bug: Seems to cause Lag over ssh #45

Closed MrNavaStar closed 5 months ago

MrNavaStar commented 5 months ago

Neovim version (nvim -v)

0.10.0

Operating system

Linux, Fedora 40

Terminal emulator / GUI

Gnome Terminal

Describe the bug

when using nvim with this plugin over an ssh connection nvim becomes quite slow and laggy, regardless if a markdown file is open or not. Disabling the plugin makes the issue go away.

Expected behavior

no lag

Additional information

No response

MeanderingProgrammer commented 5 months ago

Thanks for brining this up, that's definitely interesting.

Outside of markdown files this plugin does listen to a fair number of events: ModeChanged, WinResized, FileChangedShellPost, FileType, & TextChanged.

The main problem here is likely the usage of the TextChanged event, I'll see if I can remove the need for this. Will update shortly!

MeanderingProgrammer commented 5 months ago

I've pushed a pretty substantial refactor to how auto commands are setup: https://github.com/MeanderingProgrammer/markdown.nvim/commit/14b3a01fbd7de25b03dafad7398e4ce463a4d323.

This keeps only the FileType / WinResized as auto commands that run globally. Everything else is setup at a buffer level and only on markdown buffers, which should remove most of the background performance penalty.

Would you mind updating the plugin and letting me know if the performance is better? I'm super curious!

MrNavaStar commented 5 months ago

I'll give it a shot later today!

MrNavaStar commented 5 months ago

As far as I can tell the lag is gone! Thanks so much!

MeanderingProgrammer commented 5 months ago

Awesome, glad it's working!