I have a large file, about 1.5 Gb
. When opening the file in vim, I typically will ctrl-c
escape the buffering so I don't have to wait for the whole file to load. For one particular file, it was modified by a prepackaged program, which subsequently made it made read-only.
I needed to edit this file somewhere near the beginning, so I did so and then saved it using :wq!
(as prompted to do so by vim). When I exited, I noticed that the file had decreased in size from about 1.5Gb
to ~200Mb
. I believe it only saved what it had loaded before I exited with :wq!
.
Is this a known behavior of vim? It seems like a bad design flaw that it would tell you to exit with wq!
when a file is read-only, but not warn you that it won't write what hasn't buffered yet.