mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-17 07:43:42 -05:00
Allow users to define custom before/after callbacks (#3)
This commit is contained in:
25
README.md
25
README.md
@@ -26,6 +26,31 @@ Configuration
|
|||||||
- `g:goyo_margin_top` (default: 4)
|
- `g:goyo_margin_top` (default: 4)
|
||||||
- `g:goyo_margin_bottom` (default: 4)
|
- `g:goyo_margin_bottom` (default: 4)
|
||||||
- `g:goyo_linenr` (default: 0)
|
- `g:goyo_linenr` (default: 0)
|
||||||
|
- `g:goyo_callbacks` ([before_funcref, after_funcref])
|
||||||
|
|
||||||
|
### Callbacks
|
||||||
|
|
||||||
|
By default, [vim-airline](https://github.com/bling/vim-airline),
|
||||||
|
[vim-powerline](https://github.com/Lokaltog/vim-powerline),
|
||||||
|
[powerline](https://github.com/Lokaltog/powerline), and
|
||||||
|
[vim-gitgutter](https://github.com/airblade/vim-gitgutter) are temporarily
|
||||||
|
disabled while in Goyo mode.
|
||||||
|
|
||||||
|
If you have other plugins that you want to disable/enable, or if you want to
|
||||||
|
change the default settings of Goyo window, you can define before and after
|
||||||
|
callbacks as follows in your .vimrc.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
function! s:goyo_before()
|
||||||
|
"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:goyo_after()
|
||||||
|
"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let g:goyo_callbacks = [function('s:goyo_before'), function('s:goyo_after')]
|
||||||
|
```
|
||||||
|
|
||||||
Inspiration
|
Inspiration
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ function! s:goyo_on(width)
|
|||||||
|
|
||||||
let &statusline = repeat(' ', winwidth(0))
|
let &statusline = repeat(' ', winwidth(0))
|
||||||
|
|
||||||
|
if exists('g:goyo_callbacks[0]')
|
||||||
|
call g:goyo_callbacks[0]()
|
||||||
|
endif
|
||||||
|
|
||||||
augroup goyo
|
augroup goyo
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWinLeave <buffer> call s:goyo_off()
|
autocmd BufWinLeave <buffer> call s:goyo_off()
|
||||||
@@ -231,6 +235,10 @@ function! s:goyo_off()
|
|||||||
if exists('#Powerline')
|
if exists('#Powerline')
|
||||||
doautocmd Powerline ColorScheme
|
doautocmd Powerline ColorScheme
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists('g:goyo_callbacks[1]')
|
||||||
|
call g:goyo_callbacks[1]()
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:goyo(...)
|
function! s:goyo(...)
|
||||||
|
|||||||
Reference in New Issue
Block a user