From 895e7a2e5beea6522669d6a5c6b0d19add6acb73 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 8 Apr 2014 18:15:31 -0700 Subject: [PATCH] Updated Customization (markdown) --- Customization.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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')] +```