Loading ...
Sorry, an error occurred while loading the content.

Re: Removing junk .swp files

Expand Messages
  • Paul
    ... I don t recommend this, because like George Dinwiddie says, it doesn t check to see if any swap files are in use, but this is a more efficient command:
    Message 1 of 13 , May 8, 2013
    • 0 Attachment
      On Wednesday, 01 May, 2013 at 20:11:08 BST, Mike Hume wrote:
      >You could setup a tmp directory for where swp files are stores.
      >
      >set directory=~/.vim/tmp/swap
      >
      >If you have swp files littered about, run this command to recursively find and delete them:
      >
      >find . -type d -name .swp | xargs rm -rf

      I don't recommend this, because like George Dinwiddie says, it doesn't check to see if any swap files are in use, but this is a more efficient command:

      find ~ -type f -name \*.swp -delete

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Gary Johnson
      ... Also, not all swap files end in .swp. If Vim needs to create a swap file and one ending in .swp already exists, Vim will use the extension .swo for the
      Message 2 of 13 , May 8, 2013
      • 0 Attachment
        On 2013-05-08, Paul wrote:
        > On Wednesday, 01 May, 2013 at 20:11:08 BST, Mike Hume wrote:
        > >You could setup a tmp directory for where swp files are stores.
        > >
        > >set directory=~/.vim/tmp/swap
        > >
        > >If you have swp files littered about, run this command to
        > >recursively find and delete them:
        > >
        > >find . -type d -name .swp | xargs rm -rf
        >
        > I don't recommend this, because like George Dinwiddie says, it
        > doesn't check to see if any swap files are in use, but this is a
        > more efficient command:
        >
        > find ~ -type f -name \*.swp -delete

        Also, not all swap files end in .swp. If Vim needs to create a swap
        file and one ending in .swp already exists, Vim will use the
        extension .swo for the new one and .swn after that. I think it just
        continues backwards through the alphabet. So using something like

        \*.sw[nop]

        or even

        \*.sw?

        would be more thorough.

        Regards,
        Gary

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Adrian Luff
        ... Using xargs doesn t correctly handle files with spaces in their name by default in my environment. I m not sure of the portability of fixes for this so I
        Message 3 of 13 , May 9, 2013
        • 0 Attachment
          Assuming you have the following in your .vimrc:
          set directory=$HOME/.vim/swap

          You can easily use find and metadata from the file system to remove files that have not been accessed in more than 30 days:

          find ~/.vim/swap -type f -atime +30 -name \*.sw? -exec rm -f {} \;

          Using xargs doesn't correctly handle files with spaces in their name by default in my environment. I'm not sure of the portability of fixes for this so I stuck with -exec.

          -Adrian

          On May 8, 2013, at 10:05 AM, Gary Johnson <garyjohn@...> wrote:

          On 2013-05-08, Paul wrote:
          On Wednesday, 01 May, 2013 at 20:11:08 BST, Mike Hume wrote:
          You could setup a tmp directory for where swp files are stores.

          set directory=~/.vim/tmp/swap

          If you have swp files littered about, run this command to
          recursively find and delete them:

          find . -type d -name .swp | xargs rm -rf

          I don't recommend this, because like George Dinwiddie says, it
          doesn't check to see if any swap files are in use, but this is a
          more efficient command:

             find ~ -type f -name \*.swp -delete

          Also, not all swap files end in .swp.  If Vim needs to create a swap
          file and one ending in .swp already exists, Vim will use the
          extension .swo for the new one and .swn after that.  I think it just
          continues backwards through the alphabet.  So using something like

             \*.sw[nop]

          or even

             \*.sw?

          would be more thorough.

          Regards,
          Gary

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.



        Your message has been successfully submitted and would be delivered to recipients shortly.