mirror of
https://github.com/nordtheme/vim.git
synced 2026-09-10 07:36:23 -04:00
Only call execute function once per syntax group (#303)
Before the custom `s:hi` function called Vim's `execute` function [1] for each defined attribute which is quite expensive in terms of performance. To improve this the attributes are now concatenate as string and passed to `exec` at the end of the function instead. Co-authored-by: Julien Voisin <jvoisin@google.com> Co-authored-by: Sven Greb <development@svengreb.de> Co-authored-by: Arctic Ice Sudio <development@arcticicestudio.com> [1]: https://vimhelp.org/builtin.txt.html#builtin.txt#execute%28%29 GH-303
This commit is contained in:
parent
e3eb208437
commit
77fe4b3f0e
|
|
@ -99,23 +99,27 @@ let g:nord_cursor_line_number_background = get(g:, "nord_cursor_line_number_back
|
||||||
let g:nord_uniform_diff_background = get(g:, "nord_uniform_diff_background", 0)
|
let g:nord_uniform_diff_background = get(g:, "nord_uniform_diff_background", 0)
|
||||||
|
|
||||||
function! s:hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp)
|
function! s:hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp)
|
||||||
|
let cmd = ""
|
||||||
if a:guifg != ""
|
if a:guifg != ""
|
||||||
exec "hi " . a:group . " guifg=" . a:guifg
|
let cmd = cmd . " guifg=" . a:guifg
|
||||||
endif
|
endif
|
||||||
if a:guibg != ""
|
if a:guibg != ""
|
||||||
exec "hi " . a:group . " guibg=" . a:guibg
|
let cmd = cmd . " guibg=" . a:guibg
|
||||||
endif
|
endif
|
||||||
if a:ctermfg != ""
|
if a:ctermfg != ""
|
||||||
exec "hi " . a:group . " ctermfg=" . a:ctermfg
|
let cmd = cmd . " ctermfg=" . a:ctermfg
|
||||||
endif
|
endif
|
||||||
if a:ctermbg != ""
|
if a:ctermbg != ""
|
||||||
exec "hi " . a:group . " ctermbg=" . a:ctermbg
|
let cmd = cmd . " ctermbg=" . a:ctermbg
|
||||||
endif
|
endif
|
||||||
if a:attr != ""
|
if a:attr != ""
|
||||||
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . substitute(a:attr, "undercurl", s:underline, "")
|
let cmd = cmd . " gui=" . a:attr . " cterm=" . substitute(a:attr, "undercurl", s:underline, "")
|
||||||
endif
|
endif
|
||||||
if a:guisp != ""
|
if a:guisp != ""
|
||||||
exec "hi " . a:group . " guisp=" . a:guisp
|
let cmd = cmd . " guisp=" . a:guisp
|
||||||
|
endif
|
||||||
|
if cmd != ""
|
||||||
|
exec "hi " . a:group . cmd
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
@ -188,12 +192,12 @@ if has('nvim')
|
||||||
call s:hi("DiagnosticUnderlineError" , s:nord11_gui, "", s:nord11_term, "", "undercurl", "")
|
call s:hi("DiagnosticUnderlineError" , s:nord11_gui, "", s:nord11_term, "", "undercurl", "")
|
||||||
call s:hi("DiagnosticUnderlineInfo" , s:nord8_gui, "", s:nord8_term, "", "undercurl", "")
|
call s:hi("DiagnosticUnderlineInfo" , s:nord8_gui, "", s:nord8_term, "", "undercurl", "")
|
||||||
call s:hi("DiagnosticUnderlineHint" , s:nord10_gui, "", s:nord10_term, "", "undercurl", "")
|
call s:hi("DiagnosticUnderlineHint" , s:nord10_gui, "", s:nord10_term, "", "undercurl", "")
|
||||||
|
|
||||||
"+- Neovim DocumentHighlight -+
|
"+- Neovim DocumentHighlight -+
|
||||||
call s:hi("LspReferenceText", "", s:nord3_gui, "", s:nord3_term, "", "")
|
call s:hi("LspReferenceText", "", s:nord3_gui, "", s:nord3_term, "", "")
|
||||||
call s:hi("LspReferenceRead", "", s:nord3_gui, "", s:nord3_term, "", "")
|
call s:hi("LspReferenceRead", "", s:nord3_gui, "", s:nord3_term, "", "")
|
||||||
call s:hi("LspReferenceWrite", "", s:nord3_gui, "", s:nord3_term, "", "")
|
call s:hi("LspReferenceWrite", "", s:nord3_gui, "", s:nord3_term, "", "")
|
||||||
|
|
||||||
"+- Neovim LspSignatureHelp -+
|
"+- Neovim LspSignatureHelp -+
|
||||||
call s:hi("LspSignatureActiveParameter", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
|
call s:hi("LspSignatureActiveParameter", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
|
||||||
endif
|
endif
|
||||||
|
|
@ -805,12 +809,12 @@ else
|
||||||
for s:i in range(1,6)
|
for s:i in range(1,6)
|
||||||
call s:hi("VimwikiHeader".s:i, s:vimwiki_hcolor_guifg[s:i-1] , "", s:vimwiki_hcolor_ctermfg[s:i-1], "", s:bold, "")
|
call s:hi("VimwikiHeader".s:i, s:vimwiki_hcolor_guifg[s:i-1] , "", s:vimwiki_hcolor_ctermfg[s:i-1], "", s:bold, "")
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
call s:hi("VimwikiLink", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
|
call s:hi("VimwikiLink", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
|
||||||
hi! link VimwikiHeaderChar markdownHeadingDelimiter
|
hi! link VimwikiHeaderChar markdownHeadingDelimiter
|
||||||
hi! link VimwikiHR Keyword
|
hi! link VimwikiHR Keyword
|
||||||
hi! link VimwikiList markdownListMarker
|
hi! link VimwikiList markdownListMarker
|
||||||
|
|
||||||
" YAML
|
" YAML
|
||||||
" > stephpy/vim-yaml
|
" > stephpy/vim-yaml
|
||||||
call s:hi("yamlKey", s:nord7_gui, "", s:nord7_term, "", "", "")
|
call s:hi("yamlKey", s:nord7_gui, "", s:nord7_term, "", "", "")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue