How would it help in deleting swap files? Simple test:
```
% mkdir abc
% touch abc/{a,b,c}
% vim -u NONE -i NONE -N --cmd 'set hidden' abc/? -c 'bufdo normal! i'
-c 'set directory=/tmp'
<C-z>
% ls -lA abc
```
How many swap files have Vim deleted from abc? Zero, &directory
changes do not apply for existing buffers with swap files already
assigned.
>
>> Also Vim does not provide any way to do anything sensible with the
>> situation “two users simultaneously edit the same file”. False
>> positives and negatives do not make the situation better as well:
>> neither Vim checks whether currently running process with PID stored
>> in swap file has anything to do with the creator of swap files, nor
>> there is any way to determine whether simultaneous editing actually
>> happens in “remote file system with access from different machines”
>> and “access from same machine, but separated via various means like
>> PID namespaces” cases. Enough false alarms and users will stop caring
>> about them.
>
> Does not match my experience. Two different users editing the same file
> is very uncommon anyway. In most cases it's the same person working
> from different accounts.
This concern does not completely nullify a point, just makes discovery
of the source of the problem easier and the situation looking more
likely: one user with two accounts or two users with two accounts,
there still is no protocol for the case in documentation and “swap
file exists” warning forces to make a decision right there, without
any checks (like running `ps`) should you forget that you were editing
a file.
Though in place of “should you forget” there is more practical example
of the case which needs investigation before making decision I once
experienced: I knew that previous session crashed, but Vim still
reported it as running: obviously, I got PID collision, but it is not
like I knew the mechanics of such detection at that point.
But if &directory is a dedicated directory in the above case Vim
deletes the swap file because buffer name did not change and neither
did location of the swap file. If it is dot original buffer name did
not change, but location of swap file did, so swap file of the
original buffer is considered “lost” (with a warning), and yet it
can’t be deleted from Vim dialogue.
It looks like the main reasoning is “ability to omit saving your work”
in conjunction with “working from a different computers with no easy
access to previously used ones”: without one or the other neither of
your points can make swap files in the current directory useful. My
experience says that while some of my collegues sometimes forget to
save even though they know they do not have UPS and power is known to
flash sometimes, second point is almost non-existent.
And as you said earlier, there *is* &directory setting, nobody is
voicing to remove it, just change the defaults. If dot suits your
workflow better you can set dot, but I very doubt that most Vim users
- do not use archives (or enjoy garbage there),
- do not share files on flash cards with non-Vim users which find swap
files suspicious garbage (just garbage if you explain) (BTW, not
necessary non-*nix users: I once enabled showing hidden files and got
complains about single empty (dolphin configured so it would not leave
anything there) .Trash),
- love to create local .vcsignore files (also not all authors tolerate
swap file ignoring in project .vcsignore and local .vcsignore files
are for some reason less of a common knowledge),
- like to receive swap files in rarely needed `ag --unrestricted` (or
e.g. `grep -a`) output,
- find `ls -lA` output with garbage out there good and
- would not want to be able to create a fast and simple script which
does automatic recovery after a crash: swap files management is easier
if all swap files are in one location.
So far Neovim received almost no complains about the new default.
I have also checked how swap file location makes difference with a
laggy network filesystem (Yandex disk, but mounted with webdav in
place of using their FS synchronizing daemon):
time (vim -u NONE -i NONE -N ~/mnt/yandex/foo --cmd 'set directory=.' -c cq)
reports almost six seconds (5.9),
time (vim -u NONE -i NONE -N ~/mnt/yandex/foo --cmd 'set
directory=~/.vimswap//' -c cq)
reports less then a second (0.7 seconds). `~/mnt/yandex/foo` does not
exist, `~/mnt/yandex` is a wdfs (FUSE) network mount.
---
BTW I have a habit of saving file immediately I pause for a moment to
think for the next action, and for a good reasons: neither all
software I am using bothers with some kind of autosaving or recovery,
nor I find that autosave/recovery being always reliable.