Closed jinyius closed 2 years ago
"../Makefile" 44L, 1687B
Error detected while processing BufWinEnter Autocommands for "*"..function recover#CheckSwapFileExists[8]..<SNR>67_SetSwapfile:
line 3:
is that the whole error message? I am wondering, because Line 3 is actually this one:
Not sure what goes wrong there. Try to remove the :sil
or change it to :sil!
to ignore the error. Don't know if this helps.
removing the sil
so it's just the setl... causes the error to continue to be thrown.
making it sil!
causes things such that starting up to open the file never completes unless you hit ^C to break. i then tried using setl!
but it also does nothing.
what should be the behavior when a swp file exists due to the file already being open?
I don't understand. of course it doesn't help. I'd like to see the whole output, something causing the error. So if you manually do :setl noswapfile swapfile
do you see an error message? Perhaps there is already another swapfile lying around? Or another SwapExists autocommand is triggered? I don't know yet.
what should be the behavior when a swp file exists due to the file already being open?
the idea is to close and re-open the swapfile, because it could have changed.
here's what i did for your last message:
:setl noswapfile swapfile
E325: ATTENTION
Found a swap file by the name "~/.vim/tmp//%Users%user%.dotfiles%.zshrc.swp"
owned by: user dated: Thu Nov 18 08:50:09 2021
file name: ~user/.zshrc
modified: no
user name: user host name: xxx
process ID: 29984 (STILL RUNNING)
While opening file ".zshrc"
dated: Tue Sep 21 09:22:54 2021
(1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r .zshrc" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/Users/jin/.vim/tmp//%Users%user%.dotfiles%.zshrc.swp" to avoid this message.
Press ENTER or type command to continue
using the "Edit anyway" option yields the same result. choosing Recover only causes the noswap/swap local setting to pass w/o error.
I'm having this problem as well. On my system, it looks like the problem is in s:Swapname()
:
The return a[:1]
cuts off the leading /
, changing /Users/me/myfile.txt
to Users/me/myfile.txt
. Then filereadable()
is 0:
and the setl
command to reset the swapfile
barfs as reported above.
I'm not clear on why the [1:]
is there, but one fix is to change line 28 to
return a[0] ==# '/' ? a : a[1:]
ah, that trim removes the leading \n
that is out there and is also there when using redir
. Can you create a PR for that change? Simply change the condition a[0] ==# '\n' ? a[1:] : a
been using this plugin happily for awhile, but it stopped working on my mbp. here's the output when trying to open an already open file (shows the E325 error and the swap file options are the typical ones):
macOS 12.0.1 vim --version (system /usr/bin/vim)