Wednesday, March 31, 2010

Re: What are your "auto-nextline commenting" habits? [sj]

On 2010-03-31, smu johnson <smujohnson@gmail.com> wrote:
> Hi,
>
> I have an interesting question for all of you. Lately I've found I might enjoy
> the feature that keeps commenting lines after you hit <CR>, as it makes
> commenting in Perl much easier than having to add # to each of your lines.
>
> My question is... how do you quickly "exit" that commenting mode in a way that
> isn't annoying or frustrating? I am not quite sure how to "turn it off"
> without having to manually delete the new comment starter when I hit the 'o'
> command to open a new line. It thinks I want a comment still!
>
> PS: I noticed this behaviour starting when I installed NERDCommenter. I am
> not even sure if I can turn it off if I decide I don't like this
> newline-commenting feature.
>
> Thank you in advance.

The problem is that your 'formatoptions' (or just 'fo') option
includes the 'o' flag. It sounds like you want the 'r' flag but not
the 'o' flag. See

:help fo-table

for an explanation of what the various flags do.

To the question of why that behavior seems to have changed for you
recently, execute this:

:verbose set fo?

That will tell you the current value of the 'fo' option and where it
was last set. The proper way to set or restore the value of 'fo'
to what you want will depend on the output from that command.

My preferred value of 'formatoptions' contains 'r' but not 'o'.
That way I can easily insert code below a comment by typing 'o' on
the last comment line. If instead I want to insert more lines of
comment below an existing comment, I move the cursor to the last
comment line, hit 'A' then Enter, and I have a new line beginning
with the comment leader.

HTH,
Gary

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

To unsubscribe, reply using "remove me" as the subject.

No comments:

Post a Comment