Merge branch 'fix-jumplist-nextprev'

This commit is contained in:
haya14busa 2014-06-12 10:32:20 +09:00
commit 2e2b2aedea
2 changed files with 17 additions and 4 deletions

View File

@ -305,6 +305,7 @@ function! EasyMotion#DotRepeat(visualmode) " {{{
endfunction " }}} endfunction " }}}
function! EasyMotion#NextPrevious(visualmode, direction) " {{{ function! EasyMotion#NextPrevious(visualmode, direction) " {{{
" Move next/previous destination using previous motion regexp " Move next/previous destination using previous motion regexp
let cnt = v:count1 " avoid overwriting
if !has_key(s:previous, 'regexp') if !has_key(s:previous, 'regexp')
call s:Message("Previous targets doesn't exist") call s:Message("Previous targets doesn't exist")
let s:EasyMotion_is_cancelled = 1 let s:EasyMotion_is_cancelled = 1
@ -322,10 +323,22 @@ function! EasyMotion#NextPrevious(visualmode, direction) " {{{
" FIXME: blink highlight " FIXME: blink highlight
silent exec 'normal! gv' silent exec 'normal! gv'
endif endif
for i in range(v:count1)
" Do not treat this motion as 'jump' motion " Mark jump-list
if cnt > 1
" Consider Next/Previous motions as jump motion :h jump-motion
" Note: It should add jumplist even if the count isn't given
" considering vim's default behavior of `n` & `N`, but just
" I don't want to do it without the count. Should I add a
" option?
normal! m`
endif
" Jump
for i in range(cnt)
keepjumps call searchpos(re, search_direction) keepjumps call searchpos(re, search_direction)
endfor endfor
call EasyMotion#reset() call EasyMotion#reset()
" -- Activate EasyMotion ----------------- {{{ " -- Activate EasyMotion ----------------- {{{
let s:EasyMotion_is_active = 1 let s:EasyMotion_is_active = 1

View File

@ -237,12 +237,12 @@ xnoremap <silent><Plug>(easymotion-dotrepeat)
noremap <silent><Plug>(easymotion-next) noremap <silent><Plug>(easymotion-next)
\ :<C-u>call EasyMotion#NextPrevious(0,0)<CR> \ :<C-u>call EasyMotion#NextPrevious(0,0)<CR>
xnoremap <silent><Plug>(easymotion-next) xnoremap <silent><Plug>(easymotion-next)
\ <Esc>:<C-u>call EasyMotion#NextPrevious(1,0)<CR> \ :<C-u>call EasyMotion#NextPrevious(1,0)<CR>
noremap <silent><Plug>(easymotion-prev) noremap <silent><Plug>(easymotion-prev)
\ :<C-u>call EasyMotion#NextPrevious(0,1)<CR> \ :<C-u>call EasyMotion#NextPrevious(0,1)<CR>
xnoremap <silent><Plug>(easymotion-prev) xnoremap <silent><Plug>(easymotion-prev)
\ <Esc>:<C-u>call EasyMotion#NextPrevious(1,1)<CR> \ :<C-u>call EasyMotion#NextPrevious(1,1)<CR>
"}}} "}}}
" -- Line Motion {{{ " -- Line Motion {{{