diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 22:22:59 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 22:24:14 +1200 |
commit | 03ce9988ddbea0ab4f055ac035d80dea449012aa (patch) | |
tree | 5394b7025024ae2f6ac4c666c940227cbb606e9a /plugin | |
parent | Merge branch 'release/v1.0.0' into develop (diff) | |
download | vim-cursorline-current-03ce9988ddbea0ab4f055ac035d80dea449012aa.tar.gz vim-cursorline-current-03ce9988ddbea0ab4f055ac035d80dea449012aa.zip |
Refactor and simplify, remove autoload
Drop support for local values for 'cursorline'.
I think I'm getting better at this.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/cursorline_current.vim | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim index ed590b8..f7298b3 100644 --- a/plugin/cursorline_current.vim +++ b/plugin/cursorline_current.vim @@ -1,33 +1,16 @@ -" -" 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 -" Set up hooks augroup cursorline_current autocmd! - - " Toggle local 'cursorline' state to follow window focus - autocmd InsertLeave,WinEnter,FocusGained * - \ call cursorline_current#Restore() - autocmd InsertEnter,WinLeave,FocusLost * - \ call cursorline_current#Suspend() - - " If Vim opens with more than one window, set them up correctly + autocmd BufEnter,FocusGained,InsertLeave,WinEnter * + \ let &l:cursorline = &g:cursorline + autocmd BufLeave,FocusGained,InsertEnter,WinLeave * + \ let &l:cursorline = 0 autocmd VimEnter * - \ if winnr('$') > 1 | call cursorline_current#Load() | endif - - " Restore the window setting on re-entering a window onto an existing - " buffer, if there is more than one buffer - autocmd BufEnter * - \ if winnr('$') > 1 | call cursorline_current#Restore() | endif - + \ windo doautocmd WinLeave + autocmd VimEnter * + \ 1 windo doautocmd WinEnter augroup END |