Updated Customization (markdown)

Junegunn Choi
2014-08-10 10:16:38 -07:00
parent 783562e20a
commit f0f7b33446

@@ -1,7 +1,7 @@
## Callbacks for GVim ## Callbacks for GVim
```vim ```vim
function! GoyoBefore() function! s:goyo_enter()
if has('gui_running') if has('gui_running')
set fullscreen set fullscreen
set background=light set background=light
@@ -21,7 +21,8 @@ function! GoyoAfter()
endif endif
endfunction endfunction
let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')] autocmd User GoyoEnter call <SID>goyo_enter()
autocmd User GoyoLeave call <SID>goyo_leave()
``` ```
## Disabling plugins ## Disabling plugins
@@ -29,12 +30,12 @@ let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')]
### MiniBufExpl with `g:miniBufExplBuffersNeeded` set ### MiniBufExpl with `g:miniBufExplBuffersNeeded` set
```vim ```vim
function! GoyoBefore() function! s:goyo_enter()
MBEClose MBEClose
wincmd w wincmd w
endfunction endfunction
let g:goyo_callbacks = [function('GoyoBefore')] autocmd User GoyoEnter call <SID>goyo_enter()
``` ```
### ZoomWin ### ZoomWin
@@ -42,17 +43,18 @@ let g:goyo_callbacks = [function('GoyoBefore')]
- by [EPNGH](https://github.com/EPNGH) - by [EPNGH](https://github.com/EPNGH)
```vim ```vim
function! GoyoBefore() function! s:goyo_enter()
delcommand ZoomWin delcommand ZoomWin
delcommand <Plug>ZoomWin delcommand <Plug>ZoomWin
endfunction endfunction
function! GoyoAfter() function! s:goyo_leave()
command! ZoomWin call ZoomWin() command! ZoomWin call ZoomWin()
command! <Plug>ZoomWin call ZoomWin() command! <Plug>ZoomWin call ZoomWin()
endfunction endfunction
let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')] autocmd User GoyoEnter call <SID>goyo_enter()
autocmd User GoyoLeave call <SID>goyo_leave()
``` ```
## Ensure `:q` to quit even when Goyo is active ## Ensure `:q` to quit even when Goyo is active
@@ -60,14 +62,14 @@ let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')]
Suggested by [mm2703](https://github.com/mm2703) and [axelGschaider](https://github.com/axelGschaider) in [#16](https://github.com/junegunn/goyo.vim/issues/16) Suggested by [mm2703](https://github.com/mm2703) and [axelGschaider](https://github.com/axelGschaider) in [#16](https://github.com/junegunn/goyo.vim/issues/16)
```vim ```vim
function! GoyoBefore() function! s:goyo_enter()
let b:quitting = 0 let b:quitting = 0
let b:quitting_bang = 0 let b:quitting_bang = 0
autocmd QuitPre <buffer> let b:quitting = 1 autocmd QuitPre <buffer> let b:quitting = 1
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q! cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction endfunction
function! GoyoAfter() function! s:goyo_leave()
" Quit Vim if this is the only remaining buffer " Quit Vim if this is the only remaining buffer
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
if b:quitting_bang if b:quitting_bang
@@ -78,5 +80,6 @@ function! GoyoAfter()
endif endif
endfunction endfunction
let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')] autocmd User GoyoEnter call <SID>goyo_enter()
autocmd User GoyoLeave call <SID>goyo_leave()
``` ```