Thursday, March 2, 2017

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

On 3/2/2017 9:30 AM, Nikolay Aleksandrovich Pavlov wrote:
> 2017-03-02 20:07 GMT+03:00 Barry Gold <barrydgold@ca.rr.com>:
>> 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
>> */
> All of this is done automatically after Vim sources proper filetype
> plugin. If you need to do the same stuff without sourcing it, check
> `:h 'comments'`.
>
> And note that specifically for C comments this is done by default:
> check behaviour of `vim -u NONE -i NONE -N --cmd 'set tw=75
> fo+=tcjro'`, it does insert comment leader automatically because
> `&comments` option for some reason is set for C by default.
>
> If you do not see this behaviour then you have some plugin and/or
> setting interferring.
>

Hmmm...

I have the default version of vim that came with cygwin
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 27 2017 13:32:56)

Here is my entire .vimrc file:

set autoindent
set nohls
syntax off
set tw=75
set fo+=tcjro
set ws
set ic
set ts=8
set sw=4
map ^V^N :n^V^M
map ^V^W :w^V^M^V^N
map ^K :w^M:e #^M
map v k$hjl
map q F r^M
map g f r^M
map = 3k$h3jl
:map @ k$hjl
set background=light
set ff=unix
let loaded_matchparen = 1

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