diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-30 21:35:04 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-30 21:35:04 +1200 |
commit | afb4979434e4c5ba6b2963306ddce7a0bf274766 (patch) | |
tree | a3b735b0a9418ebc42d23315d36e12a8e8732cd2 | |
parent | Remove unneeded part of documentation (diff) | |
download | vim-cursorline-current-afb4979434e4c5ba6b2963306ddce7a0bf274766.tar.gz vim-cursorline-current-afb4979434e4c5ba6b2963306ddce7a0bf274766.zip |
Add comments
-rw-r--r-- | plugin/cursorline_current.vim | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim index a7704e7..ed590b8 100644 --- a/plugin/cursorline_current.vim +++ b/plugin/cursorline_current.vim @@ -11,14 +11,23 @@ if exists('loaded_cursorline_current') || &compatible || v:version < 700 endif let loaded_cursorline_current = 1 +" Set up hooks augroup cursorline_current autocmd! - autocmd VimEnter * - \ if winnr('$') > 1 | call cursorline_current#Load() | endif - autocmd BufEnter * - \ if winnr('$') > 1 | call cursorline_current#Restore() | endif + + " 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 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 + augroup END |