Monday, September 5, 2011

CTRL-]/CTRL-T to detect existing windows/buffers when switching to/from tags

Hi,

[Please CC me...]

I'm wondering if anyone has any tips for how to efficiently jump
between tags in Vim? I'll outline my scenario.

At the moment, pressing CTRL-] on a function definition works great,
and vim will jump to that tag, switching to a new file in the same
window if need be. What I'm after is trying to find out if Vim can
instead detect if a window displaying a buffer with that tag in it is
open and to switch focus to that instead?

For example: If I have a split window which looks like this:

+----------------------+
| | |
| 1 | 2 |
| fileA | fileB |
+----------------------+

And I am in window 2. If selecting a tag with CTRL-] meant jumping to
a definition resulted in fileA in window1, I'd want Vim to switch the
focus to window 1 instead and jump to the correct tag, rather than Vim
currently opening fileA in window2.

Likewise, going back the other way instead, pressing CTRL-T should put
me back in window2, in this example.

If this is possible, it might be nice to consider whether the CTRL-]
can also detect files open in other *tabs* and switch to any windows
in that.

TIA!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: