altercation / vim-colors-solarized

precision colorscheme for the vim text editor
http://ethanschoonover.com/solarized
6.58k stars 1.75k forks source link

Switch to dark mode on Insert #183

Closed snoblenet closed 7 years ago

snoblenet commented 7 years ago

I have the following in my vimrc:

au InsertEnter * set background=dark
au InsertLeave * set background=light

This changes the background colour of the cursor line and the line numbers, but not of the screen as a whole. Any tips for me?

I'm using Mac OS X Terminal with Solarized Light as the colour theme and xterm-256 color as the terminal type.

Enter vimrc below:

set nocompatible 
au BufNewFile,BufRead *.txt set filetype=text
filetype off 
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
  Plugin 'VundleVim/Vundle.vim'
  Plugin 'pangloss/vim-javascript'
    let g:javascript_plugin_jsdoc = 1
  Plugin '1995eaton/vim-better-javascript-completion'
  Plugin 'ludovicchabant/vim-gutentags'
    set statusline+=%{gutentags#statusline()}
  Plugin 'majutsushi/tagbar'
    let g:tagbar_autoclose = 1
  Plugin 'altercation/vim-colors-solarized'
    let g:solarized_termcolors= 16
    let g:solarized_termtrans = 16
    let g:solarized_bold = 1
    let g:solarized_underline = 1 
    let g:solarized_italic = 1
    let g:solarized_contrast = "high"
    let g:solarized_visibility= "high"
  Plugin 'vim-airline/vim-airline'
  Plugin 'vim-airline/vim-airline-themes'
    let g:airline_theme='base16_solarized'
  Plugin 'tpope/vim-commentary'
  Plugin 'tpope/vim-fugitive'
  Plugin 'moll/vim-node'
  Plugin 'danro/rename.vim'
  Plugin 'chrisbra/Recover.vim'
  Plugin 'ternjs/tern_for_vim'
  Plugin 'Valloric/YouCompleteMe'
  Plugin 'vim-syntastic/syntastic'
    set statusline+=%#warningmsg#
    set statusline+=%{SyntasticStatuslineFlag()}
    set statusline+=%*
    let g:syntastic_always_populate_loc_list=1
    let g:syntastic_auto_loc_list=1
    let g:syntastic_check_on_open=1
    let g:syntastic_check_on_wq=0
call vundle#end() 
  syntax enable
  set background=light
  colorscheme solarized
filetype plugin indent on 

set number
set wrap
set breakindent
set autoindent
set shiftwidth=2
set linebreak
set nolist
set cursorline
set cursorcolumn
set lines=999
set ruler
set laststatus=2
set timeoutlen=1000 ttimeoutlen=0
set splitright
set updatetime=200
set clipboard=unnamed

" Hit return to create new line without entering insert mode
nmap <CR> o<Esc>

" Open and quickly edit cheat sheet file
nmap :cheat :78vsp ~/.vim/cheat.txt

nmap :tt :TagbarToggle

au InsertEnter * set background=dark
au InsertLeave * set background=light
snoblenet commented 7 years ago

Solved this by: