From cc067433f7dd990b0fa71f243511a8fc2d25d85e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 22:42:03 +1200 Subject: Add documentary comments --- plugin/cursorline_current.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim index 40991b1..034a422 100644 --- a/plugin/cursorline_current.vim +++ b/plugin/cursorline_current.vim @@ -1,3 +1,10 @@ +" +" cursorline_current.vim: Apply 'cursorline' only in normal mode in the active +" window. +" +" Author: Tom Ryder +" License: Same as Vim itself +" if exists('loaded_cursorline_current') || &compatible || v:version < 700 finish endif @@ -5,12 +12,28 @@ let loaded_cursorline_current = 1 augroup cursorline_current autocmd! + + " On opening Vim, we might have to get initial windows into the right state. + " Run the hook for leaving windows on every window, and then move back to + " the first window and run the hook for entering a window. + " autocmd VimEnter * \ tabdo windo doautocmd WinLeave autocmd VimEnter * \ 1 wincmd w | doautocmd WinEnter + + " On entering a buffer, the Vim application gaining focus, leaving insert + " mode, or entering a window, set the local value of the 'cursorline' option + " to the same as the global value, to correspond with an active state. + " autocmd BufEnter,FocusGained,InsertLeave,WinEnter * \ let &l:cursorline = &g:cursorline + + " On leaving a buffer, the Vim application window losing focus, entering + " insert mode, or leaving a window, turn off the 'cursorline' option for the + " linked window, so that if it's on, it will only be in the active one. + " autocmd BufLeave,FocusGained,InsertEnter,WinLeave * \ let &l:cursorline = 0 + augroup END -- cgit v1.2.3