vim-rails
vim-rails copied to clipboard
Cursor movement slows to a crawl, temp fixed with :syntax off/on
I have this happen with rails/ruby files on a regular basis. It becomes painfully slow to move the cursor around, sometimes taking a full second moving the cursor one character in any direction.
I've narrowed it a little further, it's slows down frequently right after a save (maybe it's something related to linting?), but sometimes it does it whether I save or not. Nevertheless, I find it interesting that this always "fixes" the slowdown, regardless of when or why it happens:
:syntax off :syntax on
Basically, toggling back and forth returns vim to normal behavior (until it slows down again).
Is there any data I can provide/collect when it occurs that might help debug this issue?
Do you have one of those CSS color highlighters installed? Rule that out along with anything similar.
FWIW I usually narrow down Vim slowdowns by commenting out all the plugin loading in my .vimrc (Plug or equivalent) and then restoring them one-by-one. It's often a plugin I wouldn't expect.
Also, try starting up Vim with the -V option to see if there's extra events going on.
On my setup happens specifically at the end of the controllers, when I break down the params.require fields in multiple lines
The only additional advice I can offer is try commenting out part/all of the syntax highlighting support in rails.vim and see if you can get the problem to go away. If you can narrow it down to a problematic line or lines I can figure out how to fix it.
I believe I ran into something similar. For me, the solution was to use the older regexp engine:
set regexpengine=1
I guess the newer one doesn't play nice with ruby's highlighting? Hopefully this helps someone else as well.