From 03fd9ee85db424b9471b5f2466f1aca907d133ff Mon Sep 17 00:00:00 2001 From: Anton Paras Date: Mon, 20 Nov 2017 03:31:44 -0800 Subject: [PATCH] Add Vim swap files to .gitignore (#103) Vim creates swap files when open buffers are edited. These files preserve un-written changes in buffers. They are useful for recovering from system crashes, preventing multiple write-buffers on a single file (which could cause "phantom-edits"), etc. However, these swap files should not be tracked in a git repository. For a given working file, Vim will create a swap file of the format `.swp`. Vim will attempt to remove swap files upon writing & exiting Vim. However, swap files aren't always cleaned up. This may happen if Vim terminates improperly due to a system crash or similar. So, if Vim attempts to create a swap file of the format `.swp`, but that path already exists, then Vim will create a swap file of the format `.swo`. If `.swo` already exists, then Vim will create a swap file `.swn`. Vim will continue backwards through the alphabet until it finds an available swap-file path. If `.sw[a-p]` is completely occupied, then Vim will attempt `.sv[a-z]`, and so forth. However, I did not include `*.sv[a-z]` in this change because I believe that would be overkill, and it may trespass on other programs. I am reasonably certain that no other programs rely on `*.sw[a-p]` files. I am less certain about `*.sv[a-z]` files. Also, having that many swap files is a rarity. The disadvantages of including `*.sv[a-z]` in the .gitignore outweigh the benefits. So, I only included `*.sw[a-p]` files in this change. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 9fecd5c..d37af1e 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,9 @@ build/ !.vscode/launch.json !.vscode/extensions.json +### Vim ### +*.sw[a-p] + ### WebStorm/IntelliJ ### /.idea modules.xml