diff --git a/autoload/brightest.vim b/autoload/brightest.vim index c026ae8..3c923a3 100644 --- a/autoload/brightest.vim +++ b/autoload/brightest.vim @@ -224,6 +224,9 @@ function! brightest#define_cursorline_highlight_group(group) endfunction +let g:brightest#enable_insert_mode = get(g:, "brightest#enable_insert_mode", 0) + + function! s:is_enable() return get(g:, "brightest_enable", 1) && get(b:, "brightest_enable", 1) endfunction @@ -240,6 +243,7 @@ function! brightest#on_CursorHold() endif endfunction + let g:brightest#enable_clear_highlight_on_CursorMoved = get(g:, "brightest#enable_clear_highlight_on_CursorMoved", 1) function! brightest#on_CursorMoved() if s:is_enable_on_cursorhold() && g:brightest#enable_clear_highlight_on_CursorMoved @@ -251,5 +255,3 @@ function! brightest#on_CursorMoved() endfunction -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/doc/brightest.jax b/doc/brightest.jax index 3965e66..91b8bab 100644 --- a/doc/brightest.jax +++ b/doc/brightest.jax @@ -171,6 +171,13 @@ Default: > let g:brightest#enable_clear_highlight_on_CursorMoved = 1 < +g:brightest#enable_insert_mode *g:brightest#enable_insert_mode* + 0 以外が設定されている場合に |Insert-mode| でも単語がハイライトされる + ようになります。 +Default: > + let g:brightest#enable_insert_mode = 0 +< + ============================================================================== ハイライトグループ *brightest-highlight_group* diff --git a/plugin/brightest.vim b/plugin/brightest.vim index 06298e1..aa6fe93 100644 --- a/plugin/brightest.vim +++ b/plugin/brightest.vim @@ -42,13 +42,29 @@ function! s:highlight() endif endfunction + augroup brightest autocmd! " 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 BufLeave,WinLeave * call brightest#hl_clear() autocmd ColorScheme * call s:init_hl() + + autocmd CursorMovedI * +\ if g:brightest#enable_insert_mode + + +\| call brightest#on_CursorMoved() +\| endif + autocmd CursorHoldI * +\ if g:brightest#enable_insert_mode +\| call brightest#on_CursorHold() +\| endif + autocmd InsertEnter * +\ if g:brightest#enable_insert_mode == 0 +\| call brightest#hl_clear() +\| endif augroup END