From 9ffdef5894ff83be7b7e1ef073e394a2dd873eb4 Mon Sep 17 00:00:00 2001 From: jdhao Date: Sun, 18 Oct 2020 23:03:34 +0800 Subject: [PATCH] refactor: change colorscheme config func logic --- ui.vim | 104 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/ui.vim b/ui.vim index 2352065..9d257af 100644 --- a/ui.vim +++ b/ui.vim @@ -26,91 +26,91 @@ endfunction function! s:my_theme_dict.gruvbox8() dict abort " We should check if theme exists before using it, otherwise you will get " error message when starting Nvim - if utils#HasColorscheme('gruvbox8') - " Italic options should be put before colorscheme setting, - " see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled - let g:gruvbox_italics=1 - let g:gruvbox_italicize_strings=1 - let g:gruvbox_filetype_hi_groups = 0 - let g:gruvbox_plugin_hi_groups = 0 - colorscheme gruvbox8_hard - endif + 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 + let g:gruvbox_italics=1 + let g:gruvbox_italicize_strings=1 + let g:gruvbox_filetype_hi_groups = 0 + let g:gruvbox_plugin_hi_groups = 0 + colorscheme gruvbox8_hard endfunction function! s:my_theme_dict.srcery() dict abort - if utils#HasColorscheme('srcery') - colorscheme srcery - endif + if !utils#HasColorscheme('srcery') | return | endif + + colorscheme srcery endfunction function! s:my_theme_dict.badwolf() dict abort - if utils#HasColorscheme('badwolf') - let g:badwolf_darkgutter = 0 - " Make the tab line lighter than the background. - let g:badwolf_tabline = 2 - colorscheme badwolf - endif + if !utils#HasColorscheme('badwolf') | return | endif + + let g:badwolf_darkgutter = 0 + " Make the tab line lighter than the background. + let g:badwolf_tabline = 2 + colorscheme badwolf endfunction function! s:my_theme_dict.deus() dict abort - if utils#HasColorscheme('deus') - colorscheme deus - endif + if !utils#HasColorscheme('deus') | return | endif + + colorscheme deus endfunction function! s:my_theme_dict.happy_hacking() dict abort - if utils#HasColorscheme('happy_hacking') - colorscheme happy_hacking - endif + if !utils#HasColorscheme('happy_hacking') | return | endif + + colorscheme happy_hacking endfunction function! s:my_theme_dict.solarized8() dict abort - if utils#HasColorscheme('solarized8') - let g:solarized_term_italics=1 - let g:solarized_visibility='high' - colorscheme solarized8_flat - endif + if !utils#HasColorscheme('solarized8') | return | endif + + let g:solarized_term_italics=1 + let g:solarized_visibility='high' + colorscheme solarized8_flat endfunction function! s:my_theme_dict.monokai() dict abort - if utils#HasColorscheme('monokai') - colorscheme monokai - endif + if !utils#HasColorscheme('monokai') | return | endif + + colorscheme monokai endfunction function! s:my_theme_dict.gotham() dict abort - if utils#HasColorscheme('gotham') - colorscheme gotham - endif + if !utils#HasColorscheme('gotham') | return | endif + + colorscheme gotham endfunction function! s:my_theme_dict.vim_one() dict abort - if utils#HasColorscheme('one') - let g:one_allow_italics = 1 - colorscheme one - endif + if !utils#HasColorscheme('one') | return | endif + + let g:one_allow_italics = 1 + colorscheme one endfunction function! s:my_theme_dict.material() dict abort - if utils#HasColorscheme('material') - let g:material_terminal_italics = 1 - " theme_style can be 'default', 'dark' or 'palenight' - let g:material_theme_style = 'default' - colorscheme material - endif + if !utils#HasColorscheme('material') | return | endif + + let g:material_terminal_italics = 1 + " theme_style can be 'default', 'dark' or 'palenight' + let g:material_theme_style = 'default' + colorscheme material endfunction function! s:my_theme_dict.onedark() dict abort - if utils#HasColorscheme('onedark') - let g:onedark_terminal_italics = 1 - colorscheme onedark - endif + if !utils#HasColorscheme('onedark') | return | endif + + let g:onedark_terminal_italics = 1 + colorscheme onedark endfunction function! s:my_theme_dict.neodark() dict abort - if utils#HasColorscheme('neodark') - colorscheme neodark - endif + if !utils#HasColorscheme('neodark') | return | endif + + colorscheme neodark endfunction execute printf('call s:my_theme_dict.%s()', s:theme)