Problems using the vim editor on sesfs.stanford.edu file shares mounted on the CEES cluster computers.
Last revision September 20, 2010
vim is a full-featured file editor that is a superset of the old Unix vi editor. It can be started using either name on the CEES systems.
The problem
When you try to open a file for editing with vim, it complains that there is an existing swap file and someone else must be editing the file. It offers to let you override and edit/create the file anyway; if you say OK, it actually works normally. When done, your file is properly created or modified, but you will also find several "junk" files in the same directory that were made by vim, with names like
filename~
.filename.swp
.filename.swo
nnnn
where filename is the name of the file you were editing, and nnnn can be any random 4 digits.
This is a mis-behavior of the vim editor. It actually made the swap file itself (.filename.swp), but thinks someone else has made it! Something about the mapping of permissions from the NTFS security model to Linux, or maybe a cache consistency problem on the file server, is leading vim to think that the swap file already existed. If you "override" its warning, it then makes those other junk files. Unfortunately, none of them get cleaned up by vim and you have to remove them manually.
The workaround
You need to tell the vim editor not to create the swap file and backup file in the first place! Create a .vimrc file in your home directory on the CEES computers with these three lines:
set nobackup
set nowritebackup
set noswapfile
These settings disable the creation of a swap file (filename.swp or filename.swo) and backup file (filename~) that vim likes to make so it can recover from crashes. With these settings, it never complains that someone else is writing the file, and it never makes those "junk" files.
Side effects
Disabling the creation of swap and backup files means that vim cannot recover your changes if you unexpectedly lose your connection or the computer crashes, so be sure to save your editing work often!