Tuesday, September 25, 2012

Re: Split windows and syntax highlighting

On 25/09/12 08:20, Christian Brabandt wrote:
> On Tue, September 25, 2012 03:51, Tony Mechelynck wrote:
>> On 24/09/12 19:56, Christian Brabandt wrote:
>>> On Mo, 24 Sep 2012, Matthias Pitzl wrote:
>>>> Is it somehow possible to do a :syn off only for one specific window?
>>> Yes, if you use :setl syntax=off
>>
>> or just :setl syntax= (with nothing after the = sign)
>>
>> If by any chance you had downloaded a syntax/off.vim in one of the
>> directory trees part of 'runtimepath', ":setl syntax=off" would apply it
>> to the current editfile.
>
> Considering, that the advised method of disabling syntax highlighting
> in the help is using :set syntax=OFF we should probably prevent loading a
> syntax file with the name OFF and handle this in synload.vim (as it is
> already done for the value 'ON')
>
> Here is a patch, that does that (and additionally makes the check for
> the syntax item ignore case):
> --- syntax\synload.vim Tue Sep 25 08:09:53 2012
> +++ syntax\synload.vim.new Tue Sep 25 08:09:43 2012
> @@ -38,7 +38,7 @@
> endif
>
> let s = expand("<amatch>")
> - if s == "ON"
> + if s ==? "ON"
> " :set syntax=ON
> if &filetype == ""
> echohl ErrorMsg
> @@ -46,6 +46,8 @@
> echohl None
> endif
> let s = &filetype
> + elseif s ==? "OFF"
> + let s = ''
> endif
>
> if s != ""
>
>
> regards,
> Christian
>

Somehow :setl syn=ON (or even :setl syn=on) seems to set the syntax
highlighting according to the value of 'filetype', but :setl syn?
answers " syntax=ON" or " syntax=on" respectively. From what I see
above it sems to be the intended behaviour. Didn't know that.

As long as there is _no_ off.vim syntax script (and who would install a
syntax script of that name?), the behaviour for an "unknown" syntax is
to highlight everything like the Normal group anyway.


Best regards,
Tony.
--
Whistler's Law:
You never know who is right, but you always know who is in
charge.

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