如何为Vim中的每个选项卡提供不同的缓冲区列表?

Ste*_*ato 4 vim tabs minibuffer

是否有可能将缓冲区列表"附加"到Vim中的特定选项卡?我目前正在使用MiniBufferExplorer,它显示了很好的选项卡中的所有缓冲区.它可以使用标准vim选项卡进行组合,但插件的缓冲区列表包含所有缓冲区,使用选项卡变得有点无用.这是我想要的一个例子:

选项卡A包含以下缓冲区列表:

  • FILEA
  • FILEB
  • FileC

选项卡B包含以下缓冲区列表:

  • 提交
  • FileE
  • FileF

目前我拥有的是:

选项卡A包含缓冲区列表

  • FILEA
  • FILEB
  • FileC
  • 提交
  • FileE
  • FileF

选项卡B包含以下缓冲区列表:

  • FILEA
  • FILEB
  • FileC
  • 提交
  • FileE
  • FileF

当谈到"缓冲区列表"时,我指的是列出迷你缓冲区插件的选项卡.

任何解决方法来实现这一目标?

mic*_*ael 5

我不能想到任何基于Tab的缓冲区探测器,但vimscript有很多跟踪缓冲区的函数(:他的函数列表).我只是把它打倒了.它可能会让你达到你想要的.它只是跟踪vim字典中的选项卡.你需要充实:TabExplorer函数或将过滤后的列表(即g:TabExplorer [tabpagenr()])修补到minibuf插件中

将其保存为〜/ .vim/plugin/tabexplorer.vim并在启动时获取它.

let g:TabExplorer = {}

func! StoreBufTab()
    if !has_key(g:TabExplorer, tabpagenr())
        let  g:TabExplorer[tabpagenr()] = []
    endif

    if index(g:TabExplorer[tabpagenr()], bufname("%")) == -1 && bufname("%") != ""
        call add (g:TabExplorer[tabpagenr()],bufname("%"))
    endif
endfunc

func! DisplayTabExplorer()
    4split
    enew
    call append(".",g:TabExplorer[tabpagenr()])
endfunc

au BufEnter * call StoreBufTab()

command! TabExplorer call DisplayTabExplorer()
Run Code Online (Sandbox Code Playgroud)