I don't use TagBar anymore so I can't test it for you but the doc seems to say that you can use:
:TagbarOpen fj
to jump to the TagBar window. I think it is a little more solid than <C-w>h
which is pretty much tied to a specific layout.
Thus, a possible mapping would be:
nnoremap tn :TagbarOpen fj<CR>
But neither your mapping nor this one allow you to place the cursor on the next tag which is what you seem to want ("to jump to the next tag in the tagbar"). TagBar has a mapping, <C-n>
to go to the next top-level tag which may or may be not what you want. You could add it to the mix or, maybe, use j
:
nnoremap tn :TagbarOpen fj<CR><C-n>
nnoremap tn :TagbarOpen fj<CR>j
As a side note, after a month of usage, I found TagBar to be rather good at showing the structure of my code but rather bad at helping me navigate through it. Because I used it primarily for navigation, I ditched it for Vim's default ctags integration (<C-]>
, :tag <Tab>
, :tselect
and so on…) and CtrlP's wonderful :CtrlPBufTag
and :CtrlPTag
.