Questions tagged [swap-file]

Vim stores changes made to a buffer on disk to a swap file, so that any unsaved changes can be recovered in case of a crash.

See: :help swap-file

57 questions
29
votes
2 answers

VIM swap-file best practices?

Everytime I cut out of a session in vim by losing my connection I'm rather filled with dred (and yet I continue to use vim...what a masochistist I must be) because when I open my files again a pile of swap-files are waiting to take a shot at…
leeand00
  • 3,555
  • 5
  • 24
  • 40
11
votes
1 answer

vim: (E)dit anyway without prompting

I work with many terminals, and very often hit the case where: a vim instance holds ~/sm/file I open another instance on the same file. My choice is always :(E)dit without prompting ... So I'd like vi to "remember my choice" for every file. Many…
kalou.net
  • 211
  • 2
  • 5
10
votes
5 answers

"E297: Write error in swap file" due to running in a VM

UPDATE: I've tried both the :set noswapfile swapfile solution and the :e! solution and the swapfile one is better because it retains undo history even for large files, in this case meaning over 1.5 MB. For some reason, :e! does not keep undo history…
user62177541
  • 338
  • 1
  • 2
  • 6
4
votes
1 answer

How to prevent vim from creating (and leaving) temporary files over webdav?

When I'm writing over webdavfs vim temporary doesn't handle temporary files properly: ll -a ls: cannot access .htaccess.swp: No such file or directory ls: cannot access .htaccess.swx: No such file or directory total 15196 drwxrwxr-x 2 sergio sergio…
Sérgio
  • 153
  • 6
3
votes
2 answers

Examine swap file

I have no idea how swap files are formatted, but I'm wondering if the information in them can be directly examined somehow. I notice that trying to do this indirectly, by creating an empty file with the same name and/or path and loading it, works,…
goldilocks
  • 801
  • 6
  • 23
3
votes
1 answer

Is it possible to keep a swap file but disable the auto-recovery mechanism?

I want to have swap files for manual inspection if needed, i.e. I don't want ViM to ask me every time I have a swap file if I want to recover / edit, etc. but I do want to have the option to manually pop up this prompt when I want to (e.g. when I…
CIsForCookies
  • 283
  • 2
  • 9
3
votes
2 answers

Force prompt for whether to delete a swap file

How do you configure vim to prompt for deletion of swap files even if it believes another instance of vim may still be using the file? I still want to see the warning message ... just also have the option to delete the file and overrule vim. The…
Greg Nisbet
  • 1,839
  • 14
  • 27
3
votes
2 answers

What does shortmess+=A do about the swp file?

:h shortmess says: A don't give the "ATTENTION" message when an existing swap file is found. But then what does Vim do about the existing swap file? Some people say it's bad to use that option, why so?
dbmrq
  • 857
  • 6
  • 17
2
votes
2 answers

Stop vim from deleting Swap file

I like Vim's swap file system and I want to be prepared for the case I forget to :w, reusing this system. I think it's possible if I can change when Vim deletes the swap file, but I could not find the way firstly to stop Vim from deleting it. Do you…
Dugesia7
  • 63
  • 4
2
votes
0 answers

Vim Swap File Became 187 GB, What are Possible Explanations?

I am running an Ubuntu Subsystem for Windows 10. Within Ubuntu, I worked on a small file via vim and backgrounded it (CTRL-Z) and foregrounded it (% job #) multiple times over a couple day period. Out of nowhere I was alerted by Windows to running…
Howard_Roark
  • 121
  • 1
2
votes
2 answers

Can I have a per-directory setting for where swap files are stored?

I’m usually fine with swap files being created in the same directory as the files being edited—I have the directory setting left on its default value. I have one project, though, with “file watching” functionality that gets confused by swap files. I…
bdesham
  • 2,983
  • 2
  • 18
  • 20
1
vote
1 answer

How to allow editing of a file from other sources while it's already open in vim?

Let's say I have a text file opened in vim. I'd like to be able to edit this file from bash, let's say with the command echo "text" >> file while the file is already opened in vim. Ideally, vim would just refresh the new content and wouldn't bother…
ChiseledAbs
  • 181
  • 5
1
vote
1 answer

edit file without swap file within a vim session

The only workaround I can come up with is after opening a vim session: :set updatecount=0 | e +setlocal\ noswapfile FILENAME | set updatecount& Are there any shorter vim commands or options that could achieve the same effect?
cychoi
  • 249
  • 2
  • 10
1
vote
2 answers

Swap file directory often ignored

I have this in my .vimrc: set directory=~/.vim/tmp-backup-swapfiles This directory is read- and writable by me, sensibly enough. It is part of the local filesystem and never inaccessible. However, vim seems to often ignore this and instead use…
goldilocks
  • 801
  • 6
  • 23
1
vote
1 answer

Extract list of outstanding changes from Vim swap file

I end up with swap files from crashed Vim sessions (typically ssh session timeouts) often enough, and I'm wondering if there is a way to determine exactly what changes are describe by the swap file. (I can remember what I was working on, but I don't…
1
2