Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown: How to hide scopes? #870

Closed
wenchao-hao opened this issue Feb 23, 2024 · 7 comments · Fixed by #893
Closed

Markdown: How to hide scopes? #870

wenchao-hao opened this issue Feb 23, 2024 · 7 comments · Fixed by #893

Comments

@wenchao-hao
Copy link

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
Copy link
Collaborator

raven42 commented Feb 23, 2024

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

g:tagbar_show_data_type~

@raven42 raven42 closed this as completed Feb 23, 2024
@wenchao-hao
Copy link
Author

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

g:tagbar_show_data_type~

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
Copy link
Collaborator

raven42 commented Feb 26, 2024

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
Copy link
Author

wenchao-hao commented Feb 27, 2024

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

@wenchao-hao
Copy link
Author

Hi @raven42

It seems no one submit code for this feature. I am not familar with grammar and logic of vim plugin. Do you have a plan to implement this feature?

Thanks.

@raven42
Copy link
Collaborator

raven42 commented Oct 24, 2024

@wenchao-hao I've pushed up PR (#893) that should address this. Can you give it a try and see if this is what you're looking for? It is completely untested as I am not in my normal development environment at the moment, but I can try it out next week to test it.

@wenchao-hao
Copy link
Author

@wenchao-hao I've pushed up PR (#893) that should address this. Can you give it a try and see if this is what you're looking for? It is completely untested as I am not in my normal development environment at the moment, but I can try it out next week to test it.

I tried your changes, it works on my environment.

With
g:tagbar_show_prefix = 1
g:tagbar_show_suffix = 0

The tar looks like following:

image

This looks good for me, thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants