On 19/02/09 06:49, Bee wrote:
>
> 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.
use ":setlocal syntax=", it won't affect other buffers.
---------^^^^^
>
> 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
>
also here: let &l:syntax = &ft (unlike what I said a few minutes ago)
Best regards,
Tony.
--
Wombat's Laws of Computer Selection:
(1) If it doesn't run Unix, forget it.
(2) Any computer design over 10 years old is obsolete.
(3) Anything made by IBM is junk. (See number 2)
(4) The minimum acceptable CPU power for a single user is a
VAX/780 with a floating point accelerator.
(5) Any computer with a mouse is worthless.
-- Rich Kulawiec
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---