Thursday, March 2, 2017

Re: How do I get C++ comments to wrap correctly?

On Thursday, March 2, 2017 at 11:19:04 AM UTC-6, Barry Gold wrote:
> I want to use word-wrap on my C++ comments.
>
> My .vimrc file contains
> set tw=75
> set fo+=tcjro
>
> But when I type a long C++ style comment, I get
> // This object contains the logic (code and data) for making the
> first pass over the input
>
> I want the second line to start with a // like the first one.
>
> Ideally I'd like it to also work for sh-style comments:
> # stuff
> and for javadoc comments
> /**
> * some stuff that may line-wrap
> */

Do you have filetype plugins turned on in your .vimrc? Either that, or manually setting the 'comments' option will be required for the automatic detection/insertion of comment leaders.

Note that all of these options may be overwritten in the filetype plugin, so it is probably more robust to use an autocmd or filetype plugin of your own to set the desired options per filetype.

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

Post a Comment