mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-18 00:03:42 -05:00
Updated Customization (markdown)
@@ -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)
|
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
|
||||||
" Quitting whether Goyo is active or not
|
function! g:goyo_before()
|
||||||
ca wq :w<cr>:call Quit()<cr>
|
" ...
|
||||||
ca q :call Quit()<cr>
|
|
||||||
function! Quit()
|
|
||||||
if exists('#goyo')
|
|
||||||
Goyo
|
|
||||||
endif
|
|
||||||
quit
|
|
||||||
endfunction
|
endfunction
|
||||||
```
|
|
||||||
|
|
||||||
Or you can use `:qa` or `:wqa` instead of `:q` and `:wq`.
|
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')]
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user