Vim error E303: Unable to open swapfile for "filename", recovery impossible

When I open or create any file via vim as a user I get this error: “E303: Unable to open swapfile for “filename”, recovery impossible”, I don’t get this error when running vim as root or sudo, this is a fresh install of EndeavourOS with lxqt DE. I tried removing current swapfile and creating a bigger one.

Here’s my ´inxi -FAZ --no-host | eos-sendlog´ output: https://0x0.st/X5_V.txt

The vim swap file is nothing to do with the system swap, it’s specifically for the use of the vim editor.

It sounds like you have a permission issue with the swap file location, you don’t have write access. The article I linked to shows how to set the location to somewhere with correct permissions.

1 Like

Thanks for the reply, I went through the article you linked, I believe these are commands to set the location:

$ mkdir ~/.vim/temp
$ touch ~/.vimrc
$ echo "set directory^=$HOME/.vim/tmp//" >> ~/.vimrc

They don’t fix the issue, I don’t know where is the location with correct permissions. I never had this issue with vim on other distributions.

If it’s in your home directory you should have the necessary permissions. However, I have just noticed a potential problem with the commands:

  • The first one uses temp
  • The second one uses tmp

They should be the same, maybe that’s why it didn’t fix it?

1 Like

Yes, I changed “tmp” to “temp” and now vim doesn’t show this error. However this doesn’t look like something you have to do after installing vim, something’s still not right either with vim or this distro.

It was probably already set up in the other distro.

The other distros were Arch Linux and Lubuntu, didn’t have this issue after installing vim on either of those

While launching vim doesn’t throw any errors, executing :wq command throws this error ““text” E510: Cannot make backup file (add ! to write anyway)”

Try adding the following to your .vimrc

set backupdir=$HOME/.vim/temp/

or

set nobackup

to turn off backups. It looks to me like you’re going to configuring vim from scratch. Welcome to the learning curve :disappointed_relieved:

1 Like

adding this to .vimrc did the job!

set backupdir=$HOME/.vim/temp/

I don’t really like this solution, there’s probably an underlying issue at place because as I said this was never a thing on other distributions as well as this one, maybe something is wrong with lxqt flavor, but oh well.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.