I have this in my .vimrc:
augroup filetype_colorscheme
au BufEnter *
\ if !exists('b:colors_name')
\ | if &ft == "vim"
\ | let b:colors_name = 'color_dark'
\ | else
\ | let b:colors_name = 'color_light'
\ | endif
\ | endif
\ | exe 'colorscheme' b:colors_name
augroup END
What it does:
When I open a .vim page it opens my dark colorscheme “color_dark.vim”
when I open whatever other page it opens my light colorscheme “color_light.vim”
This is very nice but it is not so nice in split windows.
Every time when I click in a split window with p.e. a text file, all split windows become light colored with the light colorscheme (even the .vim files).
When I switch to a vim file in a split window all other files in the other split windows become dark as well.
Is it possible to retain every filetype his own colorscheme in a split window?
What do I have to change in above code?
EDIT
If this is not possible would it be possible to disable above code when I enter in a split window? (in order to let me choose the colorscheme myself, the same for all split windows)
Colorschemes will always affect the entire vim instance. It is not possible to have a different color scheme per split window.
Edit 1: To answer your second question in the edit, you can probably add
&& winnr('$') == 1to that firstifto stop this from happening when you have multiple split windows open.Edit 2: Whoops, the edit above would not work, however I think wrapping everything in another
ifshould.Edit 3: Missed a couple of pipes.