Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
19 views

make vim produce patch files without editing originals

I want to edit text files with vim, I would love vim file.txt To work like normal, and open file.txt in vim, like normal, and allow me to edit it seemingly like normal. The only difference is, all ...
0
votes
1answer
44 views

Why is my small SQL comment not backed up in the .swp file?

Problem: The changes I make in files before closing are not saved in .swp files As I understand it, the swap file should save any changes if they are at least 200 characters long or nothing has been ...
1
vote
2answers
80 views

Why are swap files so big?

I open a file with vim, vim creates a swap file. Though I have not done any single edit on my file, the swap file has significant size, sometimes bigger than the size of the original file. For ...
0
votes
2answers
63 views

Minimal swap file use or deleting only swapfiles without changes

When I lose power, I have a lot of maybe-useful swap files (4 vim instances running now, 103 swap files currently in ~/.cache/vim/swap). I am fine with manual recovery of swapfiles with changes - I'd ...
1
vote
0answers
67 views

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 ...
0
votes
1answer
196 views

Swapfile issues with vim when using remote Windows 10 SMB Share?

I'm using vim on a Linux machine to write to a Windows 10 share and vim keeps slowing down and giving an error at the status line of E297: Write error in swap file. When I went into the directory to ...
1
vote
0answers
116 views

How to recover from swap files correctly on Neovim?

My Mac crashed and was forced to restart. So I opened Terminal, try recovering the file, but struggle to correctly recover the file. Specifically, I tried the following command: nvim ~/.config/nvim/...
12
votes
2answers
999 views

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 ...
0
votes
1answer
35 views

Discover which other user(s) are accessing a file

Every time I vim open, I get the standard warning about another user, swap file already exists, abort/quit/.., etc. I've been trying for at least 2 hours, and I'm sure I don't have the file open ...
1
vote
1answer
916 views

How do you view the diff of a swap file without quitting `vim`?

I have a way to handle swap files. And it works but it takes a while. Here goes: First I try to find the original vim session -- track down if the PID is still alive -- and if the PID is still ...
1
vote
0answers
783 views

How to delete swap files on neovim?

While editing a file my neovim crashed when I tried to save the file (with the error message "init.vim" 77L, 2423C writtennvim(5888,0x7fffa9f29340) malloc: *** error for object 0x7f861301d400: pointer ...
5
votes
1answer
439 views

Automatically delete swap file if it matches the saved file

As a developer who grew up on hardware with no MMU I have a habit of saving my work often, usually after every insert. Thus, when presented with the recovery dialogue after a crash or disconnect there ...
2
votes
0answers
568 views

Vim error: Unable to open swap file when using backslash as path separator in Windows shell

I'm using cmder as my Win7 shell. I see the following behaviour: Works fine (file in current directory): vim test Works fine (absolute path): vim ~/test Works fine (relative path with forward ...
2
votes
2answers
60 views

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” ...
5
votes
1answer
2k views

How to resolve E303 (Unable to open swap file) on Linux machine?

I get E303 (Unable to open swap file for "{filename}", recovery impossible) when I open a file in vim in my Ubuntu system. I see that the backupdir and directory environment variables are set ...
1
vote
1answer
630 views

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 ...
0
votes
1answer
233 views

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, ...
0
votes
0answers
245 views

Unable to recover .swp file

My computer crashed while in the middle of editing several vim files. Upon reboot, two of the files getting edited showed a file size 0 bytes. I was able to recover one of the .swp files with the :...
1
vote
2answers
162 views

.swp swap files for directories while browsing with netrw

Sometimes I browse around the directory of the current buffer by using :Ex. On one of my development machines, this results in a .swp file being created in every directory I visit. I've checked the ...
9
votes
1answer
426 views

Can a text file be recovered only from the .*.swp file?

I was remotely editing a new file: man-01-Intro.txt but the machine went down before I wrote it to disk so only the swp version was conserved. Is there anything that I can do to recover the work ...
1
vote
1answer
26 views

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

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 ...
1
vote
1answer
431 views

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 ...
4
votes
3answers
14k views

“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....
3
votes
1answer
93 views

Swap choices: how can I “skip” instead of “quit” or “abort”?

Swap file ".file.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: I usually see this message when I accidentally :edit the wrong file, i.e., one which I'm already ...
1
vote
1answer
102 views

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 ...
1
vote
1answer
612 views

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, ...
4
votes
1answer
628 views

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 ...
10
votes
2answers
1k views

How to detect whether swp files contain unsaved changes?

When editing source code using gvim (v.7.4.488), I want to commit some changes the vcs (I'm using git 2.1.4 from the command line in Ubuntu linux). git --status shows which files I changed. However,...
3
votes
1answer
740 views

Why does `set nocompatible` result in vim saving extra, all-numeric temporary files?

I've narrowed down a bug in a program I'm working on to (surprisingly) some vim behavior! The program contains a file watcher. When I write a file with vim -u NONE and all the default settings, the ...
3
votes
1answer
297 views

specifying a recovery file in nvi

I have an nvi session that got interrupted, and I'd like to recover my edits. When I type vi -r, it tells me "no files to recover." But there is a recovery file in /var/tmp/vi.recover, and when I ...
5
votes
1answer
601 views

Disable swap file for large files [duplicate]

I normally like to keep swap files on, but if I am editing huge log files I usually don't want them. Since I am just viewing the files in vim, it is unnecessary to have a swap file. I could just run ...
22
votes
2answers
2k views

What's the difference between “quit” and “abort”?

When I try to open a file from multiple vim instances, I get an error with several options: Swap file "~/.vim/tmp/file.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:...
3
votes
1answer
1k views

Vim Windows creating temporary files [duplicate]

I am using Vim on windows. Any time I edited a file, Vim is created temporary files. When I created a file, mysql-build-properties.xml Vim is creating files like these: mysql-build-...
12
votes
1answer
1k views

Does Vim autosave?

From :help swap-file: Updating the swapfile The swap file is updated after typing 200 characters or when you have not typed anything for four seconds. This only happens if the buffer was ...
13
votes
2answers
214 views

Raise window holding swap file

From time to time while working on multiple projects, and / or what ever, it leaves me with (too) many Vim instances open – as happens, I open a file which already is opened elsewhere, leaving me with ...
62
votes
1answer
26k views

What is the purpose of swap files?

When I edit files, Vim tends to create files named .filename.swp, which I find annoying. From vim -h, I see that the -n option suppresses the creation of swap files. Is there a vimrc directive that ...