preservim / tagbar

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

how not to open a file in the tagbar window? #741

Closed uvicorn closed 3 years ago

uvicorn commented 3 years ago

I open tagbar, then click on another file in barbar, and I have a file open in the tagbar window. How can you avoid this? I want the file to open in the window where the file has already been opened, and not in the tagbar window

изображение

Now: изображение

Need: изображение

alerque commented 3 years ago

I think you are conflating tabs, buffer, files, panes, and windows. You are using a buffer list as if it was a tab list or window list. You have some UI running with what seems to be two tabs, and then in the tab you have the view split into two panes (the main one and a tagbar one), the you have a list of buffers and you are clicking on the buffer which has the effect of loading that buffer into the current pane. If you want to click on something and have it open in a new window instead what you need is a tab list instead.

Note that there isn't really a concept of "open files" in VIM. The closes analog is open buffers, but the differences from the way other editors handle files are significant.

I don't think there is anything to fix here because this plugin is working as designed. I realize that the way buffers vs. tabs work may not be the way you expect, but our handling of them is (as far as I can see) 100% consistent with the standard way VIM handles them for everything else.

To get the effect you want you should look into changing your bar from being a buffer list to a tab list. There are a number of plugins that manage this. I don't know which one you are using but it may be configurable to do this already and hide the concept of buffers from you entirely and show you the more expected tab/window paradigm instead. The one I use (airline) has functionality for both and I can switch back and forth depending on my workflow.