From f006392e6eabf9b989170b4b3ce594d934cef368 Mon Sep 17 00:00:00 2001 From: solawing <316786359@qq.com> Date: Sun, 19 Nov 2017 11:07:38 +0800 Subject: [PATCH] fix virtual col for multibyte JK motion when g:EasyMotion_startofline=0 --- autoload/EasyMotion.vim | 2 +- autoload/EasyMotion/helper.vim | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 2a472237..d6649ae6 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -241,7 +241,7 @@ function! EasyMotion#JK(visualmode, direction) " {{{ if g:EasyMotion_startofline call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', 0) else - let vcol = EasyMotion#helper#vcol('.') + let vcol = getcurpos()[4] let pattern = printf('^.\{-}\zs\(\%%<%dv.\%%>%dv\|$\)', vcol + 1, vcol) call s:EasyMotion(pattern, a:direction, a:visualmode ? visualmode() : '', 0) endif diff --git a/autoload/EasyMotion/helper.vim b/autoload/EasyMotion/helper.vim index 49265663..f408bf64 100644 --- a/autoload/EasyMotion/helper.vim +++ b/autoload/EasyMotion/helper.vim @@ -159,23 +159,6 @@ 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' {{{