aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/autoload/colorscheme.vim10
-rw-r--r--vim/vimrc2
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
diff --git a/vim/vimrc b/vim/vimrc
index 9b078c17..3eb1dbbe 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -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