Make JK motions linewise in operator pending

close #141
This commit is contained in:
haya14busa 2014-04-17 07:34:09 +09:00
parent 04ae425b3c
commit aaa159d834

View File

@ -58,6 +58,7 @@ function! EasyMotion#reset()
\ 'regexp' : 0,
\ 'bd_t' : 0,
\ 'find_bd' : 0,
\ 'linewise' : 0,
\ }
" regexp: -> regular expression
" This value is used when multi input find motion. If this values is
@ -187,7 +188,8 @@ endfunction " }}}
" -- JK Motion ---------------------------
function! EasyMotion#JK(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
"FIXME: support exclusive
let s:flag.linewise = 1
if g:EasyMotion_startofline
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', 0)
else
@ -198,10 +200,12 @@ function! EasyMotion#JK(visualmode, direction) " {{{
endfunction " }}}
function! EasyMotion#Sol(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let s:flag.linewise = 1
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', '')
return s:EasyMotion_is_cancelled
endfunction " }}}
function! EasyMotion#Eol(visualmode, direction) " {{{
let s:flag.linewise = 1
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion('\(\w\|\s*\zs\|.\|^\)$', a:direction, a:visualmode ? visualmode() : '', '')
return s:EasyMotion_is_cancelled
@ -1371,6 +1375,12 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive) " {{{
normal! v
endif " }}}
if s:current.is_operator && s:flag.linewise
" TODO: Is there better solution?
" Maike it linewise
normal! V
endif
" Adjust screen especially for visual scroll & offscreen search {{{
" Otherwise, cursor line will move middle line of window
keepjumps call cursor(win_first_line, 0)