17

I'm surprised that I haven't been able to find an answer to this, but maybe I'm missing something obvious: is it possible to keep a buffer list per window? I often have around 4 splits, and each one typically serves a specific purpose: CSS in one, JS in another, HTML in a few others, etc.

What I'm probably looking for is a plugin that accomplishes this. Lately I've been using BufExplorer, which does have a setting allowing you to keep its list of buffers per tab, but not per window.

I really like the MRU listing that BufExplorer has, but I find it annoying that it's based on my global list of buffers - what I want is a MRU history per window.

1
  • You can't find it because it hasn't yet been built. Most nearest-neighbors are identified in this Q & A Aug 25, 2012 at 17:36

5 Answers 5

1

IMHO, What you really need is a Work Space manager.

you can find one for vim @ http://www.vim.org/scripts/script.php?script_id=1410

It will provide you following commands:

:WsAddFile              Add a new file to the workspace.                  
:WsAddGroup             Add a new group to the workspace.                 
:WsClose                Close the workspace window.                       
:WsInsertFile           Insert a file.                                    
:WsInsertGroup  Insert a group.                                           
:WsOpen         Open a workspace and display it in a window.              
:WsRun          Run a command using the selected unquoted file names.     
:WsRunq         Run a command using the selected quoted file names.       
:WsSave         Save the workspace.                                       
:WsSessionOpen  Open the workspace and Vim session.                       
:WsSessionSave  Save the workspace and the Vim session.                   
:WsToggle               Open or Close the workspace window. 

I've a screen shot of working with Workspace manager with 4+ windows posted on my fb, you can view it there (which is public).

It's not exactly a list of buffers as you wanted it, but you can open files in different windows, and in multiple buffers in same window.

In the later case, workspace manager will serve as a buffer list. As you can see in screenshot, I've grouped files into different groups.

This is as close as what you can get, AFIK.

Good day.

0

Why shoehorn that level of window management into vim? I do occasionally use split windows - I have Ctrl-F mapped to a find-in-files style grep command that appears in a split window, and I also use vimdiff on occasion.

But do you really want permanent window management in vim? PuTTY connection manager and all sorts of terminal emulators let you split the terminals how you want, and then run separate vim sessions in each.

1
  • Can you share registers between vim instances? This is always my number one reason for not wanting multiple instances of vim running: I can't yank from one and put in the other. Mar 10, 2014 at 13:04
0

have NERDTree open on the left. >

I have several buffers open (only one visible in the main view... call it "buffer 1" )

I now go to NERDTree and select another file that I just want to look at really quick or copy something from. So I open that file from NERDTree and buffer1 is correctly hidden and I'm now looking at the buffer I just opened (call it buffer 2)

I now want to completely quit this buffer 2 and go back to editing buffer 1, but when I do :q on buffer 2 I end up looking at just one large NERDTree and I have to redisplay buffer1. ... [show rest of quote]

I do not use Nerdtree, but it sounds like you should be typing Ctrl-^ (probably Ctrl + the 6 key) to switch back to buffer1.

0

I'm not aware of such a plugin.

One quick way to open a buffer of a specific file is to use FuzzyFinder's :FufBuffer command. It'll open a list of all opened buffers (excluding the one in your current window) for easy access. I've got mine bound to ,fn. It would allow me to, for example, quickly see all css files with ,fncss or all js files with ,fnjs. FuzzyFinder is great for getting to that file/buffer/directory/etc you want with minimal effort (not just this particular use case).

However, i suspect you're looking for something which will allow you to use :bn and :bN (or whatever you have those mapped to, cannot remember if ctrl-n/p are default or my custom) to switch between your buffers of a specific file type.

Perhaps, you could make a plugin that gives you commands to allow switching to the previous/next buffers of the same type as the file of the current buffer in the current window.

1
  • BTW, I think managing these separate buffer lists would be more of a pain then relief.
    – Hannes
    May 31, 2012 at 5:46
0

This is not a total answer, but it seems vim keeps separate # and % buffers for each window. So you can alternate between two files quickly in one window (using CTRL-^) and two different files in the other window. The buffer list is still all the buffers you have added though.

1
  • This is really a comment but I cannot comment yet so I post an answer which gets voted down because it doesn't answer the question. Go figure.
    – mondaugen
    Mar 28, 2017 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .