Support jump to first target feature for overwin motions
This commit is contained in:
parent
69753395d0
commit
7578ffe479
@ -9,6 +9,9 @@ function! EasyMotion#overwin#move(pattern) abort
|
|||||||
\ 'shade': g:EasyMotion_hl_group_shade,
|
\ 'shade': g:EasyMotion_hl_group_shade,
|
||||||
\ 'target': g:EasyMotion_hl_group_target,
|
\ 'target': g:EasyMotion_hl_group_target,
|
||||||
\ },
|
\ },
|
||||||
|
\ 'jump_first_target_keys':
|
||||||
|
\ (g:EasyMotion_enter_jump_first ? ["\<CR>"] : []) +
|
||||||
|
\ (g:EasyMotion_space_jump_first ? ["\<Space>"] : [])
|
||||||
\ })
|
\ })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -53,12 +53,13 @@ let s:overwin = {
|
|||||||
\ 'shade': 'HitAHintShade',
|
\ 'shade': 'HitAHintShade',
|
||||||
\ 'target': 'HitAHintTarget',
|
\ 'target': 'HitAHintTarget',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'jump_first_target_keys': [],
|
||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:_init_hl() abort
|
function! s:_init_hl() abort
|
||||||
highlight HitAHintShade ctermfg=242 guifg=#777777
|
highlight default HitAHintShade ctermfg=242 guifg=#777777
|
||||||
highlight HitAHintTarget ctermfg=81 guifg=#66D9EF
|
highlight default HitAHintTarget ctermfg=81 guifg=#66D9EF
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:_init_hl()
|
call s:_init_hl()
|
||||||
@ -181,6 +182,11 @@ function! s:overwin.choose_prompt(hint_dict) abort
|
|||||||
call hinter.after()
|
call hinter.after()
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
|
" Jump to first target if target key is in config.jump_first_target_keys.
|
||||||
|
if index(self.config.jump_first_target_keys, c) isnot# -1
|
||||||
|
let c = split(self.config.keys, '\zs')[0]
|
||||||
|
endif
|
||||||
|
|
||||||
if has_key(a:hint_dict, c)
|
if has_key(a:hint_dict, c)
|
||||||
let target = a:hint_dict[c]
|
let target = a:hint_dict[c]
|
||||||
return type(target) is# type({}) ? self.choose_prompt(target) : target
|
return type(target) is# type({}) ? self.choose_prompt(target) : target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user