1

检查以下屏幕截图:

Vim 截图

我检查了我所有的插件/捆绑包,我使用Vundle而不是 Pathogen。这是我的捆绑清单:

" This one is required baby!
Bundle 'gmarik/vundle'

" All of my Vundle bundles
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
Bundle 'mattn/zencoding-vim'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-markdown'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'spf13/PIV'
Bundle 'vim-scripts/YankRing.vim'
Bundle 'jeffkreeftmeijer/vim-numbertoggle'
Bundle 'PotHix/Vimpress'
" Color schemes
Bundle 'altercation/vim-colors-solarized'

我只是拉动了我的 vimrc 文件,以防你没有注意到。我不知道这些会改变缓冲区行为,但我可能弄错了。

如何删除这种类似标签的功能?要重现它,只需打开一个文件,然后抓取其他文件,并将它们拖到 Vim 窗口(不是图标,窗口)的顶部。

4

2 回答 2

2

Vim 可以创建选项卡,但默认情况下不显示选项卡:创建选项卡时才会创建选项卡,如果您不告诉它这样做,Vim 将不会创建选项卡。

如果您不想要标签,请不要使用它们。就是这么简单。

从您的评论来看,您似乎将 Vim 的选项卡与您在其他编辑器中可能习惯的选项卡混淆了。乍一看,它们可能“看起来”相同,但它们的目的和实现却大不相同

在 Vim 中,选项卡是组织工作区的一种方式:它们不代表也不能代表单个缓冲区。如果您想在 Vim 中使用制表符,了解这一点非常重要。你需要大量的自律才能真正将 Vim 选项卡用作 TextMate/Sublime 选项卡。如果你理解它们,你应该只使用它们。

在 Vim 中处理多个文件的正确方法是使用缓冲区和窗口以及正确的命令。但是,如果您真的想使用标签,这里有一些提示:

首先将此行添加到您的~/.vimrc

set switchbuf=useopen,usetab

使用此设置,许多操作(特别是在快速修复中)会将您跳转到它所在的缓冲区(在另一个窗口或另一个选项卡中),而不是在此处加载缓冲区。

然后你应该使用正确的命令:

:sb[uffer]
:sbn[ext]
:sbN[ext]
:sbl[ast]
:sbf[irst]
:sbr[ewind]

如果它显示在某处在拆分中打开它,所有这些命令都会跳转到它所在的缓冲区。

从那里您现在可以执行以下操作:

:e file_a
(editing file_a)
:tabe file_b
(editing file_b in tab 2)
:sbN
(editing file_a in tab 1)
:sbn
(editing file_b in tab 2)
…

不会在多个选项卡中使用相同的缓冲区。

当您了解选项卡作为工作区的真实性质而不是切换到另一个文件的方式时,才应使用与选项卡相关的动作,如gt,:tabl或。:tabn2

于 2012-11-17T08:35:24.687 回答
1

编辑找到了一个更有效的设置:

set tabpagemax=1 showtabline=0

在你的 $MYVIMRC 里面

文件:

                        *'showtabline'* *'stal'*
'showtabline' 'stal'    number  (default 1)
            global
            {not in Vi}
            {not available when compiled without the |+windows|
            feature}
    The value of this option specifies when the line with tab page labels
    will be displayed:
        0: never
        1: only if there are at least two tab pages
        2: always
    This is both for the GUI and non-GUI implementation of the tab pages
    line.

                        *'tabpagemax'* *'tpm'*
'tabpagemax' 'tpm'  number  (default 10)
            global
            {not in Vi}
            {not available when compiled without the |+windows|
            feature}
    Maximum number of tab pages to be opened by the |-p| command line
    argument or the ":tab all" command. |tabpage|
于 2012-11-16T23:09:25.813 回答