On Feb 18, 2009, at 6:41 PM, Ben Fritz wrote:
> On Feb 18, 1:54 pm, Bee <[email protected]> wrote:
>> syntax off  and  syntax on  effect all buffers.
>>
>> This works to turn of/off syntax color for only the current buffer.
>>
>> Are there other ways?
>>
> :set syntax=
>
> I think that should be a little cleaner.

set syntax=  will trigger the  if &syntax==""  test and will cause  
all buffers to turn syntax on.

let &syntax=strftime("%c")  does not trigger the  if &syntax==""  test.

set syntax=off  also does not trigger the  if &syntax==""  test, but  
then there may be a file with  filetype=off

I use a Mac or Linux, tried on Windows using strftime() it did not work.

Simplified to this, it works on both Mac and Win.
Just now learned how to concatenate strings in vim.

function ToggleSyntaxCurrentBuffer()
   if &syntax==""
     syntax enable
   elseif &syntax==&ft
       let &syntax=&ft . '~'
     else
       let &syntax=&ft
   endif
endfunction

-- 
Bill
Santa Cruz, California


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

Reply via email to