Read the source Luke

I sometimes like to read the source. The comments are built in. Nice. But I also like to read the documents. These doc comments get turned in to pretty html and I can peruse and grain great wisdom. Then while reading the documentation for a library, while reading the docs, you get to the point where you need to know more than the docs say so you click the "[src]" link so you can read the source.
So back to reading the source. Plain text, I like to read in my terminal. Reading the source you find there are doc comments inside. Doc comments that I just read in m y browser.. If I read the source in my vim text editor, then I get all the nice shiny colors. Easy to see, understanding is another thing...
But I get very distracted when trying to read the source and seeing all of those /// doc comments with embedded examples. I already read the doc comments in my browser when I was reading the docs. The reason I open the src in my vim, is for the proper colors and it looks the same, format wise, as the code I am writing, same interface, etc. Easier for my brain to relate.

So now to my simple question.

How do I get vim to hide the doc comments when reading source code so can just see the code and the inline comments.

(Distraction is an issue for me, as is probably apparent from this entire comment.)

2 Likes

You can use folding to hide them but I don't know how, exactly, to get it set up.

1 Like

Thanks for the word, folding. That does help. I guess I have some studying to do.

In vim

:help fold-syntax

leads me to realise that now is a good time for me to learn a new programming language that I have been avoiding for years....the vim configurations.

1 Like

See this issue on the rust.vim repo:

I can't vouch for the snippets posted there, though.