aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-12-18 15:28:19 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-12-18 16:00:51 +1300
commit29dff73acb39e9ba52c80103c8f7f6c4e7c7e000 (patch)
tree1ca74df15d137687ae0379b8992c6096e565bd56
parentSpecify some interdependencies in Vim config (diff)
downloaddotfiles-29dff73acb39e9ba52c80103c8f7f6c4e7c7e000.tar.gz
dotfiles-29dff73acb39e9ba52c80103c8f7f6c4e7c7e000.zip
Set 'cursorline' for all windows on colors change
-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