junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.49k stars 115 forks source link

Error when entering Goyo on BufRead #207

Open kiwiz opened 4 years ago

kiwiz commented 4 years ago

I get the following error with an autocmd to enter Goyo:

Error detected while processing function lightline#update_disable

Vimrc to repro:

call plug#begin('~/.vim/plugged')
    Plug 'itchyny/lightline.vim'
    Plug 'junegunn/goyo.vim'
call plug#end()
au BufRead,BufNewFile * Goyo
kiwiz commented 4 years ago

Ah, digging into it, looks like it's because lightline isn't loaded for the buffer yet when Goyo runs?

kiwiz commented 4 years ago

Adding something like this works, but maybe there's a cleaner way:

au WinEnter,BufEnter * call lightline#init()                                                           
au WinEnter,BufEnter * Goyo