Both background and colorscheme in ~/.vimrc
are badly misbehaving!
I have setup solarized to work on vim and it can manually toggle between background light/dark. My general settings in ~/.vimrc
are:
Plug 'altercation/vim-colors-solarized' "I use plug.vim
syntax enable
set background=light
set t_Co=256
let g:solarized_termcolors=256
Operating system: Ubuntu 14.04.; xterm and works well with 256 colors.
I'm trying to map in ~/.vimrc
background toggling. For this purpose :help solarized (in vim) suggests to use:
call togglebg#map("<F9>")
but this doesn't work because it changes the colorscheme from solarized to default (my intention was to toggle only in solarized between dark and light).
So I remove from ~/.vimrc call togglebg#map("<F9>")
and replaced it with what most google/superuser/vim.wikia commentators, in various flavors, have suggested with the following:
function! BgToggleSol()
if (&background == "light")
set background=dark
else
set background=light
endif
endfunction
nnoremap <silent> <leader>sz :call BgToggleSol()<cr>
colorscheme solarized
But this has the same problem (that toggling resets colorscheme to default). While if colorscheme solarized is executed directly after set background=...
in the if else endif
clause then the background stops toggling between dark/light.
I must have exhausted nearly all possibilities, but the problem is still not going away.
Any suggestion is very welcome. Thanks in advance.