> 2011/7/23 Ben Schmidt<mail_ben_schmidt@yahoo.com.au>
>> You don't need to apologies for bothering us. If we didn't enjoy helping
>> people with Vim, we wouldn't be on this mailing list. It's also clear
>> that you've put in some effort yourself into solving your problems, and
>> aren't just using us as a first response. Anyone with that kind of
>> attitude will be warmly welcomed here, and have their questions gladly
>> received (and if they're not answered, it's probably because we don't
>> know the answer...).
>
> Thanks a lot for your kind comments.
I second Ben's comments -- the list is a friendly place,
especially towards those who ask nicely and invest the time in
trying to learn. It's fun to try and answer these questions.
And even after you have a workable solution, some of us nuts like
to continue to try other solutions. See below:
> So here is an implementation I am minimally satisfied with
> (can be improved, but for the time being I am happy with it).
> It would have been impossible without your help.
For a straight Ex solution, you should be able to use:
:+?^\%(\s*\n.\zs\)\|\%^?;/\%$\|\n\s*$/s/^/#
where the "s/^/#" at the end is the commentifying action. From
all my testing (with blank-but-non-empty lines, at the beginning
and end of the file, with the cursor between paragraphs, etc.
The only odd edge-case I found was if the first line of your file
was blank and the cursor was on it when you executed it (it ends
up commenting the *last* paragraph of the file, but it's a
somewhat undefined action in such a case).
-tim
--
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
No comments:
Post a Comment