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

125121Re: swap files reverting my work erroneously

Expand Messages
  • Christian Brabandt
    Aug 2 8:43 AM
    • 0 Attachment
      On Tue, August 2, 2011 5:39 pm, Gary Johnson wrote:
      > I often encountered that problem in situations where I didn't have
      > control over how Vim opened a file, so training my fingers wouldn't
      > have helped. I often have several Vim instances open containing
      > files I'm editing, so they have swap files. Then in one of those
      > instances I'll use a tags command or a cscope command to find where
      > a symbol is defined or used. If the symbol is in one of the files
      > already open in a different Vim instance, I would get the swap file
      > found error.
      > I fixed that problem with the following SwapExists autocommand:
      > if exists("##SwapExists")
      > autocmd SwapExists * if v:swapcommand =~ '^:ta\%[g] \|^\d\+G$' |
      > let v:swapchoice='o' | endif
      > endif
      > If the swap file exists and if the reason for opening the file is a
      > tags or cscope command, the file is opened read-only.

      Really nice. I'll add that to my config.


      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