Tuesday, October 10, 2017

How to set comment character as double dash in front of formatted text?

Hi,
1. I have some text in my code like:
# Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ornare vehicula ornare. Proin bibendum convallis vulputate. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam a convallis nisi. Praesent mollis mauris at molestie molestie.

Note: Above line starts with "#" as comment and whole text is in one line.

2. Now I set text width to 50 chars
:set textwidth=50

3. I move cursor to line of "Lorem ipsum" and execute: gqq
to format a text into multiple lines.

4. Bellow appears:
# Lorem ipsum dolor sit amet, consectetur
# adipiscing elit. Duis ornare vehicula ornare.
# Proin bibendum convallis vulputate. Pellentesque
# habitant morbi tristique senectus et netus et
# malesuada fames ac turpis egestas. Nullam a
# convallis nisi. Praesent mollis mauris at
# molestie molestie.

Notice "#" comment character is automatically
added at front of text, but text has been
reformatted into multiple lines.

5. In third row delete whole sentence, so from "Proin" to
the dot (but leave # comment in front of text).

6. Reformat whole paragraph: gqap
and bellow appears:
# Lorem ipsum dolor sit amet, consectetur
# adipiscing elit. Duis ornare vehicula ornare.
# Pellentesque habitant morbi tristique senectus
# et netus et malesuada fames ac turpis egestas.
# Nullam a convallis nisi. Praesent mollis mauris
# at molestie molestie.

Note: whole paragraph is reformatted, but #
character is automatically added as first char
in line. I can do several similar edits and
reformat and "#" comment char stays at the beginning
of row.

NOW TO THE PROBLEM:
In my coding language comment is not # but instead
double dash: --

I should probably set some setting for formatting
to tell which character is comment or similar.

Is it possible to set double dash is a comment for formatting?
Regards

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: