aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/cursorline_current.vim17
1 files changed, 4 insertions, 13 deletions
diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim
index 828c581..be560b5 100644
--- a/plugin/cursorline_current.vim
+++ b/plugin/cursorline_current.vim
@@ -16,23 +16,14 @@ let g:loaded_cursorline_current = 1
" Suspend 'cursorline' when a window is inactive or inserting
function! s:Suspend() abort
- let w:cursorline_current_cache = &l:cursorline
- setlocal nocursorline
+ let w:cursorline_current = &l:cursorline
+ let &l:cursorline = 0
endfunction
" Restore 'cursorline' when a window is active and non-insert
function! s:Restore() abort
-
- " If we don't have a value for 'cursorline' from a previous s:Suspend(), use
- " the global value as the default
- if !exists('w:cursorline_current_cache')
- let w:cursorline_current_cache = &g:cursorline
- endif
-
- " Restore local value to the cached value and clear it
- let &l:cursorline = w:cursorline_current_cache
- unlet w:cursorline_current_cache
-
+ let &l:cursorline = get(w:, 'cursorline_current', &g:cursorline)
+ let w:cursorline_current = &l:cursorline
endfunction
" Call s:Suspend() on all windows besides the current one