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