H

On Monday, April 30, 2012 9:15:26 AM UTC-4, rameo wrote:
> It seems that I have found the solution (after many many hours of trying :-( )
> 
> I created the function below.
> The function must do this (and seems to do it):
> 
> a) when there is only 1 window:
>   check if filetype is "vim"     --> Dark_ColorScheme
>         if filetype is not "vim" --> Light_ColorScheme        
> b) when there is a split window:
>    check if exist split window colorscheme variable (g:splitcolor)
>    if yes, colorscheme of splitwindow = g:splitcolor
>    
>    when leaving split window:
>    keep the value of the current color in g:splitcolor
> 
> Can anyone tell me if I made a mistake and if the function can be simplified?
> 
> function SetColors()
>         if winnr('$') > 1
>            if exists('g:splitcolor')
>              exe 'colors '.g:splitcolor
>            else
>              exe 'colors Light_ColorScheme'
>            endif
>         elseif winnr('$') == 1 && &ft == 'vim'
>              exe 'colors Dark_ColorScheme'
>         elseif winnr('$') == 1 && &ft != 'vim' 
>              exe 'colors Light_ColorScheme'
>         endif
> endfunction
> function KeepColors()
>        if winnr('$') > 1
>        let g:splitcolor = g:colors_name
>        endif
> endfunction
> augroup filetype_colorscheme
>         au BufEnter * call SetColors()
>         au BufLeave * call KeepColors()
> augroup END

Hi, 

I am trying to achieve similar goal, I want to have different color schemes for 
different file types, but I use omnicppcomplete, which opens a floating window 
for auto-completion. So, when I try to do the autocompletion, the whole color 
scheme reverts back to the default. Have you found any work around?

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

Reply via email to