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.
57
questions
0
votes
1
answer
42
views
Run a Vim command _after_ loading vimrc, but _before_ opening the file?
Is there a way to tell Vim from command line to run a specific command after running the vimrc, but before loading a file?
E. g.
vim --cmd <cmd> <file> runs <cmd> before loading ...
0
votes
0
answers
23
views
Recovery doesn't recover what's in swap file
I have a file and three swap files, file.swn, file.swo and file.swp. I accidentally recovered using file.swp and then made some changes. However, I have some newer changes in file.swn which I'd like ...
0
votes
0
answers
51
views
Vim 9.0.1420 update: opening the same file twice without warning message is unfortunately now possible?
I observed that in the recent update for Vim, specifically vim 9.0.1420, it is now possible to create a text file, open it, and then open the same file through another terminal window without ...
0
votes
1
answer
46
views
Not getting swapfile warning anymore. shortmess=filnxtToOFA
For the last few weeks I have noticed that neovim is not warning me when a file is already opened in another instance, like it used to. I find this useful in keeping organised and stopping me from ...
1
vote
1
answer
24
views
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. (...
2
votes
2
answers
151
views
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 ...
0
votes
1
answer
539
views
"Unable to open swap file for 'Makefile', recovery impossible" for every edited file in vim
Upon editing any file I am now seeing this:
In order to isolate this I have deleted all of the contents of ~/.vim or ~/.vimrc. I then consulted note here and recreated the `~/.vimrc with these ...
3
votes
1
answer
84
views
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 ...
0
votes
0
answers
77
views
How to disable "E768 swap file exists warning"
I get this annoying message when I write file (using write). How can I disable it?
E768: Swap file exists: c:\users\ekarni\.vim\swap\template.py.swp (:silent! overrides)
Since I did silent! ...
3
votes
0
answers
486
views
How do I recover a specific swap file?
Last night I wrote a short piece the saved saved and exited (:wq). Then the goat-rope of trying to recover what apparently seemed to vanish stated. Since it was about 3 AM and I was getting no where, ...
0
votes
1
answer
100
views
Neovim autoupdating file in multiple terminal buffers, not warning with swap
I've been noticing some rather confusing behavior in my neovim setup and I'm really not even sure if it's a problem, just a feature that surprised me.
I recently noticed that the classic "This ...
1
vote
1
answer
115
views
How can I stop vim from moving / deleting a file just before saving?
When I save a file in vim, it does following operations:
$ inotifywait -r -m -c src/
src/,CREATE,4913
src/,OPEN,4913
src/,ATTRIB,4913
src/,"CLOSE_WRITE,CLOSE",4913
src/,DELETE,4913
src/,...
0
votes
0
answers
38
views
Check if any vi process is editing a file, or swapfile exists?
I'm writing a script to ensure that everything I work on on my system is committed, pushed to Git etc. I'd also like to check if there are any vim swapfiles active (either in a running Vim, or from ...
0
votes
1
answer
174
views
Why are empty files with names as 4 digits being generated by VIM?
I've been using VIM on a virtual machine running Kali Linux to write python scripts on a shared folder on my Windows 10 host operating system, but these empty files with names as 4 digits keep being ...
1
vote
0
answers
20
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
1
answer
650
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
1
answer
98
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 ...
8
votes
1
answer
271
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 ...
11
votes
1
answer
1k
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
0
answers
213
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 ...
2
votes
1
answer
1k
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
0
answers
256
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 ...
1
vote
1
answer
147
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
2
answers
877
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
2
answers
186
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 ...
2
votes
0
answers
279
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
1
answer
1k
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 ...
3
votes
0
answers
2k
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/...
29
votes
2
answers
13k
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
1
answer
67
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 ...
21
votes
4
answers
11k
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 ...
5
votes
0
answers
8k
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 ...
8
votes
1
answer
2k
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 ...
7
votes
2
answers
2k
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
2
answers
111
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” ...
9
votes
3
answers
11k
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 ...
3
votes
2
answers
5k
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
2
answers
5k
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, ...
1
vote
0
answers
723
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
2
answers
388
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
1
answer
3k
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
1
answer
45
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
1
answer
1k
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 ...
10
votes
5
answers
50k
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....
4
votes
1
answer
194
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 ...
3
votes
2
answers
1k
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
2
answers
1k
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
1
answer
1k
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 ...
13
votes
2
answers
3k
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,...
8
votes
1
answer
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 ...