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

125107Re: swap files reverting my work erroneously

Expand Messages
  • Tony Mechelynck
    Aug 2, 2011
    • 0 Attachment
      On 02/08/11 07:44, Christian Brabandt wrote:
      > Hi Gary!
      > On Mo, 01 Aug 2011, Gary Johnson wrote:
      >> don't put your swap files elsewhere). If you open foo again, Vim
      >> will tell you that it has found a swap file, etc. Regardless of you
      >> choice, Vim will use a new swap file for the current buffer, named
      >> .foo.swo. That file will be deleted at the end of your Vim session
      >> if you exit normally. The swap file from your previous Vim session,
      >> .foo.swp, will remain. That's the one you have to delete manually.
      > I have been thinking lately if it would be a good idea, if Vim would
      > only create a swap file, when it detects, that a change to the buffer
      > has been made. But not just when viewing a file.
      > That is usually what happens a lot to me. I have 1 file open and in
      > another Vim instance I open the same file again only for viewing, so I
      > would like to avoid the "Attention" prompt.
      > On the other hand I can see, that it is certainly useful, if you start
      > editing a file and immediately Vim warns you, that another Vim instance
      > is already editing that file. Hm, may be a new option swaponchange or
      > something?
      > regards,
      > Christian

      IIUC, opening a file read-only (e.g. with :view rather than :edit) does
      not create a corresponding swapfile.

      If you open a file with :edit (or :split or :new etc.) (and that file
      doesn't happen to have 'readonly' or 'nomodifiable' set for other
      reasons), Vim has no way to know that you just want to look at the file,
      not change it. When you know from the beginning that you won't make
      changes in the file, always use :view (or :sview etc.) so Vim will set
      'readonly' on that file (and, IIUC, not create a swapfile for it until
      or unless you actually make a change).

      Best regards,
      A disciple of another sect once came to Drescher as he was
      eating his morning meal. "I would like to give you this personality
      test", said the outsider, "because I want you to be happy."
      Drescher took the paper that was offered him and put it into
      the toaster -- "I wish the toaster to be happy too".

      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
    • Show all 25 messages in this topic