Generate all colorschemes at once.

Just source src/solarized8.vim.
This commit is contained in:
Lifepillar
2016-05-21 14:03:35 +02:00
parent 40424f1bb8
commit 5a5a494a15

View File

@@ -1,25 +1,24 @@
" Name: Solarized colorscheme for Vim 8
" Author: Lifepillar <lifepillar@lifepillar.me>
" License: OSI approved MIT license (see end of this file)
fun! s:put(line) fun! s:put(line)
call append(line('$'), a:line) call append(line('$'), a:line)
endf endf
let g:solarized_contrast = get(g:, "solarized_contrast", "") " low, normal, flat, high for s:solarized_background in ["dark", "light"]
let g:solarized_visibility = get(g:, "solarized_visibility", "") " low, normal, high for s:solarized_contrast in ["low", "normal", "flat", "high"]
let g:solarized_diffmode = get(g:, "solarized_diffmode", "") " low, normal, high let s:colors_name = "solarized8_" . s:solarized_background . (s:solarized_contrast != "normal" ? "_" .s:solarized_contrast : "")
let g:solarized_statusline = get(g:, "solarized_statusline", "") " low, normal execute "silent" "tabnew" "+setlocal\\ ft=vim"
execute "file" s:colors_name.".vim"
let g:solarized_background = get(g:, "solarized_background", "dark") " dark, light
call s:put('" Name: Solarized colorscheme for Vim 8')
call s:put('" Author: Lifepillar <lifepillar@lifepillar.me>')
call s:put('" License: OSI approved MIT license (see end of this file)')
call s:put('')
call s:put('hi clear') call s:put('hi clear')
call s:put('if exists("syntax_on")') call s:put('if exists("syntax_on")')
call s:put(' syntax reset') call s:put(' syntax reset')
call s:put('endif') call s:put('endif')
call s:put('') call s:put('')
call s:put('let colors_name = "solarized8_' . g:solarized_background . (g:solarized_contrast != "" ? "_".g:solarized_contrast : "") . '"') call s:put('let colors_name = "' . s:colors_name . '"')
call s:put('set background='.g:solarized_background) call s:put('set background='.s:solarized_background)
call s:put('') call s:put('')
let s:base03 = ["8" , "#002b36"] let s:base03 = ["8" , "#002b36"]
@@ -49,7 +48,7 @@ let s:b = ",bold"
let s:i = ",italic" let s:i = ",italic"
let s:u = "" let s:u = ""
if g:solarized_background == "light" if s:solarized_background == "light"
let s:temp03 = s:base03 let s:temp03 = s:base03
let s:temp02 = s:base02 let s:temp02 = s:base02
let s:temp01 = s:base01 let s:temp01 = s:base01
@@ -65,18 +64,18 @@ if g:solarized_background == "light"
let s:back = s:base03 let s:back = s:base03
endif endif
if g:solarized_contrast == "high" if s:solarized_contrast == "high"
let s:base01 = s:base00 let s:base01 = s:base00
let s:base00 = s:base0 let s:base00 = s:base0
let s:base0 = s:base1 let s:base0 = s:base1
let s:base1 = s:base2 let s:base1 = s:base2
let s:base2 = s:base3 let s:base2 = s:base3
endif endif
if g:solarized_contrast == "low" if s:solarized_contrast == "low"
let s:back = s:base02 let s:back = s:base02
let s:ou = ",underline" let s:ou = ",underline"
endif endif
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
let s:ou = ",underline" let s:ou = ",underline"
endif endif
exe "let s:bg_none = ' ctermbg=NONE guibg=NONE'" exe "let s:bg_none = ' ctermbg=NONE guibg=NONE'"
@@ -224,14 +223,14 @@ call s:put("hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none)
" "
"}}} "}}}
" Lifepillar's mode highlighting {{{ " Lifepillar's mode highlighting {{{
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
" NormalMode set together with StatusLine (see below) " NormalMode set together with StatusLine (see below)
call s:put("hi! InsertMode" . s:bg_cyan .s:fg_base02. s:fmt_revbb) call s:put("hi! InsertMode" . s:bg_cyan .s:fg_base02. s:fmt_revbb)
call s:put("hi! ReplaceMode". s:bg_orange .s:fg_base02. s:fmt_revbb) call s:put("hi! ReplaceMode". s:bg_orange .s:fg_base02. s:fmt_revbb)
call s:put("hi! VisualMode" . s:bg_magenta.s:fg_base02. s:fmt_revbb) call s:put("hi! VisualMode" . s:bg_magenta.s:fg_base02. s:fmt_revbb)
call s:put("hi! CommandMode". s:bg_magenta.s:fg_base02. s:fmt_revbb) call s:put("hi! CommandMode". s:bg_magenta.s:fg_base02. s:fmt_revbb)
else else
if g:solarized_background == "dark" if s:solarized_background == "dark"
call s:put("hi! NormalMode" . s:fg_base0 .s:bg_base3. s:fmt_revbb) call s:put("hi! NormalMode" . s:fg_base0 .s:bg_base3. s:fmt_revbb)
call s:put("hi! InsertMode" . s:fg_cyan .s:bg_base3. s:fmt_revbb) call s:put("hi! InsertMode" . s:fg_cyan .s:bg_base3. s:fmt_revbb)
call s:put("hi! ReplaceMode". s:fg_orange .s:bg_base3. s:fmt_revbb) call s:put("hi! ReplaceMode". s:fg_orange .s:bg_base3. s:fmt_revbb)
@@ -262,22 +261,22 @@ call s:put(" hi! NonText" .s:fmt_bold .s:fg_base00 .s:bg_none)
call s:put(" hi! CursorLineNr" .s:fmt_bold .s:fg_base0 .s:bg_base02) call s:put(" hi! CursorLineNr" .s:fmt_bold .s:fg_base0 .s:bg_base02)
call s:put('endif') call s:put('endif')
call s:put('if get(g:, "solarized_statusline", "") == "low"') call s:put('if get(g:, "solarized_statusline", "") == "low"')
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
call s:put(" hi! NormalMode" .s:fg_base02 .s:bg_base1 .s:fmt_revbb) call s:put(" hi! NormalMode" .s:fg_base02 .s:bg_base1 .s:fmt_revbb)
call s:put(" hi! StatusLine" .s:fg_base02 .s:bg_base1 .s:fmt_revbb) call s:put(" hi! StatusLine" .s:fg_base02 .s:bg_base1 .s:fmt_revbb)
else else
if g:solarized_background == "dark" if s:solarized_background == "dark"
call s:put(" hi! StatusLine" .s:fg_base01 ." ctermbg=7 guibg=#eee8d5" .s:fmt_revbb) call s:put(" hi! StatusLine" .s:fg_base01 ." ctermbg=7 guibg=#eee8d5" .s:fmt_revbb)
else else
call s:put(" hi! StatusLine" .s:fg_base01 ." ctermbg=15 guibg=#fdf6e3" .s:fmt_revbb) call s:put(" hi! StatusLine" .s:fg_base01 ." ctermbg=15 guibg=#fdf6e3" .s:fmt_revbb)
endif endif
endif endif
call s:put('else') call s:put('else')
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
call s:put(" hi! NormalMode" .s:fg_base02 .s:bg_base2 . s:fmt_revbb) call s:put(" hi! NormalMode" .s:fg_base02 .s:bg_base2 . s:fmt_revbb)
call s:put(" hi! StatusLine" .s:fg_base02 .s:bg_base2 .s:fmt_revbb) call s:put(" hi! StatusLine" .s:fg_base02 .s:bg_base2 .s:fmt_revbb)
else else
if g:solarized_background == "dark" if s:solarized_background == "dark"
" Changed by Lifepillar: slightly darker status line, light foreground " Changed by Lifepillar: slightly darker status line, light foreground
call s:put(" hi! StatusLine" .s:fg_base0 .s:bg_base02.s:fmt_revbb) call s:put(" hi! StatusLine" .s:fg_base0 .s:bg_base02.s:fmt_revbb)
else else
@@ -285,11 +284,11 @@ else
endif endif
endif endif
call s:put('endif') call s:put('endif')
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
call s:put("hi! StatusLineNC" . s:fg_base02 . s:bg_base01 . s:fmt_revbb) call s:put("hi! StatusLineNC" . s:fg_base02 . s:bg_base01 . s:fmt_revbb)
else else
" Changed by Lifepillar: lighter colors for disabled status line " Changed by Lifepillar: lighter colors for disabled status line
if g:solarized_background == "dark" if s:solarized_background == "dark"
call s:put("hi! StatusLineNC" .s:fg_base01 .s:bg_base1 .s:fmt_revbb) call s:put("hi! StatusLineNC" .s:fg_base01 .s:bg_base1 .s:fmt_revbb)
else else
call s:put("hi! StatusLineNC" .s:fg_base01 .s:bg_base02 .s:fmt_revbb) call s:put("hi! StatusLineNC" .s:fg_base01 .s:bg_base02 .s:fmt_revbb)
@@ -305,7 +304,7 @@ call s:put("hi! MoreMsg" .s:fmt_none .s:fg_blue .s:bg_none)
call s:put("hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none) call s:put("hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none)
call s:put("hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_base02) call s:put("hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_base02)
call s:put("hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none) call s:put("hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none)
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
call s:put("hi! VertSplit" .s:fmt_none .s:fg_base02 .s:bg_base02) call s:put("hi! VertSplit" .s:fmt_none .s:fg_base02 .s:bg_base02)
else else
" Changed by Lifepillar: lighter vertical bars: " Changed by Lifepillar: lighter vertical bars:
@@ -348,7 +347,7 @@ call s:put("hi! TabLine" .s:fg_base0 .s:bg_base02 .s:sp_base0 .s:fmt_no
call s:put("hi! TabLineFill" .s:fg_base0 .s:bg_base02 .s:sp_base0 .s:fmt_none) call s:put("hi! TabLineFill" .s:fg_base0 .s:bg_base02 .s:sp_base0 .s:fmt_none)
call s:put("hi! TabLineSel" .s:fg_base01 .s:bg_base2 .s:sp_base0 .s:fmt_revbbu) call s:put("hi! TabLineSel" .s:fg_base01 .s:bg_base2 .s:sp_base0 .s:fmt_revbbu)
call s:put("hi! CursorColumn" .s:fmt_none .s:fg_none .s:bg_base02) call s:put("hi! CursorColumn" .s:fmt_none .s:fg_none .s:bg_base02)
if g:solarized_contrast == "flat" if s:solarized_contrast == "flat"
call s:put("hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base03 .s:sp_base1) call s:put("hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base03 .s:sp_base1)
else else
call s:put("hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1) call s:put("hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1)
@@ -357,7 +356,7 @@ call s:put("hi! ColorColumn" .s:fmt_none .s:fg_none .s:bg_base02)
call s:put("hi! Cursor" .s:fmt_none .s:fg_base03 .s:bg_base0) call s:put("hi! Cursor" .s:fmt_none .s:fg_base03 .s:bg_base0)
call s:put("hi! link lCursor Cursor") call s:put("hi! link lCursor Cursor")
" Changed by Lifepillar: better (in my opinion) highlighting for MatchParen: " Changed by Lifepillar: better (in my opinion) highlighting for MatchParen:
if g:solarized_background == 'dark' if s:solarized_background == 'dark'
call s:put("hi! MatchParen" .s:fmt_bold .s:fg_base3 .s:bg_base02) call s:put("hi! MatchParen" .s:fmt_bold .s:fg_base3 .s:bg_base02)
else else
call s:put("hi! MatchParen" .s:fmt_bold .s:fg_base03 .s:bg_base00) call s:put("hi! MatchParen" .s:fmt_bold .s:fg_base03 .s:bg_base00)
@@ -657,28 +656,32 @@ call s:put("hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt
call s:put("hi! link pandocMetadataTitle pandocMetadata") call s:put("hi! link pandocMetadataTitle pandocMetadata")
"}}} "}}}
" License "{{{ call s:put('" License "{{{')
" --------------------------------------------------------------------- call s:put('" ---------------------------------------------------------------------')
" call s:put('"')
" Copyright (c) 2011 Ethan Schoonover call s:put('" Copyright (c) 2011 Ethan Schoonover')
" call s:put('"')
" Permission is hereby granted, free of charge, to any person obtaining a copy call s:put('" Permission is hereby granted, free of charge, to any person obtaining a copy')
" of this software and associated documentation files (the "Software"), to deal call s:put('" of this software and associated documentation files (the "Software"), to deal')
" in the Software without restriction, including without limitation the rights call s:put('" in the Software without restriction, including without limitation the rights')
" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell call s:put('" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell')
" copies of the Software, and to permit persons to whom the Software is call s:put('" copies of the Software, and to permit persons to whom the Software is')
" furnished to do so, subject to the following conditions: call s:put('" furnished to do so, subject to the following conditions:')
" call s:put('"')
" The above copyright notice and this permission notice shall be included in call s:put('" The above copyright notice and this permission notice shall be included in')
" all copies or substantial portions of the Software. call s:put('" all copies or substantial portions of the Software.')
" call s:put('"')
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR call s:put('" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR')
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, call s:put('" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,')
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE call s:put('" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE')
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER call s:put('" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER')
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, call s:put('" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,')
" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN call s:put('" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN')
" THE SOFTWARE. call s:put('" THE SOFTWARE.')
" call s:put('"')
" vim:foldmethod=marker:foldlevel=0 call s:put('" vim:foldmethod=marker:foldlevel=0')
"}}} call s:put('"}}}')
norm 0d_
endfor
endfor