diff --git a/plugin/goyo.vim b/plugin/goyo.vim index 4f8ef87..c64d4aa 100644 --- a/plugin/goyo.vim +++ b/plugin/goyo.vim @@ -64,7 +64,8 @@ function! s:setup_pad(bufnr, vert, size) execute win . 'wincmd w' execute (a:vert ? 'vertical ' : '') . 'resize ' . max([0, a:size]) augroup goyop - autocmd WinEnter,CursorMoved call s:blank() + autocmd WinEnter,CursorMoved nested call s:blank() + autocmd WinLeave call s:hide_statusline() augroup END " To hide scrollbars of pad windows in GVim @@ -114,6 +115,10 @@ function! s:tranquilize() endfor endfunction +function! s:hide_statusline() + let &l:statusline = repeat(' ', winwidth(0)) +endfunction + function! s:goyo_on(width) let s:orig_tab = tabpagenr() @@ -131,7 +136,6 @@ function! s:goyo_on(width) \ 'winwidth': &winwidth, \ 'winminheight': &winminheight, \ 'winheight': &winheight, - \ 'statusline': &statusline, \ 'ruler': &ruler, \ 'sidescroll': &sidescroll, \ 'sidescrolloff': &sidescrolloff @@ -211,16 +215,16 @@ function! s:goyo_on(width) call s:resize_pads() call s:tranquilize() - let &statusline = repeat(' ', winwidth(0)) - augroup goyo autocmd! autocmd BufWinLeave call s:goyo_off() autocmd TabLeave * call s:goyo_off() autocmd VimResized * call s:resize_pads() autocmd ColorScheme * call s:tranquilize() + autocmd WinEnter,WinLeave call s:hide_statusline() augroup END + call s:hide_statusline() if exists('g:goyo_callbacks[0]') call g:goyo_callbacks[0]() endif