diff options
author | José Luis Lafuente <jl@lafuente.me> | 2017-11-04 14:31:00 +0100 |
---|---|---|
committer | José Luis Lafuente <jl@lafuente.me> | 2017-11-04 14:31:00 +0100 |
commit | f703015dc0137d79379492ae61e78efbb7ecf512 (patch) | |
tree | a285038e7d7ebfa6eb4fd966dffaa470d1dfae55 | |
parent | 59b2e235e694b4ff750eef177a8be04612d758b2 (diff) |
Make local customization easier
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | templates/default.mustache | 121 |
2 files changed, 96 insertions, 39 deletions
@@ -55,3 +55,17 @@ If your Vim looks like the above image you are using a 256 terminal theme withou ![blue line numbers screenshot](https://raw.github.com/chriskempson/base16-vim/master/with-base16colorspace-256-without-base16-shell.png) If your Vim looks like the above image you are setting `let base16colorspace=256` in your `~/.vimrc` but either not running [Base16 Shell](https://github.com/chriskempson/base16-shell) or [Base16 Shell](https://github.com/chriskempson/base16-shell) is not working for your terminal. Either ensure [Base16 Shell](https://github.com/chriskempson/base16-shell) is working by running the `colortest` available in the [Base16 Shell](https://github.com/chriskempson/base16-shell) repository or not setting `let base16colorspace=256` in your `~/.vimrc`. + +## Customization +If you want to do some local customization, you can add something like this to your `~/.vimrc`: + +```vim +function! s:base16_customize() abort + call Base16hi("MatchParen", g:base16_gui05, g:base16_gui03, g:base16_cterm05, g:base16_cterm03, "bold,italic", "") +endfunction + +augroup on_change_colorschema + autocmd! + autocmd ColorScheme * call s:base16_customize() +augroup END +``` diff --git a/templates/default.mustache b/templates/default.mustache index 71b9f93..bdf3646 100644 --- a/templates/default.mustache +++ b/templates/default.mustache @@ -15,48 +15,86 @@ if !has('gui_running') endif " GUI color definitions -let s:gui00 = "{{base00-hex}}" -let s:gui01 = "{{base01-hex}}" -let s:gui02 = "{{base02-hex}}" -let s:gui03 = "{{base03-hex}}" -let s:gui04 = "{{base04-hex}}" -let s:gui05 = "{{base05-hex}}" -let s:gui06 = "{{base06-hex}}" -let s:gui07 = "{{base07-hex}}" -let s:gui08 = "{{base08-hex}}" -let s:gui09 = "{{base09-hex}}" -let s:gui0A = "{{base0A-hex}}" -let s:gui0B = "{{base0B-hex}}" -let s:gui0C = "{{base0C-hex}}" -let s:gui0D = "{{base0D-hex}}" -let s:gui0E = "{{base0E-hex}}" -let s:gui0F = "{{base0F-hex}}" +let s:gui00 = "{{base00-hex}}" +let g:base16_gui00 = "{{base00-hex}}" +let s:gui01 = "{{base01-hex}}" +let g:base16_gui01 = "{{base01-hex}}" +let s:gui02 = "{{base02-hex}}" +let g:base16_gui02 = "{{base02-hex}}" +let s:gui03 = "{{base03-hex}}" +let g:base16_gui03 = "{{base03-hex}}" +let s:gui04 = "{{base04-hex}}" +let g:base16_gui04 = "{{base04-hex}}" +let s:gui05 = "{{base05-hex}}" +let g:base16_gui05 = "{{base05-hex}}" +let s:gui06 = "{{base06-hex}}" +let g:base16_gui06 = "{{base06-hex}}" +let s:gui07 = "{{base07-hex}}" +let g:base16_gui07 = "{{base07-hex}}" +let s:gui08 = "{{base08-hex}}" +let g:base16_gui08 = "{{base08-hex}}" +let s:gui09 = "{{base09-hex}}" +let g:base16_gui09 = "{{base09-hex}}" +let s:gui0A = "{{base0A-hex}}" +let g:base16_gui0A = "{{base0A-hex}}" +let s:gui0B = "{{base0B-hex}}" +let g:base16_gui0B = "{{base0B-hex}}" +let s:gui0C = "{{base0C-hex}}" +let g:base16_gui0C = "{{base0C-hex}}" +let s:gui0D = "{{base0D-hex}}" +let g:base16_gui0D = "{{base0D-hex}}" +let s:gui0E = "{{base0E-hex}}" +let g:base16_gui0E = "{{base0E-hex}}" +let s:gui0F = "{{base0F-hex}}" +let g:base16_gui0F = "{{base0F-hex}}" " Terminal color definitions -let s:cterm00 = "00" -let s:cterm03 = "08" -let s:cterm05 = "07" -let s:cterm07 = "15" -let s:cterm08 = "01" -let s:cterm0A = "03" -let s:cterm0B = "02" -let s:cterm0C = "06" -let s:cterm0D = "04" -let s:cterm0E = "05" +let s:cterm00 = "00" +let g:base16_cterm00 = "00" +let s:cterm03 = "08" +let g:base16_cterm03 = "08" +let s:cterm05 = "07" +let g:base16_cterm05 = "07" +let s:cterm07 = "15" +let g:base16_cterm07 = "15" +let s:cterm08 = "01" +let g:base16_cterm08 = "01" +let s:cterm0A = "03" +let g:base16_cterm0A = "03" +let s:cterm0B = "02" +let g:base16_cterm0B = "02" +let s:cterm0C = "06" +let g:base16_cterm0C = "06" +let s:cterm0D = "04" +let g:base16_cterm0D = "04" +let s:cterm0E = "05" +let g:base16_cterm0E = "05" if exists('base16colorspace') && base16colorspace == "256" - let s:cterm01 = "18" - let s:cterm02 = "19" - let s:cterm04 = "20" - let s:cterm06 = "21" - let s:cterm09 = "16" - let s:cterm0F = "17" + let s:cterm01 = "18" + let g:base16_cterm01 = "18" + let s:cterm02 = "19" + let g:base16_cterm02 = "19" + let s:cterm04 = "20" + let g:base16_cterm04 = "20" + let s:cterm06 = "21" + let g:base16_cterm06 = "21" + let s:cterm09 = "16" + let g:base16_cterm09 = "16" + let s:cterm0F = "17" + let g:base16_cterm0F = "17" else - let s:cterm01 = "10" - let s:cterm02 = "11" - let s:cterm04 = "12" - let s:cterm06 = "13" - let s:cterm09 = "09" - let s:cterm0F = "14" + let s:cterm01 = "10" + let g:base16_cterm01 = "10" + let s:cterm02 = "11" + let g:base16_cterm02 = "11" + let s:cterm04 = "12" + let g:base16_cterm04 = "12" + let s:cterm06 = "13" + let g:base16_cterm06 = "13" + let s:cterm09 = "09" + let g:base16_cterm09 = "09" + let s:cterm0F = "14" + let g:base16_cterm0F = "14" endif " Neovim terminal colours @@ -91,7 +129,7 @@ syntax reset let g:colors_name = "base16-{{scheme-slug}}" " Highlighting function -fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) +function! g:Base16hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) if a:guifg != "" exec "hi " . a:group . " guifg=#" . a:guifg endif @@ -110,6 +148,11 @@ fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) if a:guisp != "" exec "hi " . a:group . " guisp=#" . a:guisp endif +endfunction + + +fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) + call Base16hi(a:group, a:guifg, a:guibg, a:ctermfg, a:ctermbg, a:attr, a:guisp) endfun " Vim editor colors |