This seems like a really daft question, but I have a Python file that has a number in it that's a thousand digits long and that file seems to be running very slowly, I'm not sure if there's some kind of processing going on that I'm unaware of.

I press line up j and there's a definite pause of ~1 second thats very painful!

I only have this on the Python file though, it doesn't happen on others.

After deleting the number the file works normally again...

Here is the number :


It's not even a number really, its a string.

  • 2
    Confirmed here; doesn't happen if the file is .txt. Some syntax highlight regexp pattern going astray, I suppose.
    – Rmano
    Mar 22, 2015 at 16:19
  • Since this is syntax highlighting related, the simple workaround would be to set synmaxcol to some limited number (such as the width of your terminal).
    – Slade
    Mar 22, 2015 at 19:18

1 Answer 1


I can reproduce this with the syntax/python.vim that ships with Vim 7.4.663.

Using :syntime, this seems to be caused by the following syntax group / pattern:

73.870736   20     0       3.940215    3.693537  pythonNumber       \%(^\|\W\)\@<=\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>

You should report this problem to its maintainer (his name and email address is in the script's header).

Incidentally, I originally could not reproduce this, because I use an alternative syntax script from here. Switching to that (if it fits your requirements), would be a viable workaround, too.

Edit: Looking further into the probably cause, this seems to be due to pathological performance of the new NFA-based regexp engine. With :set regexpengine=1, I don't see that huge slowdown. So one possible workaround / fix would be switching to the old engine for that syntax match; this can be done by prepending \%#=1 to the pattern (cp. :help NFA).

  • thanks @Ingo, I've never reported anything before but I'm happy to do so. I have the syntax file in /usr/share/vim/vim74/syntax, the developer at the top is Neil Schemenauer <[email protected]>. Can I ask you; is this why you changed syntax files originally? Thanks
    – baxx
    Mar 22, 2015 at 19:42
  • Yes, that's right; the latest version is from 2014 Jul 16, so it's likely it is still being maintained, and you'll get an answer from the author. You can point him to this, your question, as it already contains a nice reproducible example. Mar 22, 2015 at 20:31
  • I just found my alternative Python syntax somewhere somehow; I'm only rarely editing Python files, so I haven't given that much thought so far. Mar 22, 2015 at 20:32
  • thanks @Ingo, I've changed the syntax files and it's no longer being so slow. I'm afraid the regex engines are a bit beyond my understanding, I'll email the dev though, I'm happy to carry out any tests.
    – baxx
    Mar 22, 2015 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.