Merge branch 'feature/regexp-find' into master
This commit is contained in:
commit
3c562d9572
@ -45,6 +45,7 @@ function! EasyMotion#reset()
|
||||
let s:flag = {
|
||||
\ 'within_line' : 0,
|
||||
\ 'dot_repeat' : 0,
|
||||
\ 'regexp' : 0,
|
||||
\ }
|
||||
let s:current = {
|
||||
\ 'is_operator' : 0,
|
||||
@ -321,8 +322,8 @@ function! EasyMotion#DotRepeat(visualmode) " {{{
|
||||
let is_exclusive = s:previous.is_exclusive
|
||||
let s:current.is_operator = 1
|
||||
let s:flag.within_line = s:previous.line_flag
|
||||
let s:flag.dot_repeat = 1
|
||||
for cnt in range(v:count1)
|
||||
let s:flag.dot_repeat = 1
|
||||
silent call s:EasyMotion(re, direction, 0, is_exclusive)
|
||||
endfor
|
||||
endfunction " }}}
|
||||
@ -456,6 +457,7 @@ endfunction " }}}
|
||||
function! s:findMotion(num_strokes) "{{{
|
||||
" Find Motion: S,F,T
|
||||
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
|
||||
let s:flag.regexp = a:num_strokes == -1 ? 1 : 0
|
||||
|
||||
let s:previous['input'] = get(s:previous, 'input', '')
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:previous.input)
|
||||
@ -476,7 +478,7 @@ function! s:findMotion(num_strokes) "{{{
|
||||
return re
|
||||
endfunction "}}}
|
||||
function! s:convertRegep(input) "{{{
|
||||
let re = escape(a:input, '.$^~\[]')
|
||||
let re = s:should_use_regexp() ? a:input : escape(a:input, '.$^~\[]')
|
||||
|
||||
if s:should_use_migemo(a:input)
|
||||
let re = s:convertMigemo(re)
|
||||
@ -525,6 +527,9 @@ function! s:convertSmartcase(re, char) "{{{
|
||||
return '\C' . re
|
||||
endif
|
||||
endfunction "}}}
|
||||
function! s:should_use_regexp() "{{{
|
||||
return g:EasyMotion_use_regexp == 1 && s:flag.regexp == 1
|
||||
endfunction "}}}
|
||||
function! s:should_use_migemo(char) "{{{
|
||||
if ! g:EasyMotion_use_migemo || match(a:char, '\A') != -1
|
||||
return 0
|
||||
|
@ -31,6 +31,7 @@ let g:EasyMotion_smartcase = get(g: , 'EasyMotion_smartcase' ,
|
||||
let g:EasyMotion_skipfoldedline = get(g: , 'EasyMotion_skipfoldedline' , 1)
|
||||
let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' , 0)
|
||||
let g:EasyMotion_use_upper = get(g: , 'EasyMotion_use_upper' , 0)
|
||||
let g:EasyMotion_use_regexp = get(g: , 'EasyMotion_use_regexp' , 0)
|
||||
let g:EasyMotion_enter_jump_first = get(g: , 'EasyMotion_enter_jump_first' , 0)
|
||||
let g:EasyMotion_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1)
|
||||
let g:EasyMotion_prompt =
|
||||
|
@ -1091,5 +1091,44 @@ describe 'EasyMotion is jump motion'
|
||||
end
|
||||
"}}}
|
||||
|
||||
" Regexp {{{
|
||||
describe 'EasyMotion regexp'
|
||||
before
|
||||
new
|
||||
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
let g:EasyMotion_use_regexp = 1
|
||||
map s <Plug>(easymotion-sn)
|
||||
call EasyMotion#init()
|
||||
call AddLine('poge1 2huga 3hiyo 4poyo')
|
||||
" 12345678901234567890123
|
||||
end
|
||||
|
||||
after
|
||||
let g:EasyMotion_use_regexp = 0
|
||||
close!
|
||||
end
|
||||
|
||||
" <C-o> could jump back to previous location {{{
|
||||
it 'provide regexp motion'
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,'p']
|
||||
exe "normal s\\d\<CR>a"
|
||||
Expect CursorPos() == [l,5,'1']
|
||||
|
||||
normal! 0
|
||||
Expect CursorPos() == [l,1,'p']
|
||||
exe "normal s\\d\<CR>c"
|
||||
Expect CursorPos() == [l,13,'3']
|
||||
|
||||
exe "normal s\$\<CR>a"
|
||||
Expect CursorPos() == [l,23,'o']
|
||||
|
||||
exe "normal s\^\<CR>b"
|
||||
Expect CursorPos() == [l,1,'p']
|
||||
end
|
||||
"}}}
|
||||
end
|
||||
"}}}
|
||||
|
||||
" vim: fdm=marker:et:ts=4:sw=4:sts=4
|
||||
|
Loading…
Reference in New Issue
Block a user