Cursor highlight doesn't exist for some environment

fix #275
This commit is contained in:
haya14busa 2016-02-12 06:39:40 +09:00
parent d8b4a60a2f
commit 33f141c3c0

View File

@ -69,6 +69,7 @@ let s:overwin = {
\ 'highlight': { \ 'highlight': {
\ 'shade': 'HitAHintShade', \ 'shade': 'HitAHintShade',
\ 'target': 'HitAHintTarget', \ 'target': 'HitAHintTarget',
\ 'cursor': 'HitAHintCursor',
\ }, \ },
\ 'jump_first_target_keys': [], \ 'jump_first_target_keys': [],
\ 'do_shade': s:TRUE, \ 'do_shade': s:TRUE,
@ -78,6 +79,16 @@ let s:overwin = {
function! s:_init_hl() abort function! s:_init_hl() abort
highlight default HitAHintShade ctermfg=242 guifg=#777777 highlight default HitAHintShade ctermfg=242 guifg=#777777
highlight default HitAHintTarget ctermfg=81 guifg=#66D9EF highlight default HitAHintTarget ctermfg=81 guifg=#66D9EF
" Cursor highlight doesn't exist for some environment with some
" colorscheme ref:#275
" e.g.
" - :colorscheme default
" - :colorscheme hybrid
if hlexists('Cursor')
highlight default link HitAHintCursor Cursor
else
highlight default HitAHintCursor term=reverse cterm=reverse gui=reverse
endif
endfunction endfunction
call s:_init_hl() call s:_init_hl()
@ -287,7 +298,7 @@ function! s:Hinter.init(hint_dict) abort
endfunction endfunction
function! s:Hinter.before() abort function! s:Hinter.before() abort
let self.highlight_id_cursor = matchadd('Cursor', '\%#', 101) let self.highlight_id_cursor = matchadd(self.config.highlight.cursor, '\%#', 101)
call self.save_options() call self.save_options()
call self.disable_conceal_in_other_win() call self.disable_conceal_in_other_win()
endfunction endfunction