5

When I save a file in Vim using :update or :w, Vim's entire UI blocks for about a second while it does something mysterious that (as a side effect) writes the buffer being edited to disk.

This takes way too much time. Sitting there like a chump for 1000ms waiting for Vim to finish the monumental task of flushing the buffer to disk is no fun.

My source file is fairly large (100k), and smaller files don't suffer from this issue, but 100k is really not that large. I consider a ~2,000 line, 100KB source file to be a reasonably sized buffer.

How can I speed this up?

  • I will use Vim's profiling capabilities to see if maybe autocommands could be implicated in this. It feels rather likely. – Steven Lu Mar 8 '17 at 7:28
  • more progress: i am starting to see that the save time may be proportional to the number of open buffers! – Steven Lu Mar 8 '17 at 7:30
  • clearing out other buffers with :bw doesnt appear to help. But definitely a fresh vim on this file saves it fast. – Steven Lu Mar 8 '17 at 7:35
  • I can't figure it out for now. after the vim's been alive for a long time it starts to get this way. – Steven Lu Mar 8 '17 at 7:37
  • 1
    check the faq – Christian Brabandt Mar 8 '17 at 8:05
5

The culprit in this particular situation was the Syntastic plugin.

It's forking eslint.

I load Syntastic on entering insert mode (using a vim-plug function loader).

Vim is plenty snappy on its own.

  • 2
    Hint: have a look at github.com/w0rp/ale – Doktor OSwaldo Mar 10 '17 at 12:45
  • @DoktorOSwaldo Yes I'm definitely evaluating ALE as a replacement. I think eliminating syntastic will greatly improve my vim experience – Steven Lu Mar 13 '17 at 21:28
  • had the same issue - 2-4 seconds saving of each file, which drives me crazy when I work in ipython/F2 and it takes seconds to save files in /tmp – DmitrySemenov Sep 29 '17 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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