vimeditor

Disabling swap file creation in Vim


Is there a way to disable the creation of .swp files in Vim? Or, at least create them in one place so that I can find and delete them easily?

I find swap files 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.


Solution

  • 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