tags:

views:

1180

answers:

2

I've started using Vim some time ago. So far - I enjoyed my experience with this editor. Until recently I started using Tabs in Vim.

I must admit that I am a bit frustrated about whole buffer/tab/window concept in Vim. For example, suppose I am working on a number of files related to one "project". All files are open in tabs. Suppose I issue a command which would make switch active buffer (e.g. jumping to function definition with CTRL-]). Result is that in current tab I see buffer with file where function is defined. BUT I already have the same buffer in another tab! Now I have two tabs with same contents.

Is there a possibility to somehow bind together buffers with tabs? Or, say make vim check if buffer to be switched to is currently open in some window/tab and switch to that window/tab instead?

So far I have found the following (which does not solve above described problem, but somewhat demonstrates Vim behaviour I am looking for):

set switchbuf=usetab

Now, when using :sb, :sbnext, :sbprev instead of :b, :bnext, :bprev to switch buffers, Vim will check if buffer is open in tab/window and switch to that tab/window.

+1  A: 

Isn't this question similar to this one: Using vim's tabs like buffers

Sam
Yes. I guess what I want here is against the very nature of Vim :)
It took a while for me to start unlearning the use of tabs. I still think vim should have a built-in minibuffer-like tabline though. Would make it easier for people who come from a tab-editor to realize that buffers can be used in a similar way.
Sam
+4  A: 

I keep godlygeek's explanation bookmarked for just this question.

godlygeek on Vim's tabs/windows/buffers

Jeremy Cantrell