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 being freed was not allocated), and after that I tried to edit it again, the following dialog is shown.

Swap file "~/.local/share/nvim/swap//%Users%me%.config%nvim%init.vim.swp" already exists!

[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

However, it seems that all of the options I choose lead to the same crash and recover loop, so I tried to delete all the swap files.

cd ~/.local/share/nvim/swap
rm -rf *

The swap files are all gone, but even after that, when I tried to open the file, edit, and save it, the same crash occured, and then the swap file is created and the same recovery mode is shown on the next launch.

How can I discard the swap and regain my editing capability without installing it again?

  • 4
    You've already used two methods to delete the swap files (through the prompt and manually). That isn't the problem here, so your title is misleading. This should probably be a bug report for either your distribution or for neovim proper, depending on the version of neovim you're using. Neovim shouldn't be crashing and that is the problem, not the swap files.
    – jamessan
    Feb 11, 2018 at 16:29
  • @blaszard did you happen to log a bug for this? I'm running neovim 0.7.2 on macOS and get this all the time if I try to :wa (:w is fine).
    – turboladen
    Aug 26, 2022 at 15:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.