aboutsummaryrefslogtreecommitdiff
path: root/plugin/cursorline_current.vim
blob: db777d17ab9b0bea86b22d05e64db8ebd7872092 (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
        \ * call cursorline_current#Load()
  autocmd InsertEnter,WinLeave,FocusLost
        \ * call cursorline_current#Suspend()
  autocmd InsertLeave,WinEnter,FocusGained,BufEnter
        \ * call cursorline_current#Restore()
augroup END