mirror of
https://github.com/osyo-manga/vim-brightest.git
synced 2025-11-15 06:53:52 -05:00
Improve get synID.
This commit is contained in:
@@ -20,12 +20,19 @@ let g:brightest#ignore_word_pattern = get(g:, "brightest#ignore_word_pattern", "
|
||||
|
||||
|
||||
function! s:context()
|
||||
return {
|
||||
let context = {
|
||||
\ "filetype" : &filetype,
|
||||
\ "line" : line("."),
|
||||
\ "col" : col("."),
|
||||
\ "syntax_name" : synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name")
|
||||
\ "syntax_name" : "",
|
||||
\ }
|
||||
|
||||
" パフォーマンスを上げるために g:brightest#ignore_syntax_list が設定されている場合のみ
|
||||
" シンタックス名を設定する
|
||||
if !empty(g:brightest#ignore_syntax_list)
|
||||
let context.syntax_name = synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name")
|
||||
endif
|
||||
return context
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -280,7 +287,8 @@ endfunction
|
||||
|
||||
let g:brightest#enable_clear_highlight_on_CursorMoved = get(g:, "brightest#enable_clear_highlight_on_CursorMoved", 1)
|
||||
|
||||
function! brightest#on_CursorMoved()
|
||||
|
||||
function! s:on_CursorMoved()
|
||||
let s:is_CursorMoved = 1
|
||||
let mode = mode()
|
||||
|
||||
@@ -299,6 +307,16 @@ function! brightest#on_CursorMoved()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! brightest#on_CursorMoved()
|
||||
try
|
||||
call s:on_CursorMoved()
|
||||
catch /.*/
|
||||
echohl Error | echo "Error: Brightest CursorMoved " . v:exception | echohl NONE
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
Reference in New Issue
Block a user