tagbar icon indicating copy to clipboard operation
tagbar copied to clipboard

How to open tagbar in current buffer using :sp ?

Open twmht opened this issue 12 years ago • 2 comments

How to open tagbar in current buffer using :sp?

just like the screenshot in this page:

http://starryalley.twbbs.org/blog/index.php?/archives/1221-Notes-to-use-Eclim+Vim-to-develop-Android-App.html

However, The screenshot of the above page use taglist , not tagbar.

It seems that tagbar use :vsp in the current buffer, not :sp

Due to make more space I want to locate my code, I prefer use :vsp to open tagbar in the current buffer (usually in NERDTREE buffer)

How can I make this happen?

Thanks in advance:)

twmht avatar May 18 '12 04:05 twmht

Currently that's not possible. As far as I know to make it work with Taglist and NERDTree as in the screenshot there's another plugin called 'winmanager' needed, but I think the plugins need support for that.

Assuming that you (and others) only want to use NERDTree or netrw as the other window in the horizontal split I have some ideas how it might work (without requiring another plugin like the above mentioned winmanager), but I haven't had time to implement it yet. I'll give it a try once I have some time.

majutsushi avatar May 20 '12 09:05 majutsushi

@twmht There was a new option for g:tagbar_position added that allows values for rightbelow and such that allows tagbar to open in a window below the current window instead of to the left or right. I have another plugin which handles this window management as well that you can take a look at if you want at here if you are interested.

Basically the code does the following:

let g:tagbar_position = 'rightbelow'
let g:tagbar_previewwin_pos = 'botright'
" some code to save current active window so it can be activated later
silent NERDTree
silent TagbarOpen
" switch to the saved active window

Will this work for your needs?

raven42 avatar Sep 24 '20 16:09 raven42