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.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

saving a .v file triggers it to be opened in another window and gets E:325 in neovim

After trying to save a .v file, it triggers a new window to be opened with e:325 error with swap file already exists. This only happens to .v files. This only happens when neovim is opened from that ...
0
votes
0answers
26 views

vimrc post buffer bash script

I have a script that is called when I open a file with fileA extension in vim: autocmd BufWritePost *fileA !/usr/bin/named_check_vim %:p script named_checkvim checks for errors in a file, if errors ...
0
votes
1answer
60 views

How to recover unsaved text without a swap file after Vim crashed?

I am using Vim 8 in WSL Ubuntu. While copying text into a file the terminal crashed. I don't believe it is the WSL as Task Manager does not show 'Not Responding'. I have tried using this answer which ...
1
vote
1answer
42 views

simultaneous “vi <(command)” in macOS

In macOS Catalina, from Terminal, bash, vim 8.1, I launch vi <(command1) to see the output of a command. From another terminal, I launch another vi <(command2). Then vim complains that it's ...
6
votes
1answer
72 views

How can I view the name of the swapfile being used for the current buffer?

Let's say I recovered a bunch of swapfiles in quick succession: gvim -r .swv gvim -r .swu gvim -r .swt And then cycled through them all a few times before finding that one of them was nonsense. I ...
6
votes
1answer
519 views

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

Disable E303 warning when swap directory isn't writeable

I sometimes run vim as another user than me, using my own vimrc. In this case the swp and undo directory aren't writeable, and vim warns me with E303. I don't care about not having swap file in this ...
0
votes
1answer
452 views

Auto-Deleting Swaps, Backups and Undos while Quitting vim?

Cluttering Swaps and Backups that I never use are so annoying and takes up unnecessary space. Is there a way to delete them as one quits vim with :q and similar quitting commands?
0
votes
0answers
94 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
91 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
295 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
149 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
135 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
770 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 ...
2
votes
0answers
608 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/...
16
votes
2answers
5k 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
38 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 ...
13
votes
3answers
5k 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 ...
3
votes
0answers
3k 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 ...
6
votes
1answer
1k 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 ...
4
votes
0answers
1k 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
75 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” ...
6
votes
1answer
5k 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
2answers
3k 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 ...
3
votes
2answers
962 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
439 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
260 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
2k 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
40 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
782 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 ...
5
votes
4answers
27k 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
119 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 ...
2
votes
2answers
226 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
780 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
863 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 ...
11
votes
2answers
2k 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,...
5
votes
1answer
2k 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
368 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
912 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 ...
23
votes
2answers
3k 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
2k 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-...
14
votes
2answers
2k 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
412 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 ...
88
votes
1answer
51k 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 ...