stop picking up swp files

Ignore Vim Swap Files Everywhere

Vim swap files are editor noise. They should not show up as untracked files in every repository and submodule you touch.

The clean fix is to use a global Git ignore file.

Do This Once

printf "\n# Vim swap files\n*.swp\n*.swo\n*.swx\n.*.sw?\n" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

What This Catches

Check The Current Repo

git status

If the swap file was untracked, it should disappear from git status. If a swap file was already committed, global ignores will not hide it. Remove it from the index once:

git rm --cached path/to/file.swp

edit this page