On 2008-10-27, Barry Gold <[EMAIL PROTECTED]> wrote:
> I'm using vim 7.1.  I'm editing a Javascript program (*.js), which 
> allows C++ style on-line comments: //
> 
> I want to have these comments auto-formatted -- put auto wrap at wm=, 
> then start the next line with //.
> 
> I have read the help documentation and tried setting formatoptions, 
> comment, and commentstring, but so far without success.
> 
> And yes, I've looked at the FAQ and the message archive.  Any help would 
> be appreciated.  Oh, just in case my .exrc file is causing trouble, here 
> it is:
> set autoindent
> set nohls
> syntax off
> set wm=5
> set nobk
> set ws
> set ic
> set ts=8
> set sw=4
> map ^V^N :n^V^M               That is, ctrl-N = :n
> map ^V^W :w^V^M^V^N   That is, ctrl-W = :w + :n
> :map ^K :w^V^M:e #^V^M  That is, ctrl-K = :w + :e #
> map v k$hjl
> map q F r
> map g f r
> map = 3k$h3jl

First, make sure that your 'comments' option includes

   ://

It should by default.  You can check this by executing

   :verbose set comments?

That will tell you what 'comments' is set to and if not the default, 
where it was last set.

Next, to automatically start the next line with // when a comment 
line wraps, the 'formatoptions' options must include

   c

which it does by default.  To check this, execute

   :verbose set formatoptions?

You might also try starting vim as

   vim -N -u NONE -c 'set wm=5'

and see if it behaves as you expect it to.  It should.  If it 
doesn't, tell us exactly what you did, what results you expected and 
what results you actually got.

Regards,
Gary


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to