I have installed gruvbox using vim-plug, then I installed Airline and set the theme following the recommendations. But every time I close Vim and open it, the theme for Airline is reset to default and I don't know what is happening. Here is my vimrc file

set nocompatible
syntax enable
filetype plugin on
filetype on
set path+=**
set wildmenu
set hlsearch
set directory=$HOME/vimfiles/swp//

let g:netrw_banner=0
let g:netrw_browse_split=4
let g:netrw_altv=1
let g:netrw_liststyle=3
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide=',\(^\|\s\s\)\zs\.\S\+'

"Para mover entre buffers
nnoremap <C-U> :bprev<CR>
nnoremap <C-D> :bnext<CR>

"Para mover entre ventanas
nnoremap <C-H> <C-W><C-H>
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>

set nu
set rnu

set colorcolumn=80

if has('gui_running')
  set guifont=Fantasque_sans_mono:h12

set laststatus=2
set statusline=
set statusline+=\ %f
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\[%{&fileformat}\]

set nobomb
set encoding=utf-8
setglobal fileencoding=utf-8
set spelllang=es_MX

exec "set listchars=tab:\uA6-,nbsp:_,trail:."
set list

" plugins"
call plug#begin('~\vimfiles\plugged')
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
call plug#end()

autocmd vimenter * colorscheme gruvbox
set background=dark
let g:airline_theme='gruvbox'

The gruvbox theme outside the status line works every time. I'm using Windows 10 pro

  • 1
    Does it work if instead of autocmd vimenter * colorscheme gruvbox you just use directly colorscheme gruvbox? I don't see why this would need to be in a VimEnter autocmd, it should work directly from your vimrc... – filbranden Jul 3 at 0:35
  • @filbranden Apparently this solves the issue, no problems so far. I use autocmd... because I was following gruvbox installation guide – Luis Victoria Jul 3 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.