Closed deiwin closed 9 years ago
diff --git a/autoload/limelight.vim b/autoload/limelight.vim
index d447950..d17c1ce 100644
--- a/autoload/limelight.vim
+++ b/autoload/limelight.vim
@@ -62,7 +62,15 @@ function! s:empty(line)
return (a:line =~# '^\s*$')
endfunction
+function! s:bufmatch()
+ return !get(g:, 'limelight_buffer_local', 0) || bufnr('') == s:bufnr
+endfunction
+
function! s:limelight()
+ if !s:bufmatch()
+ return
+ endif
+
if !empty(get(w:, 'limelight_range', []))
return
endif
@@ -212,6 +220,7 @@ function! s:on(range, ...)
call call('s:hl', a:range)
endif
+ let s:bufnr = bufnr('')
augroup limelight
let was_on = exists('#limelight#CursorMoved')
autocmd!
@@ -230,6 +239,7 @@ function! s:on(range, ...)
augroup limelight_cleanup
autocmd!
autocmd WinEnter * call s:cleanup()
+ autocmd BufEnter * if !s:bufmatch() | call s:clear_hl() | endif
augroup END
doautocmd CursorMoved
You can apply this patch and set g:limelight_buffer_local
. I currently don't feel like adding it to master.
That's perfect. Thanks!
Okay, maybe not perfect :) Toggling limelight, while it's enabled in a different buffer than the current one, will disable it in that other buffer and doesn't do anything in the current one.
Ah, too bad :) I don't want to add the feature because I basically don't need it and it makes the state transition more complex. Feel free to fork the repo if you need it.
That's understandable :) I'll see how much it pains me to go without the feature.
Would it be possible to, say, jump between splits while having limelight enabled in only one of them?