Fixed vim and zsh
This commit is contained in:
274
vim/plugins/vim-easymotion/t/compare_movements_spec.vim
Normal file
274
vim/plugins/vim-easymotion/t/compare_movements_spec.vim
Normal file
@ -0,0 +1,274 @@
|
||||
"=============================================================================
|
||||
" FILE: t/compare_movements_spec.vim
|
||||
" AUTHOR: YggdrasiI
|
||||
" Test: https://github.com/kana/vim-vspec
|
||||
" Description: EasyMotion keyword movement test with vim-vspec
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
" Setup {{{
|
||||
let s:root_dir = matchstr(system('git rev-parse --show-cdup'), '[^\n]\+')
|
||||
|
||||
" The consumed time depends from the length of the text and could be really high
|
||||
" on vimdoc pages. (See it 'Loop through Vim help buffer and compare movements')
|
||||
" Reduce this value to stop CompareMovements(...) before it reached the end of the
|
||||
" buffer.
|
||||
let s:maximal_number_of_compared_movments = 10000
|
||||
execute 'set' 'rtp +=./'.s:root_dir
|
||||
runtime! plugin/EasyMotion.vim
|
||||
" }}}
|
||||
|
||||
" Functions for Test {{{
|
||||
function! AddLine(str)
|
||||
put =a:str
|
||||
endfunction
|
||||
|
||||
function! CursorPos()
|
||||
return [line('.'), col('.'), getline('.')[col('.')-1]]
|
||||
endfunction
|
||||
|
||||
" Nested normal to avoid throwing readonly errors. They abort the testing.
|
||||
function TryNormal(str)
|
||||
try
|
||||
exec 'normal ' . a:str
|
||||
catch /^Vim\%((\a\+)\)\=:E21/
|
||||
endtry
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
let s:to_cursor = {}
|
||||
function! s:to_cursor.match(actual, expected)
|
||||
return a:actual == a:expected
|
||||
endfunction
|
||||
|
||||
" Add metadata about failure.
|
||||
function! s:to_cursor.failure_message_for_should(actual, expected)
|
||||
Expect a:actual[0] > 0
|
||||
Expect a:expected[0] > 0
|
||||
Expect a:actual[0] <= getpos('$')[1]
|
||||
Expect a:expected[0] <= getpos('$')[1]
|
||||
Expect a:actual[1] > 0
|
||||
Expect a:expected[1] > 0
|
||||
|
||||
let line1 = getline(a:actual[0])
|
||||
let line2 = getline(a:expected[0])
|
||||
" Change char on cursor to '█'.
|
||||
let line1 = strpart(l:line1, 0, a:actual[1]-1)
|
||||
\ . '█'
|
||||
\ . strpart(l:line1, a:actual[1])
|
||||
let line2 = strpart(l:line2, 0, a:expected[1]-1)
|
||||
\ . '█'
|
||||
\ . strpart(l:line2, a:expected[1])
|
||||
" Separation of both cases with \n would be nice, but
|
||||
" vim-vspec allow oneliners as return string, only.
|
||||
let msg = 'Line ' . string(a:actual[0]) . ": '" . l:line1
|
||||
\ . "',\x09\x09 Line " . string(a:expected[0]) . ": '" . l:line2 . "'\x0a"
|
||||
return l:msg
|
||||
endfunction
|
||||
|
||||
function! CompareMovements(movement1, movement2, backward)
|
||||
let jumpmarks = [
|
||||
\ [a:movement1, []],
|
||||
\ [a:movement2, []],
|
||||
\ ]
|
||||
|
||||
" Loop through current buffer in both variants {{
|
||||
for [l:handler, l:list] in l:jumpmarks
|
||||
if a:backward == 1
|
||||
let last_line = line('$')
|
||||
let last_char = len(getline(l:last_line))
|
||||
call cursor(l:last_line, l:last_char)
|
||||
else
|
||||
call cursor([1,1])
|
||||
endif
|
||||
|
||||
let lastpos = [0,0]
|
||||
|
||||
" Centralize line. Otherwise, Easymotion functions aborts
|
||||
" at the end of the (virtual) window.
|
||||
call TryNormal('zz')
|
||||
call TryNormal(l:handler)
|
||||
let curpos = getpos(".")[1:2]
|
||||
|
||||
while l:lastpos != l:curpos
|
||||
let list += [l:curpos]
|
||||
let lastpos = l:curpos
|
||||
call TryNormal('zz')
|
||||
call TryNormal(l:handler)
|
||||
let curpos = getpos(".")[1:2]
|
||||
" Abort after a fixed number of steps.
|
||||
if len(l:list) > s:maximal_number_of_compared_movments
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endfor
|
||||
" }}
|
||||
|
||||
" The resulting lists are stored in l:jumpmarks[*][1], now.
|
||||
let [l:cursor_positions1, l:cursor_positions2] = [ l:jumpmarks[0][1], l:jumpmarks[1][1] ]
|
||||
|
||||
if l:cursor_positions1 == l:cursor_positions2
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Search for first unmatching position. {{
|
||||
let index = 0
|
||||
let len = min([len(l:cursor_positions2), len(l:cursor_positions1)])
|
||||
while l:index < l:len
|
||||
Expect l:cursor_positions2[l:index] to_cursor l:cursor_positions1[l:index]
|
||||
let index += 1
|
||||
endwhile
|
||||
|
||||
" Collision with begin or end of file or while loop aborts to early.
|
||||
if a:backward == 1
|
||||
Expect join([a:movement2, ': File begin reached after ', len(l:cursor_positions2), ' steps.'])
|
||||
\ == join([a:movement1, ': File begin reached after ', len(l:cursor_positions1), ' steps.'])
|
||||
else
|
||||
Expect l:cursor_positions2[l:index-1] to_cursor l:cursor_positions1[l:index]
|
||||
Expect join([a:movement2, ': File end reached after ', len(l:cursor_positions2), ' steps.'])
|
||||
\ == join([a:movement1, ': File end reached after ', len(l:cursor_positions1), ' steps.'])
|
||||
endif
|
||||
" }}
|
||||
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
" Hand crafted text with rare cases
|
||||
function! InsertTestText1()
|
||||
|
||||
" Blanks at document begin
|
||||
call AddLine('')
|
||||
call AddLine(' ')
|
||||
call AddLine('')
|
||||
|
||||
call AddLine('scriptencoding utf-8')
|
||||
|
||||
" '^\s*[not-\k]'-case
|
||||
call AddLine('!foo')
|
||||
call AddLine(' !bar')
|
||||
|
||||
call AddLine('<!{}>s! ')
|
||||
|
||||
" Blanks at document end
|
||||
call AddLine('')
|
||||
call AddLine(' ')
|
||||
call AddLine('')
|
||||
endfunction
|
||||
|
||||
"}}}
|
||||
|
||||
"Keyword word motion {{{
|
||||
describe 'Keyword word motion'
|
||||
before
|
||||
new
|
||||
resize 10
|
||||
nmap a <Nop>
|
||||
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
let g:EasyMotion_maximal_jumpmarks = 2 " Error for value 1 unanalyzed.
|
||||
nmap <Leader>w <Plug>(easymotion-iskeyword-w)
|
||||
nmap <Leader>b <Plug>(easymotion-iskeyword-b)
|
||||
nmap <Leader>e <Plug>(easymotion-iskeyword-e)
|
||||
nmap <Leader>ge <Plug>(easymotion-iskeyword-ge)
|
||||
nmap <Leader>W <Plug>(easymotion-W)
|
||||
nmap <Leader>B <Plug>(easymotion-B)
|
||||
nmap <Leader>E <Plug>(easymotion-E)
|
||||
nmap <Leader>gE <Plug>(easymotion-gE)
|
||||
call EasyMotion#init()
|
||||
call vspec#customize_matcher('to_cursor', s:to_cursor)
|
||||
end
|
||||
|
||||
after
|
||||
close!
|
||||
end
|
||||
|
||||
it 'Simple test to check setup of this test'
|
||||
" Check if a is remapped to <Nop> to avoid start of insert mode.
|
||||
normal aa\<Esc>
|
||||
Expect getline(1) == ''
|
||||
|
||||
call AddLine('word')
|
||||
Expect CompareMovements('w', 'w', 0) == 0
|
||||
Expect CompareMovements('w', '\wa', 0) == 0
|
||||
Expect CompareMovements('b', '\ba', 1) == 0
|
||||
Expect CompareMovements('e', '\ea', 0) == 0
|
||||
Expect CompareMovements('ge', '\gea', 1) == 0
|
||||
Expect CompareMovements('W', '\Wa', 0) == 0
|
||||
Expect CompareMovements('B', '\Ba', 1) == 0
|
||||
Expect CompareMovements('E', '\Ea', 0) == 0
|
||||
Expect CompareMovements('gE', '\gEa', 1) == 0
|
||||
end
|
||||
|
||||
it 'w'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('w', '\wa', 0) == 0
|
||||
end
|
||||
|
||||
it 'b'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('b', '\ba', 1) == 0
|
||||
end
|
||||
|
||||
it 'e'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('e', '\ea', 0) == 0
|
||||
end
|
||||
|
||||
it 'ge'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('ge', '\gea', 1) == 0
|
||||
end
|
||||
|
||||
it 'W'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('W', 'W', 0) == 0
|
||||
end
|
||||
|
||||
it 'B'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('B', 'B', 1) == 0
|
||||
end
|
||||
|
||||
it 'E'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('E', 'E', 0) == 0
|
||||
end
|
||||
|
||||
it 'gE'
|
||||
call InsertTestText1()
|
||||
Expect CompareMovements('gE', 'gE', 1) == 0
|
||||
end
|
||||
|
||||
" Really time consuming test...
|
||||
"it 'Loop through Vim help buffer and compare movements'
|
||||
" help motion.txt
|
||||
" Expect expand('%:t') ==# 'motion.txt'
|
||||
" "Optional: Copy text into editable buffer
|
||||
" exec "normal! Gygg\<C-W>cP"
|
||||
" Expect CompareMovements('w', '\wa', 0) == 0
|
||||
"end
|
||||
|
||||
end
|
||||
"}}}
|
||||
|
||||
" __END__ {{{
|
||||
" vim: fdm=marker:et:ts=4:sw=4:sts=4
|
||||
" }}}
|
1471
vim/plugins/vim-easymotion/t/easymotion_spec.vim
Normal file
1471
vim/plugins/vim-easymotion/t/easymotion_spec.vim
Normal file
File diff suppressed because it is too large
Load Diff
110
vim/plugins/vim-easymotion/t/operator_pending_spec.vim
Normal file
110
vim/plugins/vim-easymotion/t/operator_pending_spec.vim
Normal file
@ -0,0 +1,110 @@
|
||||
"=============================================================================
|
||||
" FILE: t/operator_pending_spec.vim
|
||||
" AUTHOR: haya14busa
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
" Avoid source test files {{{
|
||||
if expand("%:p") ==# expand("<sfile>:p")
|
||||
finish
|
||||
endif
|
||||
"}}}
|
||||
|
||||
" Setup {{{
|
||||
let s:root_dir = matchstr(system('git rev-parse --show-cdup'), '[^\n]\+')
|
||||
execute 'set' 'rtp +=./'.s:root_dir
|
||||
runtime! plugin/EasyMotion.vim
|
||||
"}}}
|
||||
|
||||
" Functions for Test {{{
|
||||
function! AddLine(str)
|
||||
put! =a:str
|
||||
endfunction
|
||||
|
||||
function! CursorPos()
|
||||
return [line('.'), col('.'), getline('.')[col('.')-1]]
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
|
||||
" NOTE:
|
||||
" I cannot test inclusive motion because mode() doesn't works well with
|
||||
" vim-vspec
|
||||
|
||||
" word motions {{{
|
||||
describe 'word motions'
|
||||
before
|
||||
new
|
||||
let g:EasyMotion_keys = '123456789'
|
||||
omap f <Plug>(easymotion-f)
|
||||
omap w <Plug>(easymotion-w)
|
||||
omap b <Plug>(easymotion-b)
|
||||
call EasyMotion#init()
|
||||
call AddLine('vim deco vim deco vim deco')
|
||||
" 123456789012345678901234567890
|
||||
end
|
||||
|
||||
after
|
||||
close!
|
||||
end
|
||||
|
||||
it '<Plug>(easymotion-w)'
|
||||
" Default position
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,'v']
|
||||
|
||||
normal dw1
|
||||
Expect CursorPos() == [l,1,'d']
|
||||
normal! u
|
||||
normal! 0
|
||||
Expect CursorPos() == [l,1,'v']
|
||||
|
||||
normal dw2
|
||||
Expect CursorPos() == [l,1,'v']
|
||||
normal! 0
|
||||
normal! u
|
||||
normal! 0
|
||||
Expect CursorPos() == [l,1,'v']
|
||||
end
|
||||
|
||||
it '<Plug>(easymotion-b)'
|
||||
" Default position
|
||||
normal! $
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,26,'o']
|
||||
|
||||
normal db1
|
||||
Expect CursorPos() == [l,23,'o']
|
||||
normal! u
|
||||
normal! $
|
||||
Expect CursorPos() == [l,26,'o']
|
||||
|
||||
normal db2
|
||||
Expect CursorPos() == [l,19,'o']
|
||||
normal! u
|
||||
normal! $
|
||||
Expect CursorPos() == [l,26,'o']
|
||||
end
|
||||
end
|
||||
"}}}
|
||||
|
575
vim/plugins/vim-easymotion/t/smartsign_spec.vim
Normal file
575
vim/plugins/vim-easymotion/t/smartsign_spec.vim
Normal file
@ -0,0 +1,575 @@
|
||||
"=============================================================================
|
||||
" FILE: t/smartsign_spec.vim
|
||||
" AUTHOR: haya14busa
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
" Test for `smartsign` feature for find motions
|
||||
|
||||
" Avoid source test files {{{
|
||||
if expand("%:p") ==# expand("<sfile>:p")
|
||||
finish
|
||||
endif
|
||||
"}}}
|
||||
|
||||
" Setup {{{
|
||||
let s:root_dir = matchstr(system('git rev-parse --show-cdup'), '[^\n]\+')
|
||||
execute 'set' 'rtp +=./'.s:root_dir
|
||||
runtime! plugin/EasyMotion.vim
|
||||
"}}}
|
||||
|
||||
" Functions for Test {{{
|
||||
function! AddLine(str)
|
||||
put! =a:str
|
||||
endfunction
|
||||
|
||||
function! CursorPos()
|
||||
return [line('.'), col('.'), getline('.')[col('.')-1]]
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
" Smartsign configulation {{{
|
||||
describe 'Smartsign configulation'
|
||||
it 'provide default dictionary'
|
||||
let smartdict_us = g:EasyMotion#sticky_table#us
|
||||
let smartdict_jp = g:EasyMotion#sticky_table#jp
|
||||
Expect smartdict_us !=# {}
|
||||
Expect smartdict_jp !=# {}
|
||||
end
|
||||
end
|
||||
"}}}
|
||||
|
||||
" Basic Smartsign feature with 1-key findmotions with US layout {{{
|
||||
describe 'Basic Smartsign feature with 1-key findmotions with US layout'
|
||||
before
|
||||
new
|
||||
let g:EasyMotion_keys = '123456789'
|
||||
let g:EasyMotion_use_smartsign_us = 1
|
||||
map s <Plug>(easymotion-s)
|
||||
call EasyMotion#init()
|
||||
call AddLine(' -_ =+ ;: [{ ]} `~ ''" \|')
|
||||
call AddLine(' 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0)')
|
||||
call AddLine(' ,< .> /?')
|
||||
" 123456789012345678901234567890
|
||||
" 1 2 3
|
||||
"
|
||||
" ',' : '<', '.' : '>', '/' : '?',
|
||||
" '1' : '!', '2' : '@', '3' : '#', '4' : '$', '5' : '%',
|
||||
" '6' : '^', '7' : '&', '8' : '*', '9' : '(', '0' : ')', '-' : '_', '=' : '+',
|
||||
" ';' : ':', '[' : '{', ']' : '}', '`' : '~', "'" : "\"", '\' : '|',
|
||||
end
|
||||
|
||||
after
|
||||
close!
|
||||
end
|
||||
|
||||
it 'works well for all sign as a target char'
|
||||
" Default position
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
|
||||
" ,<
|
||||
normal s,1
|
||||
Expect CursorPos() == [l,2,',']
|
||||
normal! 0
|
||||
normal s,2
|
||||
Expect CursorPos() == [l,3,'<']
|
||||
normal! 0
|
||||
normal s<1
|
||||
Expect CursorPos() == [l,3,'<']
|
||||
normal! 0
|
||||
normal s,3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
|
||||
" .>
|
||||
normal s.1
|
||||
Expect CursorPos() == [l,5,'.']
|
||||
normal! 0
|
||||
normal s.2
|
||||
Expect CursorPos() == [l,6,'>']
|
||||
normal! 0
|
||||
normal s>1
|
||||
Expect CursorPos() == [l,6,'>']
|
||||
normal! 0
|
||||
normal s.3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
|
||||
" /?
|
||||
normal s/1
|
||||
Expect CursorPos() == [l,8,'/']
|
||||
normal! 0
|
||||
normal s/2
|
||||
Expect CursorPos() == [l,9,'?']
|
||||
normal! 0
|
||||
normal s?1
|
||||
Expect CursorPos() == [l,9,'?']
|
||||
normal! 0
|
||||
normal s/3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 1!
|
||||
normal s11
|
||||
Expect CursorPos() == [l+1,2,'1']
|
||||
normal! 0
|
||||
normal s12
|
||||
Expect CursorPos() == [l+1,3,'!']
|
||||
normal! 0
|
||||
normal s!1
|
||||
Expect CursorPos() == [l+1,3,'!']
|
||||
normal! 0
|
||||
normal s13
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 2@
|
||||
normal s21
|
||||
Expect CursorPos() == [l+1,5,'2']
|
||||
normal! 0
|
||||
normal s22
|
||||
Expect CursorPos() == [l+1,6,'@']
|
||||
normal! 0
|
||||
normal s@1
|
||||
Expect CursorPos() == [l+1,6,'@']
|
||||
normal! 0
|
||||
normal s23
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 3#
|
||||
normal s31
|
||||
Expect CursorPos() == [l+1,8,'3']
|
||||
normal! 0
|
||||
normal s32
|
||||
Expect CursorPos() == [l+1,9,'#']
|
||||
normal! 0
|
||||
normal s#1
|
||||
Expect CursorPos() == [l+1,9,'#']
|
||||
normal! 0
|
||||
normal s33
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 4$
|
||||
normal s41
|
||||
Expect CursorPos() == [l+1,11,'4']
|
||||
normal! 0
|
||||
normal s42
|
||||
Expect CursorPos() == [l+1,12,'$']
|
||||
normal! 0
|
||||
normal s$1
|
||||
Expect CursorPos() == [l+1,12,'$']
|
||||
normal! 0
|
||||
normal s43
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 5%
|
||||
normal s51
|
||||
Expect CursorPos() == [l+1,14,'5']
|
||||
normal! 0
|
||||
normal s52
|
||||
Expect CursorPos() == [l+1,15,'%']
|
||||
normal! 0
|
||||
normal s%1
|
||||
Expect CursorPos() == [l+1,15,'%']
|
||||
normal! 0
|
||||
normal s53
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 6^
|
||||
normal s61
|
||||
Expect CursorPos() == [l+1,17,'6']
|
||||
normal! 0
|
||||
normal s62
|
||||
Expect CursorPos() == [l+1,18,'^']
|
||||
normal! 0
|
||||
normal s^1
|
||||
Expect CursorPos() == [l+1,18,'^']
|
||||
normal! 0
|
||||
normal s63
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 7&
|
||||
normal s71
|
||||
Expect CursorPos() == [l+1,20,'7']
|
||||
normal! 0
|
||||
normal s72
|
||||
Expect CursorPos() == [l+1,21,'&']
|
||||
normal! 0
|
||||
normal s&1
|
||||
Expect CursorPos() == [l+1,21,'&']
|
||||
normal! 0
|
||||
normal s73
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 8*
|
||||
normal s81
|
||||
Expect CursorPos() == [l+1,23,'8']
|
||||
normal! 0
|
||||
normal s82
|
||||
Expect CursorPos() == [l+1,24,'*']
|
||||
normal! 0
|
||||
normal s*1
|
||||
Expect CursorPos() == [l+1,24,'*']
|
||||
normal! 0
|
||||
normal s83
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 9(
|
||||
normal s91
|
||||
Expect CursorPos() == [l+1,26,'9']
|
||||
normal! 0
|
||||
normal s92
|
||||
Expect CursorPos() == [l+1,27,'(']
|
||||
normal! 0
|
||||
normal s(1
|
||||
Expect CursorPos() == [l+1,27,'(']
|
||||
normal! 0
|
||||
normal s93
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" 0)
|
||||
normal s01
|
||||
Expect CursorPos() == [l+1,29,'0']
|
||||
normal! 0
|
||||
normal s02
|
||||
Expect CursorPos() == [l+1,30,')']
|
||||
normal! 0
|
||||
normal s)1
|
||||
Expect CursorPos() == [l+1,30,')']
|
||||
normal! 0
|
||||
normal s03
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
|
||||
" -_
|
||||
normal s-1
|
||||
Expect CursorPos() == [l+2,2,'-']
|
||||
normal! 0
|
||||
normal s-2
|
||||
Expect CursorPos() == [l+2,3,'_']
|
||||
normal! 0
|
||||
normal s_1
|
||||
Expect CursorPos() == [l+2,3,'_']
|
||||
normal! 0
|
||||
normal s-3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" =+
|
||||
normal s=1
|
||||
Expect CursorPos() == [l+2,5,'=']
|
||||
normal! 0
|
||||
normal s=2
|
||||
Expect CursorPos() == [l+2,6,'+']
|
||||
normal! 0
|
||||
normal s+1
|
||||
Expect CursorPos() == [l+2,6,'+']
|
||||
normal! 0
|
||||
normal s=3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" ;:
|
||||
normal s;1
|
||||
Expect CursorPos() == [l+2,8,';']
|
||||
normal! 0
|
||||
normal s;2
|
||||
Expect CursorPos() == [l+2,9,':']
|
||||
normal! 0
|
||||
normal s:1
|
||||
Expect CursorPos() == [l+2,9,':']
|
||||
normal! 0
|
||||
normal s;3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" [{
|
||||
normal s[1
|
||||
Expect CursorPos() == [l+2,11,'[']
|
||||
normal! 0
|
||||
normal s[2
|
||||
Expect CursorPos() == [l+2,12,'{']
|
||||
normal! 0
|
||||
normal s{1
|
||||
Expect CursorPos() == [l+2,12,'{']
|
||||
normal! 0
|
||||
normal s[3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" ]}
|
||||
normal s]1
|
||||
Expect CursorPos() == [l+2,14,']']
|
||||
normal! 0
|
||||
normal s]2
|
||||
Expect CursorPos() == [l+2,15,'}']
|
||||
normal! 0
|
||||
normal s}1
|
||||
Expect CursorPos() == [l+2,15,'}']
|
||||
normal! 0
|
||||
normal s]3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" `~
|
||||
normal s`1
|
||||
Expect CursorPos() == [l+2,17,'`']
|
||||
normal! 0
|
||||
normal s`2
|
||||
Expect CursorPos() == [l+2,18,'~']
|
||||
normal! 0
|
||||
normal s~1
|
||||
Expect CursorPos() == [l+2,18,'~']
|
||||
normal! 0
|
||||
normal s`3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" '"
|
||||
normal s'1
|
||||
Expect CursorPos() == [l+2,20,'''']
|
||||
normal! 0
|
||||
normal s'2
|
||||
Expect CursorPos() == [l+2,21,'"']
|
||||
normal! 0
|
||||
normal s"1
|
||||
Expect CursorPos() == [l+2,21,'"']
|
||||
normal! 0
|
||||
normal s'3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
|
||||
" \|
|
||||
normal s\1
|
||||
Expect CursorPos() == [l+2,23,'\']
|
||||
normal! 0
|
||||
normal s\2
|
||||
Expect CursorPos() == [l+2,24,'|']
|
||||
normal! 0
|
||||
normal s|1
|
||||
Expect CursorPos() == [l+2,24,'|']
|
||||
normal! 0
|
||||
normal s\3
|
||||
Expect CursorPos() == [l+2,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
end
|
||||
"}}}
|
||||
|
||||
" Smartsign with 2-key find motions with US layout {{{
|
||||
describe 'Smartsign with 2-key find motions with US layout'
|
||||
before
|
||||
new
|
||||
let g:EasyMotion_keys = '123456789'
|
||||
let g:EasyMotion_use_smartsign_us = 1
|
||||
map s <Plug>(easymotion-s2)
|
||||
call EasyMotion#init()
|
||||
call AddLine(' -_ =+ ;: [{ ]} `~ ''" \|')
|
||||
call AddLine(' 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0)')
|
||||
call AddLine(' ,< .> /?')
|
||||
call AddLine(' -_ =+ ;: [{ ]} `~ ''" \|')
|
||||
call AddLine(' 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0)')
|
||||
call AddLine(' ,< .> /?')
|
||||
" 123456789012345678901234567890
|
||||
" 1 2 3
|
||||
end
|
||||
|
||||
after
|
||||
close!
|
||||
end
|
||||
|
||||
it 'works well'
|
||||
" Default position
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
|
||||
" ,<
|
||||
normal s,,1
|
||||
Expect CursorPos() == [l,2,',']
|
||||
normal! 0
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal s,,3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
normal s, 1
|
||||
Expect CursorPos() == [l,3,'<']
|
||||
normal! 0
|
||||
normal s<<1
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
normal s,<1
|
||||
Expect CursorPos() == [l,2,',']
|
||||
normal! 0
|
||||
normal s<,1
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
it ': s,,3'
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal s,,3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
|
||||
it 'escape * asterisc #151'
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal s1*22
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
normal s8*1
|
||||
Expect CursorPos() == [l+1,23,'8']
|
||||
normal! 0
|
||||
normal s881
|
||||
Expect CursorPos() == [l+1,23,'8']
|
||||
normal! 0
|
||||
normal s**1
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
normal s*81
|
||||
Expect CursorPos() == [l+1,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
end
|
||||
"}}}
|
||||
|
||||
" Smartsign with 2-key find motions with JP layout {{{
|
||||
describe 'Smartsign with 2-key find motions with JP layout'
|
||||
before
|
||||
new
|
||||
let g:EasyMotion_keys = '123456789'
|
||||
let g:EasyMotion_use_smartsign_jp = 1
|
||||
map s <Plug>(easymotion-s2)
|
||||
call EasyMotion#init()
|
||||
call AddLine(' -= ^~ ;+ :* [{ ]} @` \|')
|
||||
call AddLine(' 1! 2" 3# 4$ 5% 6& 7'' 8( 9) 0_')
|
||||
call AddLine(' ,< .> /?')
|
||||
call AddLine(' -= ^~ ;+ :* [{ ]} @` \|')
|
||||
call AddLine(' 1! 2" 3# 4$ 5% 6& 7'' 8( 9) 0_')
|
||||
call AddLine(' ,< .> /?')
|
||||
" 123456789012345678901234567890
|
||||
" 1 2 3
|
||||
"
|
||||
"',' : '<', '.' : '>', '/' : '?',
|
||||
"'1' : '!', '2' : '"', '3' : '#', '4' : '$', '5' : '%',
|
||||
"'6' : '&', '7' : "'", '8' : '(', '9' : ')', '0' : '_', '-' : '=', '^' : '~',
|
||||
"';' : '+', ':' : '*', '[' : '{', ']' : '}', '@' : '`', '\' : '|',
|
||||
"
|
||||
end
|
||||
|
||||
after
|
||||
close!
|
||||
end
|
||||
|
||||
it 'works well'
|
||||
" Default position
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
|
||||
" ,<
|
||||
normal s,,1
|
||||
Expect CursorPos() == [l,2,',']
|
||||
normal! 0
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal s,,3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
normal s, 1
|
||||
Expect CursorPos() == [l,3,'<']
|
||||
normal! 0
|
||||
normal s<<1
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
normal s,<1
|
||||
Expect CursorPos() == [l,2,',']
|
||||
normal! 0
|
||||
normal s<,1
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
it ': s,,3'
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal s,,3
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
end
|
||||
"}}}
|
||||
|
||||
" Smartsign with n-key find search motions {{{
|
||||
describe 'Smartsign with n-key find search motions'
|
||||
before
|
||||
new
|
||||
let g:EasyMotion_keys = '123456789'
|
||||
let g:EasyMotion_use_smartsign_jp = 1
|
||||
map / <Plug>(easymotion-sn)
|
||||
call EasyMotion#init()
|
||||
call AddLine(' -= ^~ ;+ :* [{ ]} @` \|')
|
||||
call AddLine(' 1! 2" 3# 4$ 5% 6& 7'' 8( 9) 0_')
|
||||
call AddLine(' ,< .> /?')
|
||||
call AddLine(' -= ^~ ;+ :* [{ ]} @` \|')
|
||||
call AddLine(' 1! 2" 3# 4$ 5% 6& 7'' 8( 9) 0_')
|
||||
call AddLine(' ,< .> /?')
|
||||
end
|
||||
|
||||
after
|
||||
close!
|
||||
end
|
||||
|
||||
it 'do not work'
|
||||
" Default position
|
||||
normal! 0
|
||||
let l = line('.')
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
|
||||
" ,<
|
||||
normal /,,1
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
normal /,<1
|
||||
Expect CursorPos() == [l,1,' ']
|
||||
normal! 0
|
||||
end
|
||||
end
|
||||
"}}}
|
||||
|
||||
" __END__ {{{
|
||||
" vim: expandtab softtabstop=4 shiftwidth=4
|
||||
" vim: foldmethod=marker
|
||||
" }}}
|
Reference in New Issue
Block a user