diff --git a/autoload/matchup.vim b/autoload/matchup.vim index e883251..001f1c5 100644 --- a/autoload/matchup.vim +++ b/autoload/matchup.vim @@ -98,13 +98,14 @@ function! s:init_default_mappings() call s:map('n', 'z%', '(matchup-z%)') call s:map('x', 'z%', '(matchup-z%)') - call s:map('o', 'z%', '(matchup-z%)') for l:opforce in ['', 'v', 'V', ''] call s:map('o', l:opforce.']%', \ '(matchup-o_'.l:opforce.')(matchup-]%)') call s:map('o', l:opforce.'[%', \ '(matchup-o_'.l:opforce.')(matchup-[%)') + call s:map('o', l:opforce.'z%', + \ '(matchup-o_'.l:opforce.')(matchup-z%)') endfor endif diff --git a/autoload/matchup/motion.vim b/autoload/matchup/motion.vim index c88b492..2d96c8f 100644 --- a/autoload/matchup/motion.vim +++ b/autoload/matchup/motion.vim @@ -68,8 +68,9 @@ function! matchup#motion#init_module() " {{{1 xnoremap (matchup-z%) \ :call matchup#motion#jump_inside(1) xmap (matchup-z%) (matchup-z%) + onoremap (matchup-z%) - \ :call oper("normal \(v)" + \ :call oper("normal \(wise)" \ . v:count1 . "\(matchup-z%)") endfunction @@ -231,8 +232,6 @@ endfunction " }}}1 function! matchup#motion#jump_inside(visual) " {{{1 - " TODO handle count - let l:count = v:count1 let l:save_pos = matchup#pos#get_cursor() @@ -241,8 +240,15 @@ function! matchup#motion#jump_inside(visual) " {{{1 normal! gv endif - for l:dummy in range(l:count) - let l:delim = matchup#delim#get_next('all', 'open') + for l:counter in range(l:count) + if l:counter + let l:delim = matchup#delim#get_next('all', 'open') + else + let l:delim = matchup#delim#get_current('all', 'open') + if empty(l:delim) + let l:delim = matchup#delim#get_next('all', 'open') + endif + endif if empty(l:delim) call matchup#pos#set_cursor(l:save_pos) return @@ -262,6 +268,7 @@ function! matchup#motion#jump_inside(visual) " {{{1 " this is an exclusive motion except when dealing with whitespace if !empty(get(s:, 'v_operator', '')) + \ && g:v_motion_force !=# 'v' && g:v_motion_force !=# "\" while matchup#util#in_whitespace(l:new_pos[1], l:new_pos[2]) let l:new_pos = matchup#pos#next(l:new_pos) endwhile