Disabling swap files creation in vim

editorvim

Is there a way to disable .swp files creation in vim? or at least create them all in one place so I can find and delete them easily.

I find them especially annoying when I copy the parent directory while editing at the same time. Of course I know that I can use find -exec to find and delete them. But I want a more practical solution.

Best Answer

To disable swap files from within vim, type

:set noswapfile

To disable swap files permanently, add the below to your ~/.vimrc file

set noswapfile

For more details see the Vim docs on swapfile