diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-09-09 13:55:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-09-09 13:55:44 +1200 |
commit | 7a9085887deb0e197dfb68926387d5941f68cf1d (patch) | |
tree | bcfbfdc7e1a999b058b7bfed8470613ac6feee7d | |
parent | Simplify suspend/restore funcs considerably (diff) | |
download | vim-cursorline-current-7a9085887deb0e197dfb68926387d5941f68cf1d.tar.gz vim-cursorline-current-7a9085887deb0e197dfb68926387d5941f68cf1d.zip |
Call restore function on BufEnter
Reported by m_ben in #vim; if a window is opened onto a buffer that
already exists, 'cursorline' is not locally restored. I think this has
something to do with a value for the option being a property of the
buffer rather than the window, so we force the option on at BufEnter
time as well.
-rw-r--r-- | plugin/cursorline_current.vim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim index be560b5..43bf882 100644 --- a/plugin/cursorline_current.vim +++ b/plugin/cursorline_current.vim @@ -53,9 +53,11 @@ augroup cursorline_current " Turn off 'cursorline' for other windows on load autocmd VimEnter * call s:Load() - " Turn off 'cursorline' when leaving a window or losing focus + " Turn off 'cursorline' when leaving a window or losing focus. We call the + " restore again on BufEnter to handle existent local buffer values for the + " option overwriting the window value (Vim bug?) autocmd WinLeave,FocusLost * call s:Suspend() - autocmd WinEnter,FocusGained * call s:Restore() + autocmd BufEnter,WinEnter,FocusGained * call s:Restore() " Turn off 'cursorline' when in insert mode " Check g:cursorline_current_insert, in case the user doesn't want it |