PS: There is a bit of discussion of this (for vim) at [1] with the general rule(s) and a code snippet from vim. One suggestion is to use '*.sw[g-p]' to spare .swf files for Flash [2]. So we could honour your .swc via '*.sw[d-p]'. But it seems to me that you may still be better off avoiding this by renaming or archiving these files. Thoughts? Dirk [1] https://unix.stackexchange.com/questions/326707/vim-what-are-all-the-possible-swapfile-extensions [2] It's an old discussion -- dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
On Thu, 7 Aug 2025 14:11:08 -0500 Dirk Eddelbuettel <edd at debian.org> wrote:> One suggestion is to use '*.sw[g-p]' to spare .swf files for FlashOn Unix-like systems (and, empirically, on Windows, despite ':help swap-file' says the dots are replaced), Vim prepends a dot to the name of the swap file. So how about only matching files that start with a dot and end with .sw[certain letters]? grepl( '(^|/)[.][^/]+[.]sw[a-p]$', c('.swap.file.swp', 'subdir/.swapfile.swn', 'not-a-swapfile.swc'), perl = TRUE ) # [1] TRUE TRUE FALSE -- Best regards, Ivan
Thanks for the suggestions, Dirk and also Ivan. Given that this change is in the released version of R I'll have to go with a workaround for now even if the regex can be updated. It would be great if the regex could be updated because I think the new one really does catch more than it should. The workaround is quite a dance because it means that I have to do a setup/teardown before my tests. I can do this once for the whole test suite, but then it means that I can't conveniently run individual tests during development. I have tens of separate tests using these files so running a setup/teardown for each individual test would require a significant amount of additional code tweaking. Best wishes, Greg. On 7 Aug 2025, at 20:11, Dirk Eddelbuettel wrote:> PS: There is a bit of discussion of this (for vim) at [1] with the general > rule(s) and a code snippet from vim. One suggestion is to use '*.sw[g-p]' to > spare .swf files for Flash [2]. So we could honour your .swc via '*.sw[d-p]'. > > But it seems to me that you may still be better off avoiding this by renaming > or archiving these files. Thoughts? > > Dirk > > > [1] https://unix.stackexchange.com/questions/326707/vim-what-are-all-the-possible-swapfile-extensions > [2] It's an old discussion > > -- > dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org-- Gregory Jefferis, PhD Tel: +44 1223 267048 Division of Neurobiology MRC Laboratory of Molecular Biology Francis Crick Avenue Cambridge Biomedical Campus Cambridge, CB2 0QH, UK http://www2.mrc-lmb.cam.ac.uk/group-leaders/h-to-m/g-jefferis http://jefferislab.org http://www.zoo.cam.ac.uk/research/groups/connectomics