mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-18 16:43:06 -05:00
Updated Customization (markdown)
@@ -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 <Plug>ZoomWin
|
||||
endfunction
|
||||
|
||||
function! GoyoAfter()
|
||||
command! ZoomWin call ZoomWin()
|
||||
command! <Plug>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 <Plug>ZoomWin
|
||||
endfunction
|
||||
|
||||
function! Goyo_after()
|
||||
command! ZoomWin call ZoomWin()
|
||||
command! <Plug>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 <buffer> let b:quitting = 1
|
||||
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> 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')]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user