0

Every time I vim open, I get the standard warning about another user, swap file already exists, abort/quit/.., etc. I've been trying for at least 2 hours, and I'm sure I don't have the file open myself. The machine in question runs RHEL and I'm using putty.

Is there a way to figure out who has my file open? I'm thinking the result will be one of the machine's user ('s names), but it could be an IP address or something else I suppose. I'm also not sure if this question is more appropriate for unix/linux or vi/vim, so apologies if I tried the wrong one first

5

I think you might be misinterpreting the meaning/operation of the swap file.

The swap file might indicate that some other person/process is currently editing that file, but it doesn't necessarily mean that.

If an instance of Vim crashed, for example, the swap file will hang around until you take steps to remove it, by e.g. selecting the (D)elete option at the prompt, or by manually deleting it outside of Vim.

The message itself tells you the owner of the swap file, along the time and date it was last saved and some other useful information such as whether or not the swap file actually contains any changes, the process ID of the instance of Vim that created it, and whether that process is still running. You can discern from this information whether there actually is another user editing the file or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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