Ming Lei wrote:
I have a basic question about vim internal. Let me use an example to
describe:

Say I have a text file of 20Mbytes. I use VIM to insert 3 characters at
offset 1024 bytes from the beginning of the file and then I save the
file. My question is: how does VIM handle the file write and save? Does
VIM rewrite the whole file back to disk/file system? Can anyone describe
the procedure that VIM employs at the granularity of the system call?

PS. Please reply or CC to my email address as well.

AFAIK the only way to *insert* three bytes in the middle of a file is to re-write the entire file. I'm not aware of any file system for which this is not the case.

I suppose it is possible that vim itself doesn't have to do the work, but someone - either the application or the kernel, and ultimately the storage device - does. Were you asking *where* that work occurs, or *if* that work occurs?

--
Matthew
Only Joe suffers from schizophrenia. The rest of us enjoy it.

Reply via email to