preservim / tagbar

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

Sort by order in the file #854

Open bluss opened 11 months ago

bluss commented 11 months ago

Would it be possible to add an option to sort items by strict order in the file?

Right now I see classes sorted first and then functions. If I enable tag linenumbers (let g:tagbar_show_tag_linenumbers = 1) then the displayed line number corresponds to exactly the order that I'd prefer in the tagbar, if the items were sorted by that line number. Is this possible? Any pseudotags could be sorted according to their first child.

(The sort option only influences order inside a category, that I can see, i.e "class", "function" etc.)

alerque commented 11 months ago

Off the top of my head I don't know how hard this would be to implement, but we'd be happy to accept a PR if somebody wanted to implement this as an option. The semantic tag data should have enough information to construct this (since it has line numbers) but it might be kind of a pain to iterate though.

raven42 commented 11 months ago

Take a look at the 'g:tagbar_sort' option. Is that what you are wanting?

Edit: oh sorry. Missed the bit at the end that you had looked at that.