On Jun 25, 6:36 am, Derk <[email protected]> wrote:
> 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 behavior 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.
>
Your first problem is assuming that tabs in Vim work like tabs in
other applications. That's very common the first time one sees tabs in
Vim. But tabs in Vim are more like a partially separate Vim instance.
Vim's tab pages allow you to do some very cool things that aren't
possible in other editors. A simple example would be to have one tab
open to edit/view a file, a separate tab to view a diff between it and
another file, and a third tab to view a diff between the current state
of the buffer and the file as it exists on-disk.
In your specific example, what I would do instead of jumping to the
definition with CTRL-] would be to either jump to the definition in a
NEW WINDOW in the CURRENT tab with CTRL-W CTRL-], or even opening the
function definition in the PREVIEW window in the current tab with CTRL-
W }. This way, you can even see both files simultaneously rather than
needing to switch back and forth between tabs.
I'd suggest taking a look at http://vim.wikia.com/wiki/Category:Tabs
for suggestions about how to utilize Vim's tab pages to their full
potential...plus a couple of tips about how to approximate what you
are trying to do.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---