Skip to content

Commit baebc6a

Browse files
committed
add class and keyword color
1 parent 61c8e91 commit baebc6a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

autoload/easycomplete/pum.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ endfunction
9090
" EasyExtra: "‰", 继承 PmenuExtra
9191
"
9292
" vscode 提供了超过五种 kind 颜色配置,把 lsp 和 text
93-
" 区分开,这里增加四种常见的颜色配置
93+
" 区分开,这里增加5种常见的颜色配置
9494
" EasyFunction: "%", Function/Constant/Scruct
9595
" EasySnippet: "∫", Snippet/snip
9696
" EasyTabNine: "@", TabNine
9797
" EasyNormal: "Φ", Buf/Text/dict - Pmenu 默认色
98+
" EasyKeyword: "♧", Keyword
9899
function! s:hl()
99100
if empty(s:easycomplete_hl_exec_cmd)
100101
if easycomplete#util#IsGui()
@@ -109,6 +110,7 @@ function! s:hl()
109110
let snippet_hl_group = s:HLExists("EasySnippet") ? "EasySnippet" : "Keyword"
110111
let tabnine_hl_group = s:HLExists("EasyTabNine") ? "EasyTabNine" : "Character"
111112
let pmenu_hl_group = s:HLExists("EasyPmenu") ? "EasyPmenu" : "Pmenu"
113+
let keyword_hl_group = s:HLExists("EasyKeyword") ? "EasyKeyword" : "Define"
112114
let pmenu_cursor_has_reverse = s:HasReverseHighlight("PmenuSel")
113115
if s:HLExists("EasyFuzzyMatch")
114116
let fuzzymatch_bold_str = s:HasBold("EasyFuzzyMatch") ? "gui=bold" : ""
@@ -143,6 +145,7 @@ function! s:hl()
143145
\ 'syntax region CustomFunction matchgroup=Conceal start=/%\([^%]%\)\@=/ matchgroup=Conceal end=/\(%[^%]\)\@<=%/ concealends oneline',
144146
\ 'syntax region CustomSnippet matchgroup=Conceal start=/∫\([^∫]∫\)\@=/ matchgroup=Conceal end=/\(∫[^∫]\)\@<=∫/ concealends oneline',
145147
\ 'syntax region CustomTabNine matchgroup=Conceal start=/@\([^@]@\)\@=/ matchgroup=Conceal end=/\(@[^@]\)\@<=@/ concealends oneline',
148+
\ 'syntax region CustomKeyword matchgroup=Conceal start=/♧\([^♧]♧\)\@=/ matchgroup=Conceal end=/\(♧[^♧]\)\@<=♧/ concealends oneline',
146149
\ 'syntax region CustomNormal matchgroup=Conceal start=/Φ\([^Φ]Φ\)\@=/ matchgroup=Conceal end=/\(Φ[^Φ]\)\@<=Φ/ concealends oneline',
147150
\ "hi CustomFuzzyMatch " . dev . "fg=" . fuzzymatch_fg . " " . fuzzymatch_bold_str,
148151
\ "hi CustomPmenuSel " . dev . "fg=" . pmenu_cursor_hl_group_fg . " " . dev . "bg=" . pmenu_cursor_hl_group_bg,
@@ -152,6 +155,7 @@ function! s:hl()
152155
\ "hi link CustomSnippet " . snippet_hl_group,
153156
\ "hi link CustomTabNine " . tabnine_hl_group,
154157
\ "hi link CustomNormal " . pmenu_hl_group,
158+
\ "hi link CustomKeyword " . keyword_hl_group,
155159
\ "hi link Error Pmenu",
156160
\ ]
157161
" \ "hi Search guibg=NONE guifg=NONE ctermbg=NONE ctermfg=NONE",
@@ -1086,6 +1090,7 @@ function! s:MaxLength(lines)
10861090
let remove_style_wrapper = substitute(remove_style_wrapper, "\\s∫\[^∫\]\\s", " x ", "g")
10871091
let remove_style_wrapper = substitute(remove_style_wrapper, "\\s@\[^@\]@\\s", " x ", "g")
10881092
let remove_style_wrapper = substitute(remove_style_wrapper, "\\\[\]Φ\\s", " x ", "g")
1093+
let remove_style_wrapper = substitute(remove_style_wrapper, "\\s♧\[^♧\]\\s", " x ", "g")
10891094
let curr_length = strdisplaywidth(substitute(remove_style_wrapper, "\[§|‰]", "", "g"))
10901095
if curr_length > max_length
10911096
let max_length = curr_length
@@ -1120,6 +1125,10 @@ function! s:MapFunction(key, val)
11201125
\ kind_o ==# g:easycomplete_lsp_type_font["text"]
11211126
" 颜色4,标准色
11221127
let kind_char = "Φ"
1128+
elseif kind_o ==# g:easycomplete_lsp_type_font["keyword"] ||
1129+
\ kind_o ==# g:easycomplete_lsp_type_font["class"]
1130+
" 颜色 5
1131+
let kind_char = ""
11231132
endif
11241133
endif
11251134
let format_object = {

0 commit comments

Comments
 (0)