Let me add a few more ideas and try to address some questions of terminology.
- Vim doesn't manipulate files directly very often. Commands like
:edit
read a file into a buffer. The buffer and file share a connection only by virtue of the fact that the buffer's name is that of the file; changes to the underlying file are not automatically reflected to the buffer and vice-versa. Commands like:write
write a buffer to a file—any buffer (the current one) to any file. The default is the name of the buffer, but can be overridden. And, some buffers have no name! (See:help backup
for other file operations that may happen when you write a file.) - On the flip side, Vim does usually maintain a swap file. This has several different purposes, but one is to warn about simultaneous edits by marking that a particular Vim instance "owns" the file. (The readonly
view
doesn't need to care about swapfiles until you try to edit the file.)
So there are at least a couple of ways to interpret the question:
- How do I tell Vim I'm done with a file so that other Vims could edit it? In that case, you probably do want
:bdelete
, which deletes the buffer and as a side-effect causes the swapfile to be deleted. You might consider just quitting altogether, though. If startup time is fast, it's easier to jump in and out of Vim than try to maintain a long running session (though cf.:help :mksession
and:help -S
). - How do I blank the screen? You probably just want
:enew
, which is kind of like the buffer you get if you run Vim with no arguments.