Skip to content

Commit 33f141c

Browse files
committed
Cursor highlight doesn't exist for some environment
fix #275
1 parent d8b4a60 commit 33f141c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

autoload/vital/_easymotion/HitAHint/Motion.vim

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ let s:overwin = {
6969
\ 'highlight': {
7070
\ 'shade': 'HitAHintShade',
7171
\ 'target': 'HitAHintTarget',
72+
\ 'cursor': 'HitAHintCursor',
7273
\ },
7374
\ 'jump_first_target_keys': [],
7475
\ 'do_shade': s:TRUE,
@@ -78,6 +79,16 @@ let s:overwin = {
7879
function! s:_init_hl() abort
7980
highlight default HitAHintShade ctermfg=242 guifg=#777777
8081
highlight default HitAHintTarget ctermfg=81 guifg=#66D9EF
82+
" Cursor highlight doesn't exist for some environment with some
83+
" colorscheme ref:#275
84+
" e.g.
85+
" - :colorscheme default
86+
" - :colorscheme hybrid
87+
if hlexists('Cursor')
88+
highlight default link HitAHintCursor Cursor
89+
else
90+
highlight default HitAHintCursor term=reverse cterm=reverse gui=reverse
91+
endif
8192
endfunction
8293

8394
call s:_init_hl()
@@ -287,7 +298,7 @@ function! s:Hinter.init(hint_dict) abort
287298
endfunction
288299

289300
function! s:Hinter.before() abort
290-
let self.highlight_id_cursor = matchadd('Cursor', '\%#', 101)
301+
let self.highlight_id_cursor = matchadd(self.config.highlight.cursor, '\%#', 101)
291302
call self.save_options()
292303
call self.disable_conceal_in_other_win()
293304
endfunction

0 commit comments

Comments
 (0)