Add g:brightest#enable_insert_mode.

This commit is contained in:
manga_osyo
2015-04-11 02:54:07 +09:00
parent 7897a43fca
commit 5eb807617a
3 changed files with 28 additions and 3 deletions

View File

@@ -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

View File

@@ -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*

View File

@@ -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