17

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.

  • You may also want to pose this question to the Vim Users Group on google! – Brian Jun 25 '09 at 11:23
  • 1
    The problem that many have with vim's tabs is that they're badly called. They should've been called viewframes or something, because they don't act most people expect of "normal" tabs (like they're used to from other applications). Vim's principle way of doing is by buffers and views (windows) ... tabs are a nice addition ,but they should not be expected to work in one tab/one file(buffer) mode like in other programs. – Rook Jun 25 '09 at 19:07
  • @ldigas Although I agree with you that the term 'tab' is misleading, the OP was referring more to more efficiently using tabs as viewports than using tabs as traditional tabs. – puk Jan 06 '12 at 10:08
  • 3
    possible duplicate of [Using Vim's tabs like buffers](http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers) – Felix Kling Feb 02 '14 at 19:25

1 Answers1

8

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

Community
  • 1
  • 1
Sam
  • 14,642
  • 6
  • 27
  • 39
  • Yes. I guess what I want here is against the very nature of Vim :) –  Jun 25 '09 at 12:00
  • 4
    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 Jun 25 '09 at 16:49