简体   繁体   English

E212:错误无法打开文件进行写入(VIM-.startup扩展名)

[英]E212: Error Cannot open file for writing (VIM - .startup extension)

I have look through various responses to similar questions but none of the solutions have helped me. 我已经浏览过对类似问题的各种回答,但是没有一种解决方案对我有帮助。

I am getting the error: 我收到错误消息:

"/pc1.startup" E212: Cannot open file for writing “ /pc1.startup” E212:无法打开文件进行写入

I understand you cannot open a .startup file in notepad and edit it then save it as the .startup extension but I am struggling with finding a way to write the changes to my hard drive. 我知道您无法在记事本中打开.startup文件并进行编辑,然后将其另存为.startup扩展名,但是我正在努力寻找一种将更改写入到硬盘的方法。 Nano also gives me the same issue. 纳米也给我同样的问题。 If anyone knows any solutions that would be appreciated. 如果有人知道任何解决方案,将不胜感激。

I would guess that "various responses" have brought these up already, but for lack of detail I can only state the obvious: 我猜想“各种响应”已经提出了这些建议,但是由于缺乏细节,我只能说显而易见的:

Editors (mostly) don't care for file extensions, but the location matters a lot. 编辑器(大多数)不关心文件扩展名,但是位置很重要。 As you're attempting to write to the root directory ( / ), you need to be root to be allowed to write there. 在尝试写入根目录/ )时,您必须是root用户才能被允许在其中写入。

As I don't understand why a *.startup file needs to be there, it would be best to store it elsewhere. 由于我不明白为什么需要*.startup文件,因此最好将其存储在其他位置。 In Vim, you can do this via :saveas ~/pc1.startup (choosing your home directory instead). 在Vim中,您可以通过:saveas ~/pc1.startup (选择主目录 )来完成此操作。 If it needs to be there, launch Vim as the root user with sudo vim /pc1.startup instead. 如果需要安装,请以root用户身份使用sudo vim /pc1.startup启动Vim。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM