mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-15 14:53:50 -05:00
Add g:goyo_height and deprecate g:goyo_margin_{top,bottom}
This commit is contained in:
@@ -58,6 +58,7 @@ Configuration
|
||||
-------------
|
||||
|
||||
- `g:goyo_width` (default: 80)
|
||||
- `g:goyo_height` (default: 85%)
|
||||
- `g:goyo_linenr` (default: 0)
|
||||
|
||||
### Callbacks
|
||||
|
||||
@@ -374,12 +374,20 @@ function! s:relsz(expr, limit)
|
||||
endfunction
|
||||
|
||||
function! s:parse_arg(arg)
|
||||
if exists('g:goyo_height') || !exists('g:goyo_margin_top') && !exists('g:goyo_margin_bottom')
|
||||
let height = s:relsz(get(g:, 'goyo_height', '85%'), &lines)
|
||||
let yoff = 0
|
||||
else
|
||||
let top = max([0, s:relsz(get(g:, 'goyo_margin_top', 4), &lines)])
|
||||
let bot = max([0, s:relsz(get(g:, 'goyo_margin_bottom', 4), &lines)])
|
||||
let height = &lines - top - bot
|
||||
let yoff = top - bot
|
||||
endif
|
||||
|
||||
let dim = { 'width': s:relsz(get(g:, 'goyo_width', 80), &columns),
|
||||
\ 'height': &lines - top - bot,
|
||||
\ 'height': height,
|
||||
\ 'xoff': 0,
|
||||
\ 'yoff': top - bot }
|
||||
\ 'yoff': yoff }
|
||||
if empty(a:arg)
|
||||
return dim
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user