Skip to content

Commit 7578ffe

Browse files
committed
Support jump to first target feature for overwin motions
1 parent 6975339 commit 7578ffe

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

autoload/EasyMotion/overwin.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ function! EasyMotion#overwin#move(pattern) abort
99
\ 'shade': g:EasyMotion_hl_group_shade,
1010
\ 'target': g:EasyMotion_hl_group_target,
1111
\ },
12+
\ 'jump_first_target_keys':
13+
\ (g:EasyMotion_enter_jump_first ? ["\<CR>"] : []) +
14+
\ (g:EasyMotion_space_jump_first ? ["\<Space>"] : [])
1215
\ })
1316
endfunction
1417

autoload/vital/_easymotion/HitAHint/Motion.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ let s:overwin = {
5353
\ 'shade': 'HitAHintShade',
5454
\ 'target': 'HitAHintTarget',
5555
\ },
56+
\ 'jump_first_target_keys': [],
5657
\ }
5758
\ }
5859

5960
function! s:_init_hl() abort
60-
highlight HitAHintShade ctermfg=242 guifg=#777777
61-
highlight HitAHintTarget ctermfg=81 guifg=#66D9EF
61+
highlight default HitAHintShade ctermfg=242 guifg=#777777
62+
highlight default HitAHintTarget ctermfg=81 guifg=#66D9EF
6263
endfunction
6364

6465
call s:_init_hl()
@@ -181,6 +182,11 @@ function! s:overwin.choose_prompt(hint_dict) abort
181182
call hinter.after()
182183
endtry
183184

185+
" Jump to first target if target key is in config.jump_first_target_keys.
186+
if index(self.config.jump_first_target_keys, c) isnot# -1
187+
let c = split(self.config.keys, '\zs')[0]
188+
endif
189+
184190
if has_key(a:hint_dict, c)
185191
let target = a:hint_dict[c]
186192
return type(target) is# type({}) ? self.choose_prompt(target) : target

0 commit comments

Comments
 (0)