我在 vim 中创建了一个空白的“临时缓冲区”(即不与特定文件关联),方法是使用:vnew
。然后我玩了一些文本,现在我只想退出编辑器 - 不保留这个“临时缓冲区”的内容。
当我输入命令时:
:q!
Vim 给我:
[No Name][+]
E37: No write since last change (add ! to override)
E162: No write since last change for buffer "[No Name]"
Press ENTER or type command to continue
我怎样才能让vim退出这个状态呢?
当您修改了隐藏缓冲区时会发生这种情况。使用:qa!
无论如何都要退出。
From :h :quit
:
:q[uit]! Quit without writing, also when currently visible
buffers have changes. Does not exit when this is the
last window and there is a changed hidden buffer.
In this case, the first changed hidden buffer becomes
the current buffer.
Use ":qall!" to exit always.
如果有人想复制它:
- 启动vim并修改未命名缓冲区
- 编辑另一个文件(您可能需要
:set hidden
), ie :e README
- 尝试退出
:q!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)