vim-rails icon indicating copy to clipboard operation
vim-rails copied to clipboard

Cursor movement slows to a crawl, temp fixed with :syntax off/on

Open jasonl99 opened this issue 10 years ago • 5 comments
trafficstars

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?

jasonl99 avatar Apr 28 '15 16:04 jasonl99

Do you have one of those CSS color highlighters installed? Rule that out along with anything similar.

tpope avatar Apr 28 '15 17:04 tpope

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.

m1foley avatar Apr 30 '15 03:04 m1foley

On my setup happens specifically at the end of the controllers, when I break down the params.require fields in multiple lines

aert avatar Nov 30 '16 16:11 aert

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.

tpope avatar May 01 '17 19:05 tpope

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.

mthadley avatar Sep 20 '18 16:09 mthadley