If you want to create a directory without closing the vim editor prompt because you have already edited the file and you don't want to lose changes. You may need to create the required directory or maybe you just need to correct the required path :-). In my case, I need to create the directory tmp inside the / home first to get rid of this " E21: can't open file for writing" error. This will not work and you will get errors. So if you will try to either create a new or edit the existing " sample.txt" file. In this scenario, the " tmp" directory inside /home doesn't exist. I am trying to run a command " vim /home/tmp/sample.txt" and getting this error " /home/tmp/sample.txt" E212: can't open file for writing" while saving it as shown in the image. $ sudo apt install vim How to Fix Vim can't open file for writing error Solution-1 Check the directory or path of file, create it if it doesn't existįirst thing first, if you are getting vim can't open file for writing error, check the path and directory of the file. Run the following command to install the package in Ubuntu. If you get the error: "Command 'vim' not found, but can be installed with:" it means you don't have vim (visual improved) editor installed. 6 Conclusion Install vim editor in Ubuntu, if not there already.4 How to fix even if "Root user can't open file for writing".3 How to fix etc/apt/sources.list" E212: Can't open file for writing.2 How to Fix Vim can't open file for writing error.1 Install vim editor in Ubuntu, if not there already.Let's deep dive and fix errors and it's causes one by one. Not enough space exists in your current partition or drive.Trying to write a network drive and you don't have access or partial access.Path of the file, you are trying to edit doesn't exist (non existing file, non existing directory).You don't have access or you are trying to edit a file, which is owned by root user.Possible causes of the above-mentioned issues. /etc/apt/sources.list" E212: Can't open file for writing.When you use Linux, you can get the below-mentioned error, while you try to edit a file. In this post, I will let you know all the reasons and solutions to fix the "Vim can't open file for writing" error. Most of the time, this error occurs due to insufficient rights or a directory path or file that doesn't exist, which you are trying to edit. Whether you are a novice or Pro Linux user, "E212" is the error code, you don't like seeing. Vim can't open file for writing error is one of the most common and frequent errors you will encounter, if you use Linux and vim editor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |