I want to make tags between .txt files in a way that's similar to the vim user manual.
I'm already aware of how to generate a tags file and I can link between my files. The only thing I want to figure out is how to make all of my tags a different color (like blue in the user manual) so they are easy to identify.
My best guess is that I'd have to customize syntax highlighting for a txt file, but I'm not sure how it would distinguish between tags and normal text.
Extracting tags and their links is the one thing; you seem to have solved that part.
To recognize and highlight the tags, you need syntax rules. If your tags style follows the Vim help, tag definitions are surrounded by * characters, and tag links by | characters.
The following excerpt from $VIMRUNTIME/syntax/help.vim covers this:
syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" contains=helpBar
syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" contains=helpStar
hi def link helpHyperTextJump Subtitle
hi def link helpHyperTextEntry String
If you put that (optimally after replacing help... with txt...) into a custom ~/.vim/syntax/txt.vim syntax script, you can activate your syntax with :setf txt (or even automate this via a custom filetype detection).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With