views:

63

answers:

2

I often find myself wanting to change just something little in a colorscheme, but i don't want to edit the original file. I tried putting my change in '~/.vim/after/colors/blah.vim', but that doesn't work for me.


Example, I want to change the CursorLine highlight in BusyBee.vim..

~/.vim/colors/BusyBee.vim

I create the file '~/.vim/after/colors/BusyBee.vim' and add this:

hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

However, i don't see the change. Of course it works if i change the line in the originial BusyBee.vim, but like i said i'd prefer not to do that.

Doing...

:colo Busy<TAB>

Shows me...

BusyBee  BusyBee
+1  A: 

Put

hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

after your

colorscheme BusyBee

entry in your _vimrc.

ldigas
A: 

I don't have 'colorscheme BusyBee' in my .vimrc. I like to switch colorscheme now and then, so i want to "fix" the actual theme.

I came up with this solution, not the prettiest, but whatever.

function! FixColorscheme() " {{{
    echo "fixing colorscheme"
    if has("gui_running")
        if (g:colors_name =~ "busybee")
            hi Folded        guibg=#001336 guifg=#003DAD gui=none
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "256-jungle")
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "xoria256")
            hi Folded        guibg=#001336 guifg=#003DAD gui=none cterm=none
            "hi Folded         ctermbg=234  ctermfg=25    cterm=none
        endif
    elseif &t_Co == 256
        if (g:colors_name =~ "busybee")
            hi Folded        guibg=#001336 guifg=#003DAD gui=none
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "256-jungle")
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "xoria256")
            hi Folded         ctermbg=234  ctermfg=25    cterm=none
            hi CursorLine    cterm=none
        "else
            "hi CursorLine     ctermbg=0                  cterm=none
        endif
    endif
    endfunction
" }}}

Run it automatically when changing color scheme.

augroup mycolorschemes
    au!
    au ColorScheme * call FixColorscheme()
augroup END

And this helps to load your favorite-scheme-of-the-week on startup. (eek!! the default!)

if iSFirstRun == 1
    echo "HI"
    colo xoria256
    call FixColors()
endif

.. and this at the very top of .vimrc

"" To let us set some settings only once. {{{
    if exists("isRunning")
        let isFirstRun = 0
    else
        let isFirstRun = 1
    endif
    let isRunning = 1
" }}}

Perhaps there already is something for this 'isFirstRun'?

RymdPung
<sarcastic> Yeees, that looks much simpler, for a colorscheme you're using periodically :) ... Btw, if you don't want to change the original file (why?), why not just make a version 2 of it and change it in there. I really don't see why the need for all this problem making out of nothing.
ldigas
There was no work in doing this compared to the annoyance of "manually" adjusting schemes as you change to them, or bringing along my changes to schemes as i update them (which i would have to manually do if i overwrote it or named it something else).I'm glad for you that you are not as picky about your setup as I am.. ; )
RymdPung