parent
39abbf30a7
commit
f306da3966
@ -205,8 +205,8 @@ function! EasyMotion#JK(visualmode, direction) " {{{
|
||||
if g:EasyMotion_startofline
|
||||
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', 0)
|
||||
else
|
||||
let c = col('.')
|
||||
let pattern = printf('^.\{-}\zs\(\%%<%dv.\%%>%dv\|$\)', c + 1, c)
|
||||
let vcol = EasyMotion#helper#vcol('.')
|
||||
let pattern = printf('^.\{-}\zs\(\%%<%dv.\%%>%dv\|$\)', vcol + 1, vcol)
|
||||
call s:EasyMotion(pattern, a:direction, a:visualmode ? visualmode() : '', 0)
|
||||
endif
|
||||
return s:EasyMotion_is_cancelled
|
||||
|
@ -158,6 +158,24 @@ endif "}}}
|
||||
function! EasyMotion#helper#include_multibyte_char(str) "{{{
|
||||
return strlen(a:str) != EasyMotion#helper#strchars(a:str)
|
||||
endfunction "}}}
|
||||
|
||||
function! EasyMotion#helper#vcol(expr) abort
|
||||
let col_num = col(a:expr)
|
||||
let line = getline(a:expr)
|
||||
let before_line = col_num > 2 ? line[: col_num - 2]
|
||||
\ : col_num is# 2 ? line[0]
|
||||
\ : ''
|
||||
let vcol_num = 1
|
||||
for c in split(before_line, '\zs')
|
||||
let vcol_num += c is# "\t" ? s:_virtual_tab2spacelen(vcol_num) : len(c)
|
||||
endfor
|
||||
return vcol_num
|
||||
endfunction
|
||||
|
||||
function! s:_virtual_tab2spacelen(col_num) abort
|
||||
return &tabstop - ((a:col_num - 1) % &tabstop)
|
||||
endfunction
|
||||
|
||||
"}}}
|
||||
|
||||
" Restore 'cpoptions' {{{
|
||||
|
Loading…
Reference in New Issue
Block a user