aboutsummaryrefslogtreecommitdiff
path: root/plugin/cursorline_current.vim
blob: ff2e7e558b63cd398b1bf76bd9b29b9e19cfc5b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"
" cursorline_current: If 'cursorline' is globally on, only enable it for the
" current window, and only when not in insert mode.  Essentially, make
" 'cursorline' follow the actual normal-mode cursor as much as possible.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('loaded_cursorline_current') || &compatible || v:version < 700
  finish
endif
let loaded_cursorline_current = 1

augroup cursorline_current
  autocmd!
  autocmd VimEnter *
        \ if winnr('$') > 1 | call cursorline_current#Load() | endif
  autocmd InsertLeave,WinEnter,FocusGained *
        \ if winnr('$') > 1 | call cursorline_current#Restore() | endif
  autocmd InsertEnter,WinLeave,FocusLost,BufEnter *
        \ call cursorline_current#Suspend()
augroup END