mirror of
https://github.com/osyo-manga/vim-brightest.git
synced 2025-11-08 11:33:54 -05:00
Add g:brightest#enable_on_CursorHold option Ref #3.
This commit is contained in:
@@ -214,6 +214,27 @@ function! brightest#define_cursorline_highlight_group(group)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:is_enable()
|
||||
return g:brightest_enable && get(b:, "brightest_enable", 1)
|
||||
endfunction
|
||||
|
||||
let g:brightest#enable_on_CursorHold = get(g:, "brightest#enable_cursorhold", 0)
|
||||
|
||||
function! brightest#on_CursorHold()
|
||||
if s:is_enable() && g:brightest#enable_on_CursorHold
|
||||
call brightest#highlighting()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! brightest#on_CursorMoved()
|
||||
if g:brightest#enable_on_CursorHold
|
||||
call brightest#hl_clear()
|
||||
endif
|
||||
if s:is_enable() && !g:brightest#enable_on_CursorHold
|
||||
call brightest#highlighting()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
@@ -150,6 +150,13 @@ b:brightest_ignore_word_pattern *b:brightest_ignore_word_pattern*
|
||||
g:brightest#ignore_word_pattern のバッファローカル版です。
|
||||
g:brightest#ignore_word_pattern よりも優先して使用されます。
|
||||
|
||||
g:brightest#enable_on_CursorHold *g:brightest#enable_on_CursorHold*
|
||||
1 が設定されている場合 |CursorMoved| ではなくて |CursorHold|
|
||||
時にハイライトを行うようになります。
|
||||
カーソル移動が遅く感じる場合はこの変数に 1 を設定してください。
|
||||
Default: >
|
||||
let g:brightest#enable_on_CursorHold = 0
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
ハイライトグループ *brightest-highlight_group*
|
||||
@@ -221,7 +228,7 @@ A. |g:brightest#highlight| の "group" に |BrightestUnderline|、もしくは
|
||||
|
||||
Q. ハイライトの背景を 'cursorline' と同じにしたい
|
||||
|
||||
A. g:brightest#highlight_in_cursorline| の "group" に
|
||||
A. g:brightest#highlight_in_cursorline| の "group" に
|
||||
|BrightestCursorLineBg| を設定することでカーソル行のハイライトの背景が
|
||||
'cursorline' と同じになります。
|
||||
>
|
||||
@@ -231,7 +238,12 @@ A. g:brightest#highlight_in_cursorline| の "group" に
|
||||
\}
|
||||
<
|
||||
|
||||
Q. カーソル移動が重いので CursorHold 時にハイライトしたい
|
||||
|
||||
A. g:brightest#enable_on_CursorHold に 1 を設定します。
|
||||
>
|
||||
let g:brightest#enable_on_CursorHold = 1
|
||||
<
|
||||
|
||||
|
||||
==============================================================================
|
||||
|
||||
@@ -36,7 +36,9 @@ endfunction
|
||||
|
||||
augroup brightest
|
||||
autocmd!
|
||||
autocmd CursorMoved * call s:highlight()
|
||||
" autocmd CursorMoved * call s:highlight()
|
||||
autocmd CursorMoved * call brightest#on_CursorMoved()
|
||||
autocmd CursorHold * call brightest#on_CursorHold()
|
||||
autocmd BufLeave,WinLeave,InsertEnter * call brightest#hl_clear()
|
||||
autocmd ColorScheme * call s:init_hl()
|
||||
augroup END
|
||||
|
||||
Reference in New Issue
Block a user