From afc1f0380f59f9a3d25bba4eabbed3c421ff369d Mon Sep 17 00:00:00 2001 From: manga_osyo Date: Sun, 28 Sep 2014 21:49:18 +0900 Subject: [PATCH] Improve brightest#parse_cursorline_highlight_group. --- autoload/brightest.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autoload/brightest.vim b/autoload/brightest.vim index def0e0e..5162dc1 100644 --- a/autoload/brightest.vim +++ b/autoload/brightest.vim @@ -31,6 +31,7 @@ endfunction function! s:is_ignore_syntax_in_cursor(context) let list = get(b:, "brightest_ignore_syntax_list", g:brightest#ignore_syntax_list) + if empty(list) return 0 endif @@ -174,10 +175,15 @@ function! brightest#highlighting() endfunction +let s:parse_cursorline_highlight_group_memo = {} function! brightest#parse_cursorline_highlight_group(group) redir => hl silent execute "highlight" a:group 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 = matchstr(hl, '.*xxx\zs.*') let guibg = synIDattr(synIDtrans(hlID("CursorLine")), "bg", "gui") @@ -197,6 +203,7 @@ function! brightest#parse_cursorline_highlight_group(group) let hl .= ' ctermbg=' . ctermbg endif endif + let s:parse_cursorline_highlight_group_memo[key] = hl return hl endfunction