Add g:goyo_height and deprecate g:goyo_margin_{top,bottom}

This commit is contained in:
Junegunn Choi
2015-05-05 22:59:00 +09:00
parent dbcb337b22
commit f660ca376e
2 changed files with 13 additions and 4 deletions

View File

@@ -58,6 +58,7 @@ Configuration
------------- -------------
- `g:goyo_width` (default: 80) - `g:goyo_width` (default: 80)
- `g:goyo_height` (default: 85%)
- `g:goyo_linenr` (default: 0) - `g:goyo_linenr` (default: 0)
### Callbacks ### Callbacks

View File

@@ -374,12 +374,20 @@ function! s:relsz(expr, limit)
endfunction endfunction
function! s:parse_arg(arg) function! s:parse_arg(arg)
let top = max([0, s:relsz(get(g:, 'goyo_margin_top', 4), &lines)]) if exists('g:goyo_height') || !exists('g:goyo_margin_top') && !exists('g:goyo_margin_bottom')
let bot = max([0, s:relsz(get(g:, 'goyo_margin_bottom', 4), &lines)]) 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), let dim = { 'width': s:relsz(get(g:, 'goyo_width', 80), &columns),
\ 'height': &lines - top - bot, \ 'height': height,
\ 'xoff': 0, \ 'xoff': 0,
\ 'yoff': top - bot } \ 'yoff': yoff }
if empty(a:arg) if empty(a:arg)
return dim return dim
endif endif