I have a file with 30000 lines (3MB), when I use :w vim editor hangs for several seconds, but when I use pure vim/vi it takes only a moment to save the changes.

Why do I get this effect? What could be causing this lag?

Update: Changed original question What is the difference between :w and :up? to Why :w command is so slow for relatively small file?

  • 1
    Is the buffer modified in both cases? – Christian Brabandt Sep 22 '15 at 10:23
  • @ChristianBrabandt You are right! I didn't make any changes when used :up command. :up also hangs for several seconds. But the question remains, which functionality creates the lag? – niekas Sep 22 '15 at 10:35
  • Is this reproducable when starting vim like vim -u NONE -N file.log or using :noa :w? – Christian Brabandt Sep 22 '15 at 12:09
  • @ChristianBrabandt No, the lag problem is not reprocessable when using vim -u NONE -N file.log command to open the file, it takes only a moment to save the changes. And :nao command is not found. – niekas Sep 22 '15 at 12:20
  • 5
    I'm voting to close this question because it is a problem with the asker's .vimrc and that .vimrc is not provided in the question. – Gilles 'SO- stop being evil' Sep 22 '15 at 20:37

I would just comment, but not enough reputation.

Looking at :help up it says "Like :write, but only write when the buffer has been modified."

| improve this answer | |
  • Yes, I looked it up before, but this definition does not explain the performance difference of these two commands. – niekas Sep 22 '15 at 9:03
  • I guess its caused by one of commands in my .vimrc, since not all the file is created by me, I don't know what kind of command to look for. And the problem persists only with big files. Maybe its caused by file backing up (undofile, swap)? – niekas Sep 22 '15 at 9:15
  • @niekas It does explain the difference if your performance problem is related to writing the buffer to file (which seems likely). When the buffer is not modified, :update will not write to file, ergo no problem. In that case, this answers your original question correctly. Nick's answer may be off because it answers your question, but doesn't solve your problem. In that case, you might consider accepting this answer and asking your new question in a, well, new question. – jjaderberg Sep 22 '15 at 23:32

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