Changing Vim Airline colorscheme on filetype

653 Views Asked by At

Quick possibly simple question I have set my vimrc to change the colorscheme when different filetypes are loaded; (don't ask me why but my brain sets itself to the respective language dependent on color) In order to do this I used the logical autocmd as follows

120 "Filetype Color Automations
121 autocmd Bufenter * colorscheme default
122 autocmd bufenter *.bat colorscheme 256_noir
123 autocmd Bufenter *.ps1 colorscheme solarized8_dark_low
124 autocmd Bufenter *.sh colorscheme zenburn
125 autocmd Bufenter *.html colorscheme jellybeans
126 autocmd bufenter *.css colorscheme onedark
127 autocmd Bufenter *.js colorscheme badwolf
128 autocmd Bufenter *.py colorscheme gruvbox
129 autocmd Bufenter *.java colorscheme sierra
130 "Airline Filetype Automations
131 autocmd Bufenter *.bat let g:airline_theme '256_noir'
132 autocmd Bufenter *.ps1 let g:airline_theme 'solarized8_dark_low'
133 autocmd Bufenter *.sh let g:airline_theme 'zenburn'
134 autocmd Bufenter *.html let g:airline_theme 'jellybeans'
135 autocmd Bufenter *.css let g:airline_theme 'onedark'
136 autocmd Bufenter *.js let g:airline_theme 'badwolf'
137 autocmd Bufenter *.py let g:airline_theme 'gruvbox'

Its placed at the bottom of my relatively smallish vimrc and plugins are sourced above using a dot file - which appears to load in first. For some reason completely beyond me however whilst the colorshemes are working the airline themes don't want to play ball at all; The closest I've come to finding a solution is the following

function! Sunset_daytime_callback()

      " This Works :)
      colorscheme vim_colorscheme_light
      if exists(':AirlineTheme') " check if the plugin is loaded
          :AirlineTheme light
      else
          let g:airline_theme = 'light'
      endif
    
    endfunction 

Though I would assume because the plugins already loaded this wouldn't really require a function; Anyone got any good ideas because I'm all out and the simple airline theme really isn't for me.

0

There are 0 best solutions below