feat: disable italics when not supported
This commit is contained in:
@@ -13,5 +13,28 @@ function! zenbones#setup_colorscheme(...) abort
|
||||
lua require("zenbones.util").apply_colorscheme()
|
||||
else
|
||||
call zenbones#generated#{g:colors_name . (l:bg == v:null ? '_' . &background : '')}#load()
|
||||
|
||||
if has('terminal')
|
||||
highlight! link StatusLineTerm StatusLine
|
||||
highlight! link StatusLineTermNC StatusLineNC
|
||||
let g:terminal_ansi_colors = [
|
||||
\ g:terminal_color_0,
|
||||
\ g:terminal_color_1,
|
||||
\ g:terminal_color_2,
|
||||
\ g:terminal_color_3,
|
||||
\ g:terminal_color_4,
|
||||
\ g:terminal_color_5,
|
||||
\ g:terminal_color_6,
|
||||
\ g:terminal_color_7,
|
||||
\ g:terminal_color_8,
|
||||
\ g:terminal_color_9,
|
||||
\ g:terminal_color_10,
|
||||
\ g:terminal_color_11,
|
||||
\ g:terminal_color_12,
|
||||
\ g:terminal_color_13,
|
||||
\ g:terminal_color_14,
|
||||
\ g:terminal_color_15
|
||||
\ ]
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,28 +1,11 @@
|
||||
local template = [[function! zenbones#generated#$name#load() abort
|
||||
$termcolors
|
||||
$vimcolors
|
||||
highlight! link StatusLineTerm StatusLine
|
||||
highlight! link StatusLineTermNC StatusLineNC
|
||||
|
||||
if has('terminal')
|
||||
let g:terminal_ansi_colors = [
|
||||
\ g:terminal_color_0,
|
||||
\ g:terminal_color_1,
|
||||
\ g:terminal_color_2,
|
||||
\ g:terminal_color_3,
|
||||
\ g:terminal_color_4,
|
||||
\ g:terminal_color_5,
|
||||
\ g:terminal_color_6,
|
||||
\ g:terminal_color_7,
|
||||
\ g:terminal_color_8,
|
||||
\ g:terminal_color_9,
|
||||
\ g:terminal_color_10,
|
||||
\ g:terminal_color_11,
|
||||
\ g:terminal_color_12,
|
||||
\ g:terminal_color_13,
|
||||
\ g:terminal_color_14,
|
||||
\ g:terminal_color_15
|
||||
\ ]
|
||||
let s:italics = (&t_ZH != '' && &t_ZH != '[7m') || has('gui_running') || has('nvim')
|
||||
if !s:italics
|
||||
" start_no_italics
|
||||
" end_no_italics
|
||||
endif
|
||||
endfunction]]
|
||||
|
||||
@@ -58,3 +41,26 @@ run(
|
||||
{ overwrite, string.format("autoload/zenbones/generated/%s.vim", name) }
|
||||
)
|
||||
-- selene: deny(undefined_variable)
|
||||
|
||||
local function remove_italics(specs)
|
||||
local italic_specs = {}
|
||||
for key, hl in pairs(specs) do
|
||||
if hl.gui == "italic" and key ~= "Italic" then
|
||||
table.insert(italic_specs, string.format("highlight %s gui=NONE cterm=NONE", key))
|
||||
end
|
||||
end
|
||||
return italic_specs
|
||||
end
|
||||
|
||||
-- selene: allow(undefined_variable)
|
||||
run(
|
||||
specs,
|
||||
remove_italics,
|
||||
{
|
||||
patchwrite,
|
||||
string.format("autoload/zenbones/generated/%s.vim", name),
|
||||
[[" start_no_italics]],
|
||||
[[" end_no_italics]],
|
||||
}
|
||||
)
|
||||
-- selene: deny(undefined_variable)
|
||||
|
||||
Reference in New Issue
Block a user