diff options
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/vimrc | 46 |
2 files changed, 35 insertions, 15 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v6.12.0 -Sat, 15 Jun 2019 15:40:34 +0000 +tejr dotfiles v6.13.0 +Sun, 16 Jun 2019 02:25:41 +0000 @@ -150,8 +150,10 @@ endif " " <https://github.com/vim/vim/releases/tag/v7.1.055> " -if $MYVIM =~# '\\' - \ && (v:version < 701 || v:version == 701 && !has('patch55')) +if $MYVIM =~# '\\' && ( + \ v:version < 701 + \ || v:version == 701 && !has('patch55') + \ ) echoerr 'Illegal backslash in user runtime path on Vim < v7.1.055' finish endif @@ -492,7 +494,8 @@ set shiftwidth=4 " Indent command like < and > use four-space indents " " <https://github.com/vim/vim/releases/tag/v7.3.693> " -if v:version > 730 || v:version == 730 && has('patch693') +if v:version > 730 + \ || v:version == 730 && has('patch693') set softtabstop=-1 else let &softtabstop = &shiftwidth @@ -622,7 +625,8 @@ set formatoptions+=1 " " <https://github.com/vim/vim/releases/tag/v7.3.541> " -if v:version > 730 || v:version == 730 && has('patch541') +if v:version > 730 + \ || v:version == 730 && has('patch541') set formatoptions+=j endif @@ -822,7 +826,7 @@ set synmaxcol=500 " windows terminal emulator PuTTY, and the terminal multiplexer tmux, both of " which I use heavily. " -if &term =~# '^putty\|^tmux' +if &term =~# '^\%(putty\|tmux\)' set ttyfast endif @@ -977,19 +981,34 @@ autocmd vimrc ColorScheme sahara " 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 ensure a dark background for the default color scheme. +" error, and default to a dark background (if not already) for the the default +" color scheme in the absence of guidance otherwise from a COLORFGBG +" environment variable or a t_RB terminal response. Vim otherwise defaults to +" 'light', which is less likely in my case. " " 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 + +" 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 +" it specifically. +" +if !exists('$COLORFGBG') && ( + \ !exists('v:termrbgresp') + \ || v:termrbgresp ==# '' + \ ) + set background=dark +endif + +" If the background seems to be dark, and my custom sahara.vim color scheme +" looks to be available, load it. +" +if &background ==# 'dark' + \ && globpath(&runtimepath, 'colors/sahara.vim') !=# '' colorscheme sahara -catch - if &background !=# 'dark' - set background=dark - endif -endtry +endif " My mapping definitions begin here. I have some general personal rules for " approaches to mappings: @@ -1074,7 +1093,8 @@ nnoremap <expr> <Space> " If the plugin isn't available, I just abandon CTRL-C to continue its " uselessness. " -if &loadplugins && globpath(&runtimepath, 'plugin/insert_cancel.vim') !=# '' +if &loadplugins + \ && globpath(&runtimepath, 'plugin/insert_cancel.vim') !=# '' imap <C-C> <Plug>(InsertCancel) endif |