diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 22:42:03 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 22:42:03 +1200 |
commit | cc067433f7dd990b0fa71f243511a8fc2d25d85e (patch) | |
tree | e1a9bab76132701d43556a97f026f9727b8f3955 | |
parent | Rearrange autocmds (diff) | |
download | vim-cursorline-current-cc067433f7dd990b0fa71f243511a8fc2d25d85e.tar.gz vim-cursorline-current-cc067433f7dd990b0fa71f243511a8fc2d25d85e.zip |
Add documentary comments
-rw-r--r-- | plugin/cursorline_current.vim | 23 |
1 files changed, 23 insertions, 0 deletions
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 <tom@sanctum.geek.nz> +" 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 |