diff options
-rw-r--r-- | vim/autoload/colorscheme.vim | 10 | ||||
-rw-r--r-- | vim/vimrc | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/vim/autoload/colorscheme.vim b/vim/autoload/colorscheme.vim new file mode 100644 index 00000000..591550fd --- /dev/null +++ b/vim/autoload/colorscheme.vim @@ -0,0 +1,10 @@ +" Reset window-global value for 'cursorline' based on current colorscheme name +function! colorscheme#UpdateCursorline(colors_name, list) abort + let l:tab = tabpagenr() + let l:win = winnr() + tabdo windo let &g:cursorline = index(a:list, a:colors_name) >= 0 + \| silent doautocmd WinEnter,WinLeave + execute l:tab . 'tabnext' + execute l:win . 'wincmd w' + \| silent doautocmd WinEnter +endfunction @@ -887,7 +887,7 @@ endif " <https://github.com/vim/vim/releases/tag/v7.4.108> " autocmd vimrc ColorScheme * - \ let &cursorline = g:colors_name ==# 'sahara' + \ call colorscheme#UpdateCursorline(g:colors_name, ['sahara']) " Use 'dark' as my default value for 'background', in the absence of an " environment variable COLORFGBG or a response in v:termrbgresp that would set |