vim-multiple-cursors
vim-multiple-cursors copied to clipboard
Significant slowdown when paired with YouCompleteMe
Either of this two plugins are causing performance problems when inserting text with mutiple cursors. Could you fix it, please?
I also created an issue in YCM: https://github.com/Valloric/YouCompleteMe/issues/1161
Not really, i am not into vim scripting. I just merge PRs and have a bit more updated code, nothing else.
Let me know if the following snippet works when pasted in your vimrc: https://gist.github.com/eapache/0c0abbdb2e810a3f1f4a
- It's a bit hacky, I couldn't come up with a cleaner way to disable YCM other than just emptying the whitelist
- I don't think it can be easily included in multiple-cursors proper because it depends on the existence of YCM for those variables to exist.
After some thought, I am kind of tempted to just disable all the Cursor-related autocommands while multi-cursors is active (these are what is triggering YCM) since most of them make no sense when multiple cursors are enabled, but I'm afraid of what that might break...
Can anybody think of a legitimate use for e.g. CursorMoved
when multiple-cursors is active?
I am not using YCM. Neocomplete works better for me (and easier to set up), and also works fine with multiple cursors.
I see that Valloric created the issue, but i'm not sure if he will fix it or maybe putting it so someone can make PR.
Definititely the Lock and Unlock commands (or functions) should be implemented, i believe this is not the only case where it's needed.
I created PR to Valloric YCM, and it does prevent autocomplete when you lock it, but i saw only small performance improvement with it, so i'm not 100% sure it will help you, but it will not hurt to put it.
@eapache your snippet works, thank you very much for your efforts!
@kristijanhusak I tried your pull request and it also works great for me, thank you! Actually I was wondering about how that might affect other completion plugins (and whether we should report a potential problem to them) but now I'm surprised that multiple cursors does not interfere with neocomplete. I use YCM for it's python semantic completion (implemented in jedi) and I guess neocomplete is simpler in this matter.
@balta2ar , Neocomplete does interfere with multiple cursors, thats why i created this fork and added Multiple_cursors_before
and Multiple_cursors_after
, so we can lock down the triggering which caused problems. YCM does not create that kind of problems, it works find, but it slows multiple cursors editing a bit, so this YCMLock functionality should increase some performance.
@kristijanhusak I noticed while writing my snippet that the before
and after
functions were called multiple times (not just when entering/leaving multiple cursors mode); is that intentional?
@eapache , it's not intentional, honestly i didn't test how much time it's called until now, and i see its called much more than needed. I'll try to fix it now to call it only once that is start, and once that it's ended, because i don't believe anyone need it this way.
@eapache I fixed it, now it should be called only once. Here's the commit: https://github.com/kristijanhusak/vim-multiple-cursors/commit/05b09d282d94b0fe76e960dc2acda92dec53af83
Thanks, I've simplified my gist a bit now that I don't have to keep track of that myself.
Great :) If Valloric approve my PR for the lock and unlock functionality in YCM, you can use that instead emptying whitelist like you are doing now in your gist. Only if your solution gives better performance then i vote for that :)
Great collaboration, guys, thank you!
@kristijanhusak YCM side is ready. Could you please either update README on how to integrate with YCM or make multiple cursors work with YCM out-of-the-box? The latter one looks more user-friendly to me.
The solution for Neocomplete is referenced here: https://github.com/terryma/vim-multiple-cursors#interactions-with-other-plugins. You can easily modify this to work with YCM
Also I'd like to invite you all back to the main terryma/vim-multiple-cursors repo, which is now maintained.