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

Markdown: How to hide scopes? #870

Open wenchao-hao opened 4 months ago

wenchao-hao commented 4 months ago

Seek for help: I want to use tagbar with markdown, but do not display the scope info of each title like following:

image

How to do to disable that display?

raven42 commented 4 months ago

This is controlled via the g:tagbar_show_data_type option. Please see the documentation for more information. https://github.com/preservim/tagbar/blob/12edcb59449b335555652898f82dd6d5c59d519a/doc/tagbar.txt#L772

wenchao-hao commented 4 months ago

This is controlled via the g:tagbar_show_data_type option. Please see the documentation for more information.

https://github.com/preservim/tagbar/blob/12edcb59449b335555652898f82dd6d5c59d519a/doc/tagbar.txt#L772

Thanks for your reply, but it seems not work.

I did not modify g:tagbar_show_data_type, the behavior would not change if I set g:tagbar_show_data_type to 0 explicitly.

What's more, if I set g:tagbar_show_data_type to 1 explicitly, it looks like following:

image

raven42 commented 4 months ago

Hmm. Ok I looked a little closer, and my memory was off. The behavior you are seeing is correct from the current implementation. The show_data_type was intended more for tags that have a data type from other languages like int var = 0; or similar where the datatype is derived from the word right before the tag. Which in the case of markdown does not appear to be very helpful.

That said, with the show_data_type set to 0 (default), then tagbar will populate this with the tag kind if it is a scoped kind (which section types in markdown are). From the current code, there is no way to disable this. Though an option probably could be added.

If we do get a chance to address this, are you wanting it to just be an empty string?

wenchao-hao commented 4 months ago

Hmm. Ok I looked a little closer, and my memory was off. The behavior you are seeing is correct from the current implementation. The show_data_type was intended more for tags that have a data type from other languages like int var = 0; or similar where the datatype is derived from the word right before the tag. Which in the case of markdown does not appear to be very helpful.

That said, with the show_data_type set to 0 (default), then tagbar will populate this with the tag kind if it is a scoped kind (which section types in markdown are). From the current code, there is no way to disable this. Though an option probably could be added.

If we do get a chance to address this, are you wanting it to just be an empty string?

Thanks, if possible, I want to make the display more clear, it's best to hide all contents after ":", including ":"