aboutsummaryrefslogtreecommitdiff
path: root/autoload/cursorline_current.vim
blob: c8bec6f3da996953135c5cee79baf64610478401 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
" Suspend 'cursorline' when a window is inactive or inserting
function! cursorline_current#Suspend() abort
  let w:cursorline = &l:cursorline
  let &l:cursorline = 0
endfunction

" Restore 'cursorline' when a window is active and non-insert
function! cursorline_current#Restore() abort
  let &l:cursorline = get(w:, 'cursorline', &g:cursorline)
endfunction

" Call cursorline_current#Suspend() on all windows besides the current one
function! cursorline_current#Load() abort
  let wcur = winnr()
  windo if winnr('.') != wcur | call cursorline_current#Suspend() | endif
  execute wcur . 'wincmd w'
endfunction