问题描述
是否可以将缓冲区列表附加"到 Vim 中的特定选项卡?我目前正在使用 MiniBufferExplorer,它在漂亮的选项卡中显示所有缓冲区.它可以使用标准的 vim 选项卡组合,但插件的缓冲区列表包含所有缓冲区,使用选项卡变得有点无用.这是我想要的示例:
Is it possible to kind of "attach" a list of buffers to particular tabs within Vim? I am currently using MiniBufferExplorer, which shows all buffers in nice tabs. It can be combined using standard vim tabs but the plugin's buffer list contains all the buffers and using tabs become a bit useless. Here's an example of what I'd like:
选项卡 A 包含以下缓冲区列表:
Tab A contains a buffer list of:
- 文件A
- 文件B
- 文件C
标签 B 包含一个缓冲区列表:
Tab B contains a buffer list of:
- 文件目录
- 文件E
- 文件F
目前我拥有的是:
标签 A 包含一个缓冲区列表
Tab A contains a buffer list of
- 文件A
- 文件B
- 文件C
- 文件目录
- 文件E
- 文件F
标签 B 包含一个缓冲区列表:
Tab B contains a buffer list of:
- 文件A
- 文件B
- 文件C
- 文件目录
- 文件E
- 文件F
当谈到缓冲区列表"时,我指的是列出迷你缓冲区插件的选项卡.
When speaking about "buffer list" I mean the tab listing the minibuffer plugin gives.
有什么解决方法可以实现这一目标吗?
Any workaround to achieve this?
推荐答案
我想不出任何基于 Tab 的缓冲区浏览器,但 vimscript 有很多函数来跟踪缓冲区 (:he function-list) .我只是把它搞砸了.它可能会让你得到你想要的.它只是跟踪 vim 字典中的标签.您需要充实 :TabExplorer 函数或将过滤后的列表(即 g:TabExplorer[tabpagenr()])修补到 minibuf 插件中
I cant think of any Tab based buffer explorers out there but vimscript has got plenty of functions to track of buffers (:he function-list) . I just knocked this up for the hell of it. It might get you to what you want . It just keeps track of tabs in a vim dictionary. You will need to flesh out the :TabExplorer function or patch the filtered list (ie. g:TabExplorer[tabpagenr()]) into the minibuf plugin
另存为 ~/.vim/plugin/tabexplorer.vim 并在启动时获取它.
Save it as ~/.vim/plugin/tabexplorer.vim and source it at startup.
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()
这篇关于如何为 Vim 中的每个选项卡设置不同的缓冲区列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!