==============================================================================
*11.2* Where is the swap file?
Vim can store the swap file in several places. To find it, change to the
directory of the file, and use: >
vim -r
Vim will list the swap files that it can find. It will also look in other
directories where the swap file for files in the current directory may be
located. It will not find swap files in any other directories though, it
doesn't search the directory tree.
The output could look like this:
Swap files found: ~
In current directory: ~
1. .main.c.swp ~
owned by: mool dated: Tue May 29 21:00:25 2001 ~
file name: ~mool/vim/vim6/src/main.c ~
modified: YES ~
user name: mool host name: masaka.moolenaar.net ~
process ID: 12525 ~
In directory ~/tmp: ~
-- none -- ~
In directory /var/tmp: ~
-- none -- ~
In directory /tmp: ~
-- none -- ~
If there are several swap files that look like they may be the one you want to
use, a list is given of these swap files and you are requested to enter the
number of the one you want to use. Carefully look at the dates to decide
which one you want to use.
In case you don't know which one to use, just try them one by one and check
the resulting files if they are what you expected.
USING A SPECIFIC SWAP FILE
If you know which swap file needs to be used, you can recover by giving the
swap file name. Vim will then find out the name of the original file from
the swap file.
Example: >
vim -r .help.txt.swo
This is also handy when the swap file is in another directory than expected.
Vim recognizes files with the pattern "*.s[uvw][a-z]" as swap files.
If this still does not work, see what file names Vim reports and rename the
files accordingly. Check the 'directory' option to see where Vim may have
put the swap file.
Note:
Vim tries to find the swap file by searching the directories in the
'dir' option, looking for files that match "filename.sw?". If
wildcard expansion doesn't work (e.g., when the 'shell' option is
invalid), Vim does a desperate try to find the file "filename.swp".
If that fails too, you will have to give the name of the swapfile
itself to be able to recover the file.
==============================================================================
*11.3* Crashed or not? *ATTENTION* *E325*
Vim tries to protect you from doing stupid things. Suppose you innocently
start editing a file, expecting the contents of the file to show up. Instead,
Vim produces a very long message:
E325: ATTENTION ~
Found a swap file by the name ".main.c.swp" ~
owned by: mool dated: Tue May 29 21:09:28 2001 ~
file name: ~mool/vim/vim6/src/main.c ~
modified: no ~
user name: mool host name: masaka.moolenaar.net ~
process ID: 12559 (still running) ~
While opening file "main.c" ~
dated: Tue May 29 19:46:12 2001 ~
~
(1) Another program may be editing the same file. ~
If this is the case, be careful not to end up with two ~
different instances of the same file when making changes. ~
Quit, or continue with caution. ~
~
(2) An edit session for this file crashed. ~
If this is the case, use ":recover" or "vim -r main.c" ~
to recover the changes (see ":help recovery"). ~
If you did this already, delete the swap file ".main.c.swp" ~
to avoid this message. ~
You get this message, because, when starting to edit a file, Vim checks if a
swap file already exists for that file. If there is one, there must be
something wrong. It may be one of these two situations.
1. Another edit session is active on this file. Look in the message for the
line with "process ID". It might look like this:
process ID: 12559 (still running) ~
The text "(still running)" indicates that the process editing this file
runs on the same computer. When working on a non-Unix system you will not
get this extra hint. When editing a file over a network, you may not see