0

Every time I open Vim and try to insert or when I open a file I encounter error:

E303: Unable to open swap file for "[No Name]", recovery impossible. 

I'm on Windows 11 and I don't think I encountered this error when I installed Vim! I think I should have right permission for the default swap file location because I didn't encounter this issue when I first installed vim and I am the only user. I also tried to change the swap file directory and it didn't make a difference. How do I make sure that I have write permission and does anyone have other suggestions

2
  • Google "Vim windows error 303". Commented Sep 7 at 10:51
  • Welcome to Vi and Vim. I rolled your question back to its last state before it contained a solution. You already did the right thing and posted an answer. You'll be able to accept your self-answer after 48 hours. Commented Sep 7 at 21:09

2 Answers 2

1

Check :h E303 where you will find information about why this error is generated.

 *E303* Unable to open swap file for "{filename}", recovery impossible ~ Vim was not able to create a swap file. You can still edit the file, but if Vim unexpectedly exits the changes will be lost. And Vim may consume a lot of memory when editing a big file. You may want to change the 'directory' option to avoid this error. This error is not given when 'directory' is empty. See |swap-file|. 

It might be that your directory setting has path that is not suitable/not available for writing. (no access rights?).

2
  • I started getting this error out of the blue. It doesn't go away even If I use set directory to C:\\tmp!! Commented Sep 7 at 13:09
  • 1
    @user57829 does C:\tmp exist? Does your user have write permissions? We only know what you tell us. You have to tell us about your environment so we can pinpoint the problem. Please edit your question to contain all additional information. Commented Sep 7 at 15:22
0

Upon further investigation it turned out I had copied an AI-made configuration for vim which had altered the swap file directory.

I just deleted the line and now everything works fine. I'm really sorry for the trouble and appreciate every comment.

I will make sure this doesn't happen again!!

1
  • 1
    It's the "copied an AI-made configuration" part that shouldn't happen again, for your own sake. Asking easily solved questions is not a problem. Commented Sep 7 at 19:08

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.