Jump to definition in new tab
Asked Answered
U

2

12

What i'm looking for is the following behaviour:

  • ^]
    Should open the definition below the cursor in a new tab instead of a new buffer and reuse already open tabs
  • ^O
    Should switch back to the previous location in the previous tab instead of switching the buffer of the current tab to the previous locations buffer
  • ^I
    Should behave accordingly

I tried

:set switchbuf=newtab

as well as

:set switchbuf=usetab

but both did not change any of the behaviour.

Urogenital answered 30/6, 2011 at 14:6 Comment(3)
You can find some inspiration here vim.wikia.com/wiki/Open_every_buffer_in_its_own_tabpageMagistery
Whoevery voted to close this: wrong. The consensus is that Vim/Emacs questions are on-topic here.Ampulla
possible duplicate of Opening (c)tags in new tab in (G)VimMassa
C
9

Look here:

vim: Open tag in new tab

Basically, the idea is to do C-wC-]C-wT -- and then map that behaviour to the keys you like.

Clippard answered 30/6, 2011 at 14:20 Comment(4)
Sry, I don't (yet) know how achive the inverse effect with ^O.. looking into itClippard
The problem with this solution is also that it does not reuse tabs, even with switchbuf=usetabUrogenital
To fix the reuse tab problem see my post here: vi.stackexchange.com/questions/10014/…Clubfoot
@Urogenital Just a heads-up for you ^Clippard
M
0

I wrote a plugin that not only jump tag in new tab but also jump back to the correct tab when you press < C-t > to jump back. https://github.com/ipod825/TagJump

Mazurka answered 9/4, 2017 at 7:21 Comment(1)
Please, add context around your link so that your answer would remain useful in case the linked site goes downCollyrium

© 2022 - 2024 — McMap. All rights reserved.