vim “可修改”已关闭
我正在尝试使用 NERDTree 创建一个新文件。我按 a 键创建一个新文件,然后收到消息:
E21:无法进行更改,“可修改”已关闭
我正在将 MacVim 与 Janus 一起使用(几乎开箱即用)。
I am trying to create a new file with NERDTree. I hit the a key to create a new file and I get the message:
E21: Cannot make changes, 'Modifiable' is off
I'm using MacVim with Janus (almost out of the box).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这是
will make a buffer 可修改的缩写。并
做相反的事情。
which is short for
will make a buffer modifiable. And
does the opposite.
我不熟悉 NERDTree,但我猜想通过在 NERDTree 视图中键入 a ,它会被解释为“我想向 NERDTree 缓冲区追加一些内容”,但该缓冲区不可修改。
您可以查看这个答案vim and NERDTree extension - opening a file,它解释了如何使用 NERDTree 添加文件。
I am not familiar with NERDTree but I guess that by typing a in a NERDTree view, it is interpreted as "I want to append something to the NERDTree buffer", but that buffer is not modifiable.
You can check out this answer vim and NERDTree extension - adding a file which explains how to add a file with NERDTree.
这对我有用:
This worked for me:
如果你想在 NERDTree 中生成一个文件,你需要点击“m”(菜单)然后点击“a”。
简单地在 NERDTree 缓冲区中输入“a”将被解释为“修改 NERDTree 缓冲区”。
添加 :ma 将使 NERDTree 缓冲区可修改,但这不会为您创建新文件,它将导致 NERDTree 显示的内容和实际文件层次结构之间的信息不一致。
If you want to happen a file in NERDTree, you need to hit "m" (for menu) then "a".
Simply entering "a" in NERDTree buffer will be interpreted as "modify NERDTree buffer".
Adding :ma will make NERDTree buffer modifiable, but this wont create new files for you, it will lead to inconsistent info between what NERDTree display and your actual file hierarchy.
好吧,这可能不是最明智的答案,因为我几乎没有 vim 或 linux 的工作知识,但我已经找到了解决我的问题的方法,它可能对你有用。具体来说,我的问题有两个:
1)每当我尝试在我创建的新文件中编辑某些内容时,我都会收到“无法进行更改,‘可修改’已关闭”错误,并且...
2)运行 :set modulated 并尝试后要保存,我会收到“无法写入,buftype 已设置”的 e382 错误。所以我无法保存。
在翻阅了大量无用的神秘文档后,我发现了这一点:
1)找到 .vimviews 目录,对我来说它位于我的 git 存储库的根目录下,
在其中执行一个操作。我得到这样的东西:
这对你来说完全没用,因为你有不同的文件结构。但请查找给您带来问题的文件。 (哦顺便说一句,这些实际上是文件名,通过查看它们完全不明显)。找到有问题的文件并删除那个傻瓜:示例:
问题已解决。
Ok, this may not be the most informed answer as I barely have a working knowledge of vim or linux, But I have found to solution to my problem and it may work for you to. To be specific, My problem was twofold:
1) whenever i tried to edit something in this new file i created, i got the Cannot make changes, 'Modifiable' is off error and...
2) after running :set modifiable and trying to save, i would get an e382 error of 'cannot write, buftype is set. so i couldn't save.
After pouring throuch scads of useless cryptic documentation i figured out this:
1) find the .vimviews directory, for me it was at the root of my git repository, do an
inside it. i got something like this:
Which is totally useless to you since you have a different file structure. but look for the file that is giving you the problem. (oh btw, these are in fact file names, which is completely not obvious by looking at them). find the one that has the file in question and delete that sucker: example:
Problem solved.
如果其他人碰巧通过 google 搜索到此内容,请检查您是否没有像我一样尝试在 vim 中打开目录(d'oh)
In case anyone else happens to google to this, check that you're not trying to open a directory in vim like I just was (d'oh)
对我来说,我已经隐藏了更改,其中包括一个目录,然后我试图在刚刚隐藏的目录中创建一个文件。 NERDTree 仍然显示带有该目录的预先隐藏的树。在不存在的目录上使用
m
会产生可修改的错误。我应该使用r
刷新树以查看该目录不再存在以及为什么无法修改它。For me, I had stashed changes which included a directory I was then trying to create a file in that dir I had just stashed. NERDTree was still showing the pre-stashed tree with that dir. Using
m
on a dir that does not exist produced the modifiable error. I should have refreshed the tree withr
to see the dir was no longer there and why it could not be modified.