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.

barbaz
  • 1,642
  • 2
  • 17
  • 27

2 Answers2

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.

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    Sry, I don't (yet) know how achive the inverse effect with `^O`.. looking into it – sehe Jun 30 '11 at 14:21
  • 2
    The problem with this solution is also that it does not reuse tabs, even with switchbuf=usetab – barbaz Jun 30 '11 at 14:23
  • 1
    To fix the reuse tab problem see my post here: http://vi.stackexchange.com/questions/10014/navigate-to-tag-in-a-new-tab-if-not-already-opened-like-tab-drop/10320#10320 – Tim Nov 17 '16 at 18:11
  • @barbaz Just a heads-up for you ^ – sehe Nov 17 '16 at 23:09
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

  • 2
    Please, add context around your link so that your answer would remain useful in case the linked site goes down – illright Apr 09 '17 at 07:42