On Sep 28, 1:55 am, Arun <[email protected]> wrote:
> On Sun, Sep 27, 2009 at 09:00:51PM +0100, Thomas Adam wrote:
> > * If the file CTRL-] would jump to is already open, and in a new tab,
> > use *that* tab to jump to the function's definition.
>
> > * If the file CTRL-] would jump to isn't already open, switch to a new
> > tab with that file open and the correct function under the cursor.
>
> Try "set switchbuf=usetab". Also take a look at :h switchbuf.
>
Unfortunately, switchbuf doesn't apply to tag jumping. If I remember,
it applies to the :sb command and the quickfix list, but not much
else.
The second behavior is easy to do, using the built-in CTRL-W_CTRL-]
followed by CTRL-W_T (which could easily be mapped). Unfortunately
getting the first behavior is trickier and will probably involve some
non-trivial vimscript.
I think you can get what you want using the switchbuf option, the :sb
command I mentioned, and the alternate buffer, as follows:
CTRL-] to go to the tag
Save the cursor position to a variable using getpos()
CTRL-^ (or CTRL-6) to go back to the file you were editing before
:tab sb # to either open a new tab with the buffer you jumped to with
CTRL-6, or (with switchbuf set properly) jump to the already-open tab
Set the cursor position to the saved position using setpos()
I'm not certain how automated this can be if you have options set that
cause Vim to prompt when there are multiple matches, but without this
option it should be fairly straightforward to script.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---