How to have a different buffer list for each tab in Vim?

Is it possible to "bind" a list of buffers to specific tabs in Vim? I am currently using MiniBufferExplorer , which shows all buffers in good tabs. It can be combined using standard vim tabs, but the plugin's buffer list contains all the buffers and using tabs becomes a little useless. Here is an example of what I would like:

Tab A contains a list of buffers:

  • Filea
  • FILEB
  • Filec

Tab B contains a list of buffers:

  • Filed
  • Filee
  • Filef

I currently have the following:

Tab A contains a list of buffers

  • Filea
  • FILEB
  • Filec
  • Filed
  • Filee
  • Filef

Tab B contains a list of buffers:

  • Filea
  • FILEB
  • Filec
  • Filed
  • Filee
  • Filef

Speaking of the "buffer list", I mean that the tab containing the minibuffer plugin gives.

Any workaround to achieve this?

+4
source share
1 answer

I don’t think of any Tab-based buffer contributors, but vimscript has many functions for tracking buffers (: it is a list function). I just knocked it to the end. This can lead you to what you want. It just keeps tabs in the vim dictionary. You will need to execute the function: TabExplorer or fix the filtered list (for example, g: TabExplorer [tabpagenr ()]) in the minibuf plugin

Save it as ~ / .vim / plugin / tabexplorer.vim and enter 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() 
+5
source

Source: https://habr.com/ru/post/1301990/


All Articles