Vim temporary files end with ~ so you can add to the file .gitignore
the line
*~
Vim also creates swap files that have the swp and swo extensions. to remove those use the lines:
*.swp
*.swo
This will ignore all the vim temporary files in a single project
If you want to do it globally, you can create a .gitignore file in your home (you can give it other name or location), and use the following command:
git config --global core.excludesfile ~/.gitignore
Then you just need to add the files you want to ignore to that file
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…