mirror of
https://github.com/joshdick/onedark.vim.git
synced 2025-11-08 11:03:49 -05:00
Don't write to the "a:" dict per https://github.com/vim/vim/pull/3929 .
Closes #148.
This commit is contained in:
@@ -72,46 +72,46 @@ endif
|
|||||||
let s:group_colors = {} " Cache of default highlight group settings, for later reference via `onedark#extend_highlight`
|
let s:group_colors = {} " Cache of default highlight group settings, for later reference via `onedark#extend_highlight`
|
||||||
function! s:h(group, style, ...)
|
function! s:h(group, style, ...)
|
||||||
if (a:0 > 0) " Will be true if we got here from onedark#extend_highlight
|
if (a:0 > 0) " Will be true if we got here from onedark#extend_highlight
|
||||||
let a:highlight = s:group_colors[a:group]
|
let s:highlight = s:group_colors[a:group]
|
||||||
for style_type in ["fg", "bg", "sp"]
|
for style_type in ["fg", "bg", "sp"]
|
||||||
if (has_key(a:style, style_type))
|
if (has_key(a:style, style_type))
|
||||||
let l:default_style = (has_key(a:highlight, style_type) ? a:highlight[style_type] : { "cterm16": "NONE", "cterm": "NONE", "gui": "NONE" })
|
let l:default_style = (has_key(s:highlight, style_type) ? s:highlight[style_type] : { "cterm16": "NONE", "cterm": "NONE", "gui": "NONE" })
|
||||||
let a:highlight[style_type] = extend(l:default_style, a:style[style_type])
|
let s:highlight[style_type] = extend(l:default_style, a:style[style_type])
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if (has_key(a:style, "gui"))
|
if (has_key(a:style, "gui"))
|
||||||
let a:highlight.gui = a:style.gui
|
let s:highlight.gui = a:style.gui
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let a:highlight = a:style
|
let s:highlight = a:style
|
||||||
let s:group_colors[a:group] = a:highlight " Cache default highlight group settings
|
let s:group_colors[a:group] = s:highlight " Cache default highlight group settings
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:onedark_terminal_italics == 0
|
if g:onedark_terminal_italics == 0
|
||||||
if has_key(a:highlight, "cterm") && a:highlight["cterm"] == "italic"
|
if has_key(s:highlight, "cterm") && s:highlight["cterm"] == "italic"
|
||||||
unlet a:highlight.cterm
|
unlet s:highlight.cterm
|
||||||
endif
|
endif
|
||||||
if has_key(a:highlight, "gui") && a:highlight["gui"] == "italic"
|
if has_key(s:highlight, "gui") && s:highlight["gui"] == "italic"
|
||||||
unlet a:highlight.gui
|
unlet s:highlight.gui
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:onedark_termcolors == 16
|
if g:onedark_termcolors == 16
|
||||||
let l:ctermfg = (has_key(a:highlight, "fg") ? a:highlight.fg.cterm16 : "NONE")
|
let l:ctermfg = (has_key(s:highlight, "fg") ? s:highlight.fg.cterm16 : "NONE")
|
||||||
let l:ctermbg = (has_key(a:highlight, "bg") ? a:highlight.bg.cterm16 : "NONE")
|
let l:ctermbg = (has_key(s:highlight, "bg") ? s:highlight.bg.cterm16 : "NONE")
|
||||||
else
|
else
|
||||||
let l:ctermfg = (has_key(a:highlight, "fg") ? a:highlight.fg.cterm : "NONE")
|
let l:ctermfg = (has_key(s:highlight, "fg") ? s:highlight.fg.cterm : "NONE")
|
||||||
let l:ctermbg = (has_key(a:highlight, "bg") ? a:highlight.bg.cterm : "NONE")
|
let l:ctermbg = (has_key(s:highlight, "bg") ? s:highlight.bg.cterm : "NONE")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
execute "highlight" a:group
|
execute "highlight" a:group
|
||||||
\ "guifg=" (has_key(a:highlight, "fg") ? a:highlight.fg.gui : "NONE")
|
\ "guifg=" (has_key(s:highlight, "fg") ? s:highlight.fg.gui : "NONE")
|
||||||
\ "guibg=" (has_key(a:highlight, "bg") ? a:highlight.bg.gui : "NONE")
|
\ "guibg=" (has_key(s:highlight, "bg") ? s:highlight.bg.gui : "NONE")
|
||||||
\ "guisp=" (has_key(a:highlight, "sp") ? a:highlight.sp.gui : "NONE")
|
\ "guisp=" (has_key(s:highlight, "sp") ? s:highlight.sp.gui : "NONE")
|
||||||
\ "gui=" (has_key(a:highlight, "gui") ? a:highlight.gui : "NONE")
|
\ "gui=" (has_key(s:highlight, "gui") ? s:highlight.gui : "NONE")
|
||||||
\ "ctermfg=" . l:ctermfg
|
\ "ctermfg=" . l:ctermfg
|
||||||
\ "ctermbg=" . l:ctermbg
|
\ "ctermbg=" . l:ctermbg
|
||||||
\ "cterm=" (has_key(a:highlight, "cterm") ? a:highlight.cterm : "NONE")
|
\ "cterm=" (has_key(s:highlight, "cterm") ? s:highlight.cterm : "NONE")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" public {{{
|
" public {{{
|
||||||
|
|||||||
Reference in New Issue
Block a user