mirror of
https://github.com/osyo-manga/vim-brightest.git
synced 2025-11-08 11:33:54 -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
|
||||
|
||||
@@ -128,6 +128,8 @@ g:brightest#ignore_syntax_list *g:brightest#ignore_syntax_list*
|
||||
ハイライトを行わないシンタックス名のリストです。
|
||||
ここで設定したシンタックス上にカーソルがある場合はハイライトしません。
|
||||
NOTE: |g:brightest#pattern|を設定していない場合、カーソル上以外の単語がハイライトされるのでこの機能が正しく動作しない可能性があります。
|
||||
NOTE: このオプションが設定されている場合パフォーマンスが遅くなる場合が
|
||||
あります。
|
||||
Default: >
|
||||
let g:brightest#ignore_syntax_list = []
|
||||
<
|
||||
|
||||
Reference in New Issue
Block a user