diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-14 20:33:29 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-14 20:33:29 +1200 |
commit | a22e4ff2daaf7379f5ee1346e9c6639cb6eb4653 (patch) | |
tree | 8958164724ff102734d384481f3f0909573954af | |
parent | Restore Git diff.algorithm to 'patience' (diff) | |
download | dotfiles-a22e4ff2daaf7379f5ee1346e9c6639cb6eb4653.tar.gz dotfiles-a22e4ff2daaf7379f5ee1346e9c6639cb6eb4653.zip |
Refactor colorscheme select with cursorline hooks
-rw-r--r-- | vim/vimrc | 37 |
1 files changed, 20 insertions, 17 deletions
@@ -962,29 +962,32 @@ if !exists('syntax_on') syntax enable endif -" We'll have Vim try to use my 'sahara' fork of the 'desert256' color scheme, -" and if it manages to do so without errors, turn on the 'cursorline' feature, -" since the scheme configures it and 'cursorcolumn' to be a very dark gray -" that doesn't stand out too much against a black background. Aside from the -" aforementioned experiment with monochrome terminals, I exclusively use dark -" backgrounds. -" +" Before we attempt to pick a syntax highlighting color scheme, we'll set up +" a couple of hooks for colorscheme loading. In this case, we turn +" 'cursorline' on if my 'sahara' colorscheme is loaded, since I've configured +" it to be a very dark gray that doesn't stand out too much against a black +" background. For any other colorscheme, turn the option off, because it +" almost always stands out too much for my liking. +" +autocmd vimrc ColorScheme * + \ set nocursorline +autocmd vimrc ColorScheme sahara + \ set cursorline + +" We'll have Vim try to use my 'sahara' fork of the 'desert256' color scheme. " If we fail to load the color scheme, for whatever reason, suppress the -" error, and reset the syntax highlighting, 'background', and 'cursorline' for -" dark-background default colors. I used it for years; it looks and works -" just fine. +" error, and ensure a dark background for the default colorscheme. " -" There's also a very simple grayscale color scheme I occasionally use -" instead called 'juvenile', which is included as a Git submodule with this -" dotfiles distribution. +" There's also a very simple grayscale color scheme I occasionally use instead +" called 'juvenile', which is included as a Git submodule with this dotfiles +" distribution. " try colorscheme sahara - set cursorline catch - colorscheme default - set background=dark - set nocursorline + if &background !=# 'dark' + set background=dark + endif endtry " My mapping definitions begin here. I have some general personal rules for |