On Mon, Dec 1, 2008 at 1:10 PM, smu johnson wrote:
> Dear faithful vim users,
>
> I was wondering how some of guy friendly folks have gone about toggling the
> fo / formatoptions flags.  I haven't been able to find anything in the man
> page because it lacks common applications for the advice it gives.
>
> I'm basically trying to bind a key to toggle the auto-comment ability found
> in it.  Any thoughts?  Thanks in advance.

I'd do something like this:

if &fo =~ 'r' && &fo =~ 'o'
 set fo-= fo-=r
else
 set fo+=ro
endif

That is, if 'formatoptions' contains both 'o' and 'r', remove those
flags, otherwise add those flags.

see...
:help expr-option
:help :set+=
:help :set-=

~Matt

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

Reply via email to