Skip to content

Commit

Permalink
bugfix for #210
Browse files Browse the repository at this point in the history
  • Loading branch information
jayli committed Dec 5, 2023
1 parent f7b5713 commit d808960
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions autoload/easycomplete/sources/buf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ function! s:GetGlobalDictKeyword()
endif

for line in lines
if &filetype == "css"
call extend(localdicts, split(line,'[^A-Za-z0-9_#-]'))
else
call extend(localdicts, split(line,'[^A-Za-z0-9_#]'))
endif
call extend(localdicts, split(line, s:KeywordsRegx()))
endfor

call s:ArrayDistinct(localdicts)
Expand All @@ -158,6 +154,23 @@ function! s:GetGlobalDictKeyword()
return dictkeywords
endfunction

function! s:KeywordsRegx()
if exists("s:easycomplete_temp_keywords")
return s:easycomplete_temp_keywords
endif
let key_word_list = split(&iskeyword, ",")
let tmp_letters = ["@","_","-"]
let res_letters = ["#"]
for char in tmp_letters
if index(key_word_list, char) >= 0
call add(res_letters, char)
endif
endfor
let reg_str = "[^A-Za-z0-9" . join(res_letters, "") . "]"
let s:easycomplete_temp_keywords = reg_str
return reg_str
endfunction

" List 去重,类似 uniq,纯数字要去掉
function! s:ArrayDistinct(list)
call uniq(sort(a:list))
Expand Down

0 comments on commit d808960

Please sign in to comment.