Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top