如何关闭vim中的选项卡?

ore*_*iss 18 vim

当我:tabnew myfile在vim中使用它时会打开一个新选项卡.

当我退出选项卡 :q并移动到另一个选项卡时:bn,选项卡仍然存在.

有人可以解释为什么以及如何真正关闭它?

ams*_*ams 27

你可以用:tabclose.

阅读更多内容:help tabpage.


对于回来的缓冲区:bn,我认为这对于"隐藏缓冲区"来说是正常的,并且:bn当你经过最后一个缓冲区时会回绕到第一个缓冲区.

看到 :help buffer-hidden

  • 这可能无法直接回答OP的情况,但它准确地回答了他们的标题提出的问题,也是大多数来到这里的人所需要的。+1 (3认同)

Mar*_*rth 19

你正在混合标签和缓冲区.选项卡只是一种显示缓冲区的方式,关闭它不会对它们执行任何操作.

如果要从缓冲区列表中删除缓冲区,请使用:bd.从帮助:

:[N]bd[elete][!]            *:bd* *:bdel* *:bdelete* *E516*
:bd[elete][!] [N]
        Unload buffer [N] (default: current buffer) and delete it from
        the buffer list.  If the buffer was changed, this fails,
        unless when [!] is specified, in which case changes are lost.
        The file remains unaffected.  Any windows for this buffer are
        closed.  If buffer [N] is the current buffer, another buffer
        will be displayed instead.  This is the most recent entry in
        the jump list that points into a loaded buffer.
        Actually, the buffer isn't completely deleted, it is removed
        from the buffer list |unlisted-buffer| and option values,
        variables and mappings/abbreviations for the buffer are
        cleared.
Run Code Online (Sandbox Code Playgroud)

  • @Jin:`:windo bd`应该做你想做的事. (4认同)
  • 如果我有一个带有多个缓冲区的“标签”怎么办?例如,一个选项卡在垂直拆分中并排两个缓冲区。是否有单个命令关闭与选项卡关联的所有缓冲区? (2认同)