mirror of
https://github.com/junegunn/limelight.vim.git
synced 2025-11-13 13:33:48 -05:00
Merge pull request #18 from pgdouyon/master
Exclude whitespace-only lines from Limelight range
This commit is contained in:
@@ -43,19 +43,23 @@ function! s:unsupported()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:getpos()
|
function! s:getpos()
|
||||||
let span = max([0, get(g:, 'limelight_paragraph_span', 0) - empty(getline('.'))])
|
let span = max([0, get(g:, 'limelight_paragraph_span', 0) - s:empty(getline('.'))])
|
||||||
let pos = getpos('.')
|
let pos = getpos('.')
|
||||||
for _ in range(0, span)
|
for _ in range(0, span)
|
||||||
let start = searchpos('^$', 'bW')[0]
|
let start = searchpos('^\s*$', 'bW')[0]
|
||||||
endfor
|
endfor
|
||||||
call setpos('.', pos)
|
call setpos('.', pos)
|
||||||
for _ in range(0, span)
|
for _ in range(0, span)
|
||||||
let end = searchpos('^$', 'W')[0]
|
let end = searchpos('^\s*$', 'W')[0]
|
||||||
endfor
|
endfor
|
||||||
call setpos('.', pos)
|
call setpos('.', pos)
|
||||||
return [start, end]
|
return [start, end]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:empty(line)
|
||||||
|
return (a:line =~# '^\s*$')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:limelight()
|
function! s:limelight()
|
||||||
if !empty(get(w:, 'limelight_range', []))
|
if !empty(get(w:, 'limelight_range', []))
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user