Customizable paragraph boundary

Close #20
This commit is contained in:
Junegunn Choi
2015-07-30 23:35:53 +09:00
parent 9f57165a38
commit 487515a1de
2 changed files with 11 additions and 3 deletions

View File

@@ -48,6 +48,12 @@ let g:limelight_default_coefficient = 0.7
" Number of preceding/following paragraphs to include (default: 0)
let g:limelight_paragraph_span = 1
" Beginning/end of paragraph
" When there's no empty line between the paragraphs
" and each paragraph starts with indentation
let g:limelight_bop = '^\s'
let g:limelight_eop = '\ze\n^\s'
```
Goyo.vim integration

View File

@@ -43,14 +43,16 @@ function! s:unsupported()
endfunction
function! s:getpos()
let bop = get(g:, 'limelight_bop', '^\s*$\n\zs')
let eop = get(g:, 'limelight_eop', '^\s*$')
let span = max([0, get(g:, 'limelight_paragraph_span', 0) - s:empty(getline('.'))])
let pos = getpos('.')
for _ in range(0, span)
let start = searchpos('^\s*$', 'bW')[0]
for i in range(0, span)
let start = searchpos(bop, i == 0 ? 'cbW' : 'bW')[0]
endfor
call setpos('.', pos)
for _ in range(0, span)
let end = searchpos('^\s*$', 'W')[0]
let end = searchpos(eop, 'W')[0]
endfor
call setpos('.', pos)
return [start, end]