12

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?

6
  • I will use Vim's profiling capabilities to see if maybe autocommands could be implicated in this. It feels rather likely.
    – Steven Lu
    Commented Mar 8, 2017 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
    Commented Mar 8, 2017 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
    Commented Mar 8, 2017 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
    Commented Mar 8, 2017 at 7:37
  • 1
    check the faq Commented Mar 8, 2017 at 8:05

1 Answer 1

10

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.

4
  • 4
    Hint: have a look at github.com/w0rp/ale
    – B.G.
    Commented Mar 10, 2017 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
    Commented Mar 13, 2017 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 Commented Sep 29, 2017 at 22:06
  • I also faced this problem with Syntastic. Switched to ALE and its much faster now.... :)
    – imflash217
    Commented Oct 21, 2021 at 14:59

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.