Add g:limelight_paragraph_span (#12)

This commit is contained in:
Junegunn Choi
2015-02-18 02:54:32 +09:00
parent faa85b1d1f
commit 64d1b28b93
2 changed files with 18 additions and 1 deletions

View File

@@ -35,6 +35,9 @@ let g:limelight_conceal_guifg = '#777777'
" Default: 0.5
let g:limelight_default_coefficient = 0.7
" Number of preceding/following paragraphs to include (default: 0)
let g:limelight_paragraph_span = 1
```
Goyo.vim integration

View File

@@ -42,6 +42,20 @@ function! s:unsupported()
endif
endfunction
function! s:getpos()
let span = max([0, get(g:, 'limelight_paragraph_span', 0) - empty(getline('.'))])
let pos = getpos('.')
for _ in range(0, span)
let start = searchpos('^$', 'bW')[0]
endfor
call setpos('.', pos)
for _ in range(0, span)
let end = searchpos('^$', 'W')[0]
endfor
call setpos('.', pos)
return [start, end]
endfunction
function! s:limelight()
if !exists('w:limelight_prev')
let w:limelight_prev = [0, 0, 0, 0]
@@ -55,7 +69,7 @@ function! s:limelight()
return
endif
let paragraph = [searchpos('^$', 'bnW')[0], searchpos('^$', 'nW')[0]]
let paragraph = s:getpos()
if paragraph ==# w:limelight_prev[2 : 3]
return
endif