mirror of
https://github.com/osyo-manga/vim-brightest.git
synced 2025-11-12 05:23:52 -05:00
Improve brightest#parse_cursorline_highlight_group.
This commit is contained in:
@@ -31,6 +31,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:is_ignore_syntax_in_cursor(context)
|
function! s:is_ignore_syntax_in_cursor(context)
|
||||||
let list = get(b:, "brightest_ignore_syntax_list", g:brightest#ignore_syntax_list)
|
let list = get(b:, "brightest_ignore_syntax_list", g:brightest#ignore_syntax_list)
|
||||||
|
|
||||||
if empty(list)
|
if empty(list)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
@@ -174,10 +175,15 @@ function! brightest#highlighting()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
let s:parse_cursorline_highlight_group_memo = {}
|
||||||
function! brightest#parse_cursorline_highlight_group(group)
|
function! brightest#parse_cursorline_highlight_group(group)
|
||||||
redir => hl
|
redir => hl
|
||||||
silent execute "highlight" a:group
|
silent execute "highlight" a:group
|
||||||
redir END
|
redir END
|
||||||
|
let key = hl
|
||||||
|
if has_key(s:parse_cursorline_highlight_group_memo, key)
|
||||||
|
return s:parse_cursorline_highlight_group_memo[key]
|
||||||
|
endif
|
||||||
let hl = substitute(hl, '\n', '', 'g')
|
let hl = substitute(hl, '\n', '', 'g')
|
||||||
let hl = matchstr(hl, '.*xxx\zs.*')
|
let hl = matchstr(hl, '.*xxx\zs.*')
|
||||||
let guibg = synIDattr(synIDtrans(hlID("CursorLine")), "bg", "gui")
|
let guibg = synIDattr(synIDtrans(hlID("CursorLine")), "bg", "gui")
|
||||||
@@ -197,6 +203,7 @@ function! brightest#parse_cursorline_highlight_group(group)
|
|||||||
let hl .= ' ctermbg=' . ctermbg
|
let hl .= ' ctermbg=' . ctermbg
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
let s:parse_cursorline_highlight_group_memo[key] = hl
|
||||||
return hl
|
return hl
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user