1. 1
  1.  

  2. 7

    I think calling .swp files “Unix swap files” is a bit of a misnomer. I’ve only ever seen one program make those files, and just like in the article, it’s Vim. vi might be part of POSIX, but that doesn’t make it’s proprietary format part of all UNIX. The article’s reasoning is sound (and historically accurate, I think) but it’s very Vi/Vim specific. Emacs has it’s own version, by suffixing ‘~’ to the end of the file’s name. I bet Sublime, Atom, Eclipse, Visual Studio, TextMate and many, many others do the same thing but into hidden, application-specific directories.

    And speaking of putting those sort of files into application specific directories, here’s how to do it with vim (much better than disabling them):

    set backupdir=~/.vim/tmp//
    set directory=~/.vim/tmp//
    set viminfo+=n~/.vim/tmp/viminfo
    set undodir=~/.vim/tmp/
    
    1. 1

      That’s right. I’ve had lots of .swp files on a Windows NT system; I used Vim on it because it kept me from losing work when the machine crashed.

      1. 1

        Oh my… the number of .gitignore files I have with *.swp in them… thank you, you’re my hero tonight.

      2. 1

        It doesn’t even mention the main purpose of .swp files, which is to keep Vim’s memory usage low!