Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buffers per tab in vim

Tags:

vim

tabs

buffer

Is there a way I can configure vim to remember buffers based on their tab?

I am currently working on two projects, and I have each project in its own tab, with its own local directory. To navigate through files I'm using FuzzyFinder.

The problem is that when I want to search through buffers, I get all the buffers from both projects.

Can I limit it to show only buffers from the current tab?

It may very well be that I am using a wrong approach here. If this is the case, what would be a better one?

like image 484
adivasile Avatar asked Oct 24 '22 23:10

adivasile


1 Answers

Vim's tabs are not like most other editors tabs: they don't represent specific files or groups of files. They are just "views" allowing you to arrange buffers visually.

Vim's buffers are global and AFAIK there is no native way to bind them to specific tabs but I saw a "per-tab" fork of NERDTreee on Github the other day so it might be possible with some effort.

I use tabs only for quick edits and have usually one or two dozens buffers open. Most of them are hidden (:help hidden) and I rarely have more than 3 splits (only one file visible, most of the time). Buffer switching and file opening are done with LustyExplorer.

If I must work on two project I use two instances of GVim or two separate "GUI" windows in MacVim.

So yes, your approach is wrong (mine is most probably not perfect, either) but the culprit is the person or commity which decided to call Vim's tabs "tabs".

As a side note I find the "Rolodex Vim" idea quite enjoyable, there are two implementations on this page.

like image 122
romainl Avatar answered Oct 30 '22 01:10

romainl