Make gui mode respect g:onedark_terminal_italics setting.

Fixes #44.
This commit is contained in:
Josh Dick
2016-07-20 14:03:01 -04:00
parent e855932f85
commit f67e4c0a0a

View File

@@ -70,11 +70,16 @@ if !exists("g:onedark_terminal_italics")
let g:onedark_terminal_italics = 0
endif
" This function was borrowed from FlatColor: https://github.com/MaxSt/FlatColor/
" It was based on one found in hemisu: https://github.com/noahfrederick/vim-hemisu/
" This function is based on one from FlatColor: https://github.com/MaxSt/FlatColor/
" Which in turn was based on one found in hemisu: https://github.com/noahfrederick/vim-hemisu/
function! s:h(group, style)
if g:onedark_terminal_italics == 0 && has_key(a:style, "cterm") && a:style["cterm"] == "italic"
unlet a:style.cterm
if g:onedark_terminal_italics == 0
if has_key(a:style, "cterm") && a:style["cterm"] == "italic"
unlet a:style.cterm
endif
if has_key(a:style, "gui") && a:style["gui"] == "italic"
unlet a:style.gui
endif
endif
if g:onedark_termcolors == 16
let l:ctermfg = (has_key(a:style, "fg") ? a:style.fg.cterm16 : "NONE")
@@ -82,7 +87,7 @@ function! s:h(group, style)
else
let l:ctermfg = (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE")
let l:ctermbg = (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE")
end
endif
execute "highlight" a:group
\ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE")
\ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE")