preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.13k stars 487 forks source link

How to open tagbar in current buffer using :sp ? #74

Open twmht opened 12 years ago

twmht commented 12 years ago

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:)

majutsushi commented 12 years ago

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.

raven42 commented 4 years ago

@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?