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

48
ui.vim
View File

@ -26,7 +26,8 @@ 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, " Italic options should be put before colorscheme setting,
" see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled " see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
let g:gruvbox_italics=1 let g:gruvbox_italics=1
@ -34,83 +35,82 @@ function! s:my_theme_dict.gruvbox8() dict abort
let g:gruvbox_filetype_hi_groups = 0 let g:gruvbox_filetype_hi_groups = 0
let g:gruvbox_plugin_hi_groups = 0 let g:gruvbox_plugin_hi_groups = 0
colorscheme gruvbox8_hard colorscheme gruvbox8_hard
endif
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 colorscheme srcery
endif
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 let g:badwolf_darkgutter = 0
" Make the tab line lighter than the background. " Make the tab line lighter than the background.
let g:badwolf_tabline = 2 let g:badwolf_tabline = 2
colorscheme badwolf colorscheme badwolf
endif
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 colorscheme deus
endif
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 colorscheme happy_hacking
endif
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_term_italics=1
let g:solarized_visibility='high' let g:solarized_visibility='high'
colorscheme solarized8_flat colorscheme solarized8_flat
endif
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 colorscheme monokai
endif
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 colorscheme gotham
endif
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 let g:one_allow_italics = 1
colorscheme one colorscheme one
endif
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 let g:material_terminal_italics = 1
" theme_style can be 'default', 'dark' or 'palenight' " theme_style can be 'default', 'dark' or 'palenight'
let g:material_theme_style = 'default' let g:material_theme_style = 'default'
colorscheme material colorscheme material
endif
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 let g:onedark_terminal_italics = 1
colorscheme onedark colorscheme onedark
endif
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 colorscheme neodark
endif
endfunction endfunction
execute printf('call s:my_theme_dict.%s()', s:theme) execute printf('call s:my_theme_dict.%s()', s:theme)