From 8c188324068b9d931a8b4f21027823881c83e3c4 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 10 Jul 2014 18:02:43 -0700 Subject: [PATCH] Updated Customization (markdown) --- Customization.md | 92 ++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 58 deletions(-) diff --git a/Customization.md b/Customization.md index 23ab200..fc00661 100644 --- a/Customization.md +++ b/Customization.md @@ -24,7 +24,40 @@ endfunction let g:goyo_callbacks = [function('Goyo_before'), function('Goyo_after')] ``` -## Quit Vim on `:q` if it's the only remaining buffer +## Disabling plugins + +### MiniBufExpl with `g:miniBufExplBuffersNeeded` set + +```vim +function! GoyoBefore() + MBEClose + wincmd w +endfunction + +let g:goyo_callbacks = [function('GoyoBefore')] +``` + +### ZoomWin + +- by [EPNGH](https://github.com/EPNGH) + +```vim +function! GoyoBefore() + delcommand ZoomWin + delcommand ZoomWin +endfunction + +function! GoyoAfter() + command! ZoomWin call ZoomWin() + command! ZoomWin call ZoomWin() +endfunction + +let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')] +``` + +## Ensure `:q` to quit even when Goyo is active + +Suggested by [mm2703](https://github.com/mm2703) and [axelGschaider](https://github.com/axelGschaider) in [#16](https://github.com/junegunn/goyo.vim/issues/16) ```vim function! GoyoBefore() @@ -47,60 +80,3 @@ endfunction let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')] ``` - -## Disabling plugins - -### MiniBufExpl with `g:miniBufExplBuffersNeeded` set - -```vim -function! s:goyo_before() - MBEClose - wincmd w -endfunction - -let g:goyo_callbacks = [function('s:goyo_before')] -``` - -### ZoomWin - -- by [EPNGH](https://github.com/EPNGH) - -```vim -function! Goyo_before() - delcommand ZoomWin - delcommand ZoomWin -endfunction - -function! Goyo_after() - command! ZoomWin call ZoomWin() - command! ZoomWin call ZoomWin() -endfunction - -let g:goyo_callbacks = [function('Goyo_before'), function('Goyo_after')] -``` - -## Ensure `:q` to quit even when Goyo is active - -Suggested by [mm2703](https://github.com/mm2703) and [axelGschaider](https://github.com/axelGschaider) in [#16](https://github.com/junegunn/goyo.vim/issues/16) - -```vim -function! Goyo_before() - let b:quitting = 0 - let b:quitting_bang = 0 - autocmd QuitPre let b:quitting = 1 - cabbrev q! let b:quitting_bang = 1 q! -endfunction - -function! Goyo_after() - " Quit Vim if this is the only remaining buffer - if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 - if b:quitting_bang - qa! - else - qa - endif - endif -endfunction - -let g:goyo_callbacks = [function('Goyo_before'), function('Goyo_after')] -```