In comp.editors, Spiros Bousbouras <
spi...@gmail.com> wrote:
I subscribe to the vim mailing list. His post to
vim...@googlegroups.com
made it to the list and no one replied. There is probably no way, short
of a patch, to get what Ottavio wants.
>> $ vim -r
>> Swap files found:
>> In directory ~/.vim/tmp:
>> -- none --
>>
>> Is there a way to make vim behave like nvi, that is, give a less verbose
>> message natively, without, e.g., using a shell script?
Likely not.
>> And, should I have to use a script or a function, what would be a good
>> one liner? I've tried both: `find` and `ls -al` but they both return
>> success even if they don't find files in ~/.vim/tmp.
This gets tricky unless you are willing to hardcode the directory to
look in for swap files. That is not a standard location. When I run
`vim -r` I get lists from four directories (., ~/tmp/, /var/tmp/, /tmp/)
and two results in /var/tmp/ for files that are not mine. For those
files, the results are terser than for files that are mine.
:r! vim -r 2>&1
Swap files found:
In current directory:
1. .configure.swp
owned by: username dated: Fri Feb 19 15:12:46 2021
file name: ~username/src/mimedown/configure
modified: no
user name: username host name:
shelhost.panix.com
process ID: 29440 (STILL RUNNING)
2. .smtp.c.swp
owned by: username dated: Fri Feb 19 15:04:37 2021
file name: ~eli/src/mimedown/smtp.c
modified: no
user name: username host name:
shelhost.panix.com
process ID: 29440 (STILL RUNNING)
In directory ~/tmp:
-- none --
In directory /var/tmp:
4. .mutt-panix5-905-24883-2717832404293756297.swp
owned by: user1 dated: Wed Feb 24 15:21:02 2021
[cannot be opened]
5. .nn.O2ZmDb.swp
owned by: user2 dated: Thu Jan 28 21:21:06 2021
[cannot be opened]
In directory /tmp:
-- none --
A one liner _could_ run "vim -r" and parse the output saving the
directory name and then combining it with filenames listed on the
lines starting with a number, perhaps rejecting ones that cannot be
opened. That starts to get complicated for one line.
>> $ ls -al .vim/tmp/
"ls -Al" might be better.
>> $ (find .vim/tmp/ >/dev/null) && echo yes ||echo no
find $HOME/.vim/tmp -type f -name \*.sw\?
I know my record is about five swap files with the same initial name.
For me, these come from as yet unamed files, and the names count
backwards in letters: .swp, .swo, .swn, .swm, .swl, ...
> [ -z "$( find .vim/tmp/ -type f )" ] && echo Directory empty
> This assumes that .vim/tmp/ may only have regular files.
I'm not sure I follow "may only have regular files". Are you commenting
about the possibilty of a non-swap file may be in there? I'd have said
"will not have regular files" for that case.
Elijah
------
doesn't know if/how nvi reports other people's recovery files