diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-09-09 13:55:30 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-09-09 13:55:30 +1200 |
commit | 287a006484dff16c1d35e7333518249b71eb7d74 (patch) | |
tree | aefaa46977478c36085396c83b1a845c101fe97a /plugin | |
parent | Merge branch 'release/v0.2.0' into develop (diff) | |
download | vim-cursorline-current-287a006484dff16c1d35e7333518249b71eb7d74.tar.gz vim-cursorline-current-287a006484dff16c1d35e7333518249b71eb7d74.zip |
Simplify suspend/restore funcs considerably
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/cursorline_current.vim | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim index 828c581..be560b5 100644 --- a/plugin/cursorline_current.vim +++ b/plugin/cursorline_current.vim @@ -16,23 +16,14 @@ let g:loaded_cursorline_current = 1 " Suspend 'cursorline' when a window is inactive or inserting function! s:Suspend() abort - let w:cursorline_current_cache = &l:cursorline - setlocal nocursorline + let w:cursorline_current = &l:cursorline + let &l:cursorline = 0 endfunction " Restore 'cursorline' when a window is active and non-insert function! s:Restore() abort - - " If we don't have a value for 'cursorline' from a previous s:Suspend(), use - " the global value as the default - if !exists('w:cursorline_current_cache') - let w:cursorline_current_cache = &g:cursorline - endif - - " Restore local value to the cached value and clear it - let &l:cursorline = w:cursorline_current_cache - unlet w:cursorline_current_cache - + let &l:cursorline = get(w:, 'cursorline_current', &g:cursorline) + let w:cursorline_current = &l:cursorline endfunction " Call s:Suspend() on all windows besides the current one |