1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

refactor: change colorscheme config func logic

This commit is contained in:
jdhao 2020-10-18 23:03:34 +08:00
parent 9718b60dbf
commit 9ffdef5894

104
ui.vim
View File

@ -26,91 +26,91 @@ endfunction
function! s:my_theme_dict.gruvbox8() dict abort function! s:my_theme_dict.gruvbox8() dict abort
" We should check if theme exists before using it, otherwise you will get " We should check if theme exists before using it, otherwise you will get
" error message when starting Nvim " error message when starting Nvim
if utils#HasColorscheme('gruvbox8') if !utils#HasColorscheme('gruvbox8') | return | endif
" Italic options should be put before colorscheme setting,
" see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled " Italic options should be put before colorscheme setting,
let g:gruvbox_italics=1 " see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
let g:gruvbox_italicize_strings=1 let g:gruvbox_italics=1
let g:gruvbox_filetype_hi_groups = 0 let g:gruvbox_italicize_strings=1
let g:gruvbox_plugin_hi_groups = 0 let g:gruvbox_filetype_hi_groups = 0
colorscheme gruvbox8_hard let g:gruvbox_plugin_hi_groups = 0
endif colorscheme gruvbox8_hard
endfunction endfunction
function! s:my_theme_dict.srcery() dict abort function! s:my_theme_dict.srcery() dict abort
if utils#HasColorscheme('srcery') if !utils#HasColorscheme('srcery') | return | endif
colorscheme srcery
endif colorscheme srcery
endfunction endfunction
function! s:my_theme_dict.badwolf() dict abort function! s:my_theme_dict.badwolf() dict abort
if utils#HasColorscheme('badwolf') if !utils#HasColorscheme('badwolf') | return | endif
let g:badwolf_darkgutter = 0
" Make the tab line lighter than the background. let g:badwolf_darkgutter = 0
let g:badwolf_tabline = 2 " Make the tab line lighter than the background.
colorscheme badwolf let g:badwolf_tabline = 2
endif colorscheme badwolf
endfunction endfunction
function! s:my_theme_dict.deus() dict abort function! s:my_theme_dict.deus() dict abort
if utils#HasColorscheme('deus') if !utils#HasColorscheme('deus') | return | endif
colorscheme deus
endif colorscheme deus
endfunction endfunction
function! s:my_theme_dict.happy_hacking() dict abort function! s:my_theme_dict.happy_hacking() dict abort
if utils#HasColorscheme('happy_hacking') if !utils#HasColorscheme('happy_hacking') | return | endif
colorscheme happy_hacking
endif colorscheme happy_hacking
endfunction endfunction
function! s:my_theme_dict.solarized8() dict abort function! s:my_theme_dict.solarized8() dict abort
if utils#HasColorscheme('solarized8') if !utils#HasColorscheme('solarized8') | return | endif
let g:solarized_term_italics=1
let g:solarized_visibility='high' let g:solarized_term_italics=1
colorscheme solarized8_flat let g:solarized_visibility='high'
endif colorscheme solarized8_flat
endfunction endfunction
function! s:my_theme_dict.monokai() dict abort function! s:my_theme_dict.monokai() dict abort
if utils#HasColorscheme('monokai') if !utils#HasColorscheme('monokai') | return | endif
colorscheme monokai
endif colorscheme monokai
endfunction endfunction
function! s:my_theme_dict.gotham() dict abort function! s:my_theme_dict.gotham() dict abort
if utils#HasColorscheme('gotham') if !utils#HasColorscheme('gotham') | return | endif
colorscheme gotham
endif colorscheme gotham
endfunction endfunction
function! s:my_theme_dict.vim_one() dict abort function! s:my_theme_dict.vim_one() dict abort
if utils#HasColorscheme('one') if !utils#HasColorscheme('one') | return | endif
let g:one_allow_italics = 1
colorscheme one let g:one_allow_italics = 1
endif colorscheme one
endfunction endfunction
function! s:my_theme_dict.material() dict abort function! s:my_theme_dict.material() dict abort
if utils#HasColorscheme('material') if !utils#HasColorscheme('material') | return | endif
let g:material_terminal_italics = 1
" theme_style can be 'default', 'dark' or 'palenight' let g:material_terminal_italics = 1
let g:material_theme_style = 'default' " theme_style can be 'default', 'dark' or 'palenight'
colorscheme material let g:material_theme_style = 'default'
endif colorscheme material
endfunction endfunction
function! s:my_theme_dict.onedark() dict abort function! s:my_theme_dict.onedark() dict abort
if utils#HasColorscheme('onedark') if !utils#HasColorscheme('onedark') | return | endif
let g:onedark_terminal_italics = 1
colorscheme onedark let g:onedark_terminal_italics = 1
endif colorscheme onedark
endfunction endfunction
function! s:my_theme_dict.neodark() dict abort function! s:my_theme_dict.neodark() dict abort
if utils#HasColorscheme('neodark') if !utils#HasColorscheme('neodark') | return | endif
colorscheme neodark
endif colorscheme neodark
endfunction endfunction
execute printf('call s:my_theme_dict.%s()', s:theme) execute printf('call s:my_theme_dict.%s()', s:theme)