mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-18 00:03:42 -05:00
Updated Customization (markdown)
@@ -1,7 +1,7 @@
|
||||
## Callbacks for GVim
|
||||
|
||||
```vim
|
||||
function! GoyoBefore()
|
||||
function! s:goyo_enter()
|
||||
if has('gui_running')
|
||||
set fullscreen
|
||||
set background=light
|
||||
@@ -21,7 +21,8 @@ function! GoyoAfter()
|
||||
endif
|
||||
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
|
||||
@@ -29,12 +30,12 @@ let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')]
|
||||
### MiniBufExpl with `g:miniBufExplBuffersNeeded` set
|
||||
|
||||
```vim
|
||||
function! GoyoBefore()
|
||||
function! s:goyo_enter()
|
||||
MBEClose
|
||||
wincmd w
|
||||
endfunction
|
||||
|
||||
let g:goyo_callbacks = [function('GoyoBefore')]
|
||||
autocmd User GoyoEnter call <SID>goyo_enter()
|
||||
```
|
||||
|
||||
### ZoomWin
|
||||
@@ -42,17 +43,18 @@ let g:goyo_callbacks = [function('GoyoBefore')]
|
||||
- by [EPNGH](https://github.com/EPNGH)
|
||||
|
||||
```vim
|
||||
function! GoyoBefore()
|
||||
function! s:goyo_enter()
|
||||
delcommand ZoomWin
|
||||
delcommand <Plug>ZoomWin
|
||||
endfunction
|
||||
|
||||
function! GoyoAfter()
|
||||
function! s:goyo_leave()
|
||||
command! ZoomWin call ZoomWin()
|
||||
command! <Plug>ZoomWin call ZoomWin()
|
||||
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
|
||||
@@ -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)
|
||||
|
||||
```vim
|
||||
function! GoyoBefore()
|
||||
function! s:goyo_enter()
|
||||
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! GoyoAfter()
|
||||
function! s:goyo_leave()
|
||||
" 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
|
||||
@@ -78,5 +80,6 @@ function! GoyoAfter()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')]
|
||||
autocmd User GoyoEnter call <SID>goyo_enter()
|
||||
autocmd User GoyoLeave call <SID>goyo_leave()
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user