diff --git a/Customization.md b/Customization.md index 0caab78..695bbb7 100644 --- a/Customization.md +++ b/Customization.md @@ -75,15 +75,16 @@ let g:goyo_callbacks = [function('g:goyo_before'), function('g:goyo_after')] Suggested by [mm2703](https://github.com/mm2703) and [axelGschaider](https://github.com/axelGschaider) in [#16](https://github.com/junegunn/goyo.vim/issues/16) ```vim -" Quitting whether Goyo is active or not -ca wq :w:call Quit() -ca q :call Quit() -function! Quit() - if exists('#goyo') - Goyo - endif - quit +function! g:goyo_before() + " ... endfunction -``` -Or you can use `:qa` or `:wqa` instead of `:q` and `:wq`. \ No newline at end of file +function! g:goyo_after() + " Quit Vim if this is the only remaining buffer + if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 + qa + endif +endfunction + +let g:goyo_callbacks = [function('g:goyo_before'), function('g:goyo_after')] +```