On 08:19 Tue 10 Apr , Ben Fritz wrote: > > > On Monday, April 9, 2012 10:44:36 AM UTC-5, Eric Weir wrote: > > > > The last couple days I have been getting a "swap file already exists" > > message when I attempt to open a file. When that happens, as you are > > aware, the user is given several options, which to me are extremely > > confusing. A factor I feel certain is involved is that on a couple > > occasions either vim or a vim window was closed in other than normal > > fashion. [E.g., on one occasion, while I was running the computer on > > battery power, the battery ran down while I was away from my desk. > > Normally, when that happens the computer goes into suspend mode and when I > > attach the power cord the computer starts back up in the state it was in > > when it went into suspend mode. This time, however, it shut down. After > > restarting the computer I got the "swap file already exists" message when > > I restarted vim and attempted to load a file.] > > > > > > When I get the message I am never certain what to do. Usually I know that > > the file had been saved after the last edit. Even in that case i'm not > > sure what to do to open the most recently saved copy of the file. When I'm > > uncertain, I don't know which option will give me the most recent copy of > > the file. Or if I make the wrong choice, how I might recover---if that is > > possible at all. > > > > > > I imagine experienced programmer-users of vim would not have this problem. > > I am neither. I am a non-programming relative novice vim user. Help > > regarding my options and best choices in this situation would be greatly > > appreciated. > > > > > > If you look closely at the "swap file exists" message, you should see a line > that says "modified: no" or "modified: yes". This line tells you at a glance > when the swap file corresponds to a file which has no changes since the last > save. If you see "modified: no" and you are not editing the file in another > Vim, then you can always safely choose to delete the swap file (choice: d). > > If you see "modified: yes" and you are not editing the file in another Vim, > then the safest option is always to recover (choice: r) and then diff the > file with the contents on-disk to see what has changed. > > If you don't see the "modified" line or you are editing the file in another > Vim, you'll need to think a little harder about things. Obviously if you're > already editing the file in another Vim, the safest option is either to open > the file read-only or quit. If not, did you already recover the file? If so, > you should be able to delete the swap file. I always quit Vim after I > recover, then re-load to edit the file again and delete the old swap file. > > See :help E235, which is the error code shown at the top of the "swap You mean :help E325 :)
Best, Marcin > exists" message. > > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
