diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index d5eff99..17c4e16 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -985,9 +985,14 @@ function! s:PromptUser(groups) "{{{ else let _hl_group = g:EasyMotion_hl2_second_group_target endif - call EasyMotion#highlight#add_highlight( - \ '\%' . line_num . 'l' . target_col_regexp, - \ _hl_group) + if exists('*matchaddpos') + call EasyMotion#highlight#add_pos_highlight( + \ line_num, col_num, _hl_group) + else + call EasyMotion#highlight#add_highlight( + \ '\%' . line_num . 'l' . target_col_regexp, + \ _hl_group) + endif "}}} " Add marker/target length difference for multibyte compensation diff --git a/autoload/EasyMotion/highlight.vim b/autoload/EasyMotion/highlight.vim index f6327f1..543e091 100644 --- a/autoload/EasyMotion/highlight.vim +++ b/autoload/EasyMotion/highlight.vim @@ -173,6 +173,9 @@ endfunction "}}} function! EasyMotion#highlight#add_highlight(re, group) "{{{ call add(s:h.ids[a:group], matchadd(a:group, a:re, s:priorities[a:group])) endfunction "}}} +function! EasyMotion#highlight#add_pos_highlight(line_num, col_num, group) "{{{ + call add(s:h.ids[a:group], matchaddpos(a:group, [[a:line_num, a:col_num]], s:priorities[a:group])) +endfunction "}}} function! EasyMotion#highlight#attach_autocmd() "{{{ " Reference: https://github.com/justinmk/vim-sneak augroup plugin-easymotion