My MoinMoin wiki articles are prefixed with
## vim:filetype=moin
and I have a syntax file for MoinMoin.
When I load an article into gvim, it fires up with the correct syntax
highlighting. But when I then change the colour scheme, the syntax
highlighting for MoinMoin tables is lost. I can change between colour
schemes as much as I like; syntax highlting for MoinMoin tables will
not come back.
It does not make a difference which colour scheme I define in .gvimrc
as a default. The problem occurs regardless.
The reason why I would like to change the colour scheme on the fly is
that the colours my default scheme (pyte) uses for MoinMoin tables are
completely unreadable.
Any ideas what is causing the problem?
--
Best Regards,
Tarlika Elisabeth Schmitz
Buggy syntax file I guess.
I checked moin.vim v1.4.1 (Vimscript #1459).
It contains
--------------------------------
if version <600
syntax clear
elsif exists("b:current_syntax")
finish
endif
syn clear
hi clear
--------------------------------
The "hi clear" command should not be there!
And the "syn clear" commandis useless.
And "elsif" should become "elseif".
--
Andy
>Am 08.02.2010 19:24, schrieb Tarlika Elisabeth Schmitz:
>> I have set up gvim as my Firefox text editor [...]
>> and I have a syntax file for MoinMoin.
>>
>> When I load an article into gvim, it fires up with the correct syntax
>> highlighting. But when I then change the colour scheme, the syntax
>> highlighting for MoinMoin tables is lost.
>
>Buggy syntax file I guess.
>I checked moin.vim v1.4.1 (Vimscript #1459).
>--------------------------------
>if version <600
> syntax clear
>elsif exists("b:current_syntax")
> finish
>endif
>
>syn clear
>hi clear
>--------------------------------
>
>The "hi clear" command should not be there!
>
>And the "syn clear" commandis useless.
>And "elsif" should become "elseif".
Thank you for your quick response.
My syntax file is from 2nd Mar 2008. It does not contain these errors.
Link?
--
Andy
http://uploads.mitechie.com/configs/vim/vim/syntax/moin1_6.vim
This is what I am using.
I also found this one: http://moinmo.in/VimHighlighting (Jan 2008)
The January version does not colorize MoinMoin tables.
Table example:
||||||||
|| a || b || c ||
||||||||
a,b,c are cell content, the bars are separators. The March version
displays separators and content in different colours.
Buggy as well ...
----------------------------------
if !exists("did_dic_syntax_inits")
let did_dic_syntax_inits = 1
hi link moinComment Comment
hi link moinInlineComment Comment
...
endif
----------------------------------
Once g:did_dic_syntax_inits is defined, it won't ever
be reset; the ":hi" commands get no chance to be executed again.
Not sure if this "if" condition can be safely removed, but
I'd give it a try (e.g. just comment it out).
--
Andy
@Gustavo - here is the full thread
http://groups.google.com/group/vim_use/browse_thread/thread/296b31684670182d#
>Am 08.02.2010 22:04, schrieb Tarlika Elisabeth Schmitz:
>> On Mon, 08 Feb 2010 21:15:11 +0100
>> Andy Wokula<anw...@yahoo.de> wrote:
>>
>>> Am 08.02.2010 20:51, schrieb Tarlika Elisabeth Schmitz:
>>
>> http://uploads.mitechie.com/configs/vim/vim/syntax/moin1_6.vim
>> This is what I am using.
>>
>> ||||||||
>> || a || b || c ||
>> ||||||||
>>
>> a,b,c are cell content, the bars are separators. The March version
>> displays separators and content in different colours.
>
>Buggy as well ...
>
>----------------------------------
>if !exists("did_dic_syntax_inits")
> let did_dic_syntax_inits = 1
> hi link moinComment Comment
> hi link moinInlineComment Comment
> ...
>endif
>----------------------------------
>
>Once g:did_dic_syntax_inits is defined, it won't ever
>be reset; the ":hi" commands get no chance to be executed again.
>
>Not sure if this "if" condition can be safely removed, but
>I'd give it a try (e.g. just comment it out).
>
Removed if/endif - makes no difference as far as my problem is
concerned.
Ok. The moin syntax file makes use of "hi def" statements, which
define explicit colors. These color settings will be removed
(:hi clear) when loading another color scheme, whereas color links
(:hi link ...) are not affected.
You can try to add the following code to your vimrc:
------------------------------------------
au ColorScheme * call s:AfterColorScheme()
func! s:AfterColorScheme()
hi moinBold term=bold cterm=bold gui=bold
hi moinItalic ctermfg=darkcyan gui=italic
hi moinSettings ctermfg=green guifg=green
hi moinPragma ctermfg=darkred guifg=darkred
hi moinStrike ctermfg=darkgray guifg=darkgray
hi moinTableMark ctermfg=yellow guifg=yellow
hi moinTableOpt ctermfg=darkyellow guifg=darkyellow
hi moinCode ctermfg=cyan guifg=cyan
hi moinLink ctermfg=red guifg=red
hi moinSmileys ctermfg=yellow guifg=yellow
endfunc
------------------------------------------
This explicitly sets the moin highlight groups again after switching to
another color scheme.
Alternatively, manually do
:e
or
:set syn=moin
--
Andy
>Am 08.02.2010 23:25, schrieb Tarlika Elisabeth Schmitz:
>> On Mon, 08 Feb 2010 22:44:12 +0100
>> Andy Wokula<anw...@yahoo.de> wrote:
>>
>>> Am 08.02.2010 22:04, schrieb Tarlika Elisabeth Schmitz:
>>>> On Mon, 08 Feb 2010 21:15:11 +0100
>>>> Andy Wokula<anw...@yahoo.de> wrote:
>>>>
>>>>> Am 08.02.2010 20:51, schrieb Tarlika Elisabeth Schmitz:
>>>>
>>>> http://uploads.mitechie.com/configs/vim/vim/syntax/moin1_6.vim
>>>> This is what I am using.
>>>>
>>>> [...]
>>>
>>> ----------------------------------
>>> if !exists("did_dic_syntax_inits")
>>> let did_dic_syntax_inits = 1
>>> hi link moinComment Comment
>>> hi link moinInlineComment Comment
>>> ...
>>> endif
>>> ----------------------------------
>>>
>>> Once g:did_dic_syntax_inits is defined, it won't ever
>>> be reset; the ":hi" commands get no chance to be executed again.
>>
>> Removed if/endif - makes no difference as far as my problem is
>> concerned.
>
>Ok. The moin syntax file makes use of "hi def" statements, which
>define explicit colors. These color settings will be removed
>(:hi clear) when loading another color scheme, whereas color links
>(:hi link ...) are not affected.
>
>
>You can try to add the following code to your vimrc:
>
>------------------------------------------
>au ColorScheme * call s:AfterColorScheme()
>
>func! s:AfterColorScheme()
> hi moinBold term=bold cterm=bold gui=bold
> [...]
> hi moinSmileys ctermfg=yellow guifg=yellow
>endfunc
>------------------------------------------
>
>This explicitly sets the moin highlight groups again after switching to
>another color scheme.
>
>
>Alternatively, manually do
> :e
>or
> :set syn=moin
I have not yet tried the .vimrc suggestion (a bit of a desparate
measure) but I have tried the other two:
Neither :e nor :set syn=moin take effect.
No, it's a normal thing to do. When a syntax file provides default
colors [1] that can be overridden by the user, then switching the color
scheme will wipe out these colors. You have to somehow restore the
original colors. To make this possible, the ColorScheme auto command
was added.
There is another alternative: Move your favorite color scheme scripts to
your ~\vimfiles\colors folder [2] and add the missing highlight groups.
[1] :h :hi-default
[2] look at the first entry of your 'runtimepath' and use that instead
of ~\vimfiles
--
Andy
This code snippet fixes the problem. When I change vim colour scheme
MoinMoin table colouring is no longer lost.
Thank you for your help!