949 lines
38 KiB
VimL
949 lines
38 KiB
VimL
|
"=============================================================================
|
|||
|
" FILE: t/easymotion_spec.vim
|
|||
|
" AUTHOR: haya14busa
|
|||
|
" Last Change: 16 Jan 2014.
|
|||
|
" Test: https://github.com/kana/vim-vspec
|
|||
|
" Refer: https://github.com/rhysd/clever-f.vim
|
|||
|
" Description: EasyMotion 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.
|
|||
|
" }}}
|
|||
|
"=============================================================================
|
|||
|
|
|||
|
let s:root_dir = matchstr(system('git rev-parse --show-cdup'), '[^\n]\+')
|
|||
|
execute 'set' 'rtp +=./'.s:root_dir
|
|||
|
runtime! plugin/EasyMotion.vim
|
|||
|
|
|||
|
" Default settings {{{
|
|||
|
describe 'Default settings'
|
|||
|
it 'provide default <Plug> mappings for find motion'
|
|||
|
" Find Motion: {{{
|
|||
|
" s
|
|||
|
Expect maparg('<Plug>(easymotion-s)', 'n') ==# ':<C-U>call EasyMotion#S(1,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-s)', 'o') ==# ':<C-U>call EasyMotion#S(1,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-s)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(1,1,2)<CR>'
|
|||
|
" f
|
|||
|
Expect maparg('<Plug>(easymotion-f)', 'n') ==# ':<C-U>call EasyMotion#S(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-f)', 'o') ==# ':<C-U>call EasyMotion#S(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-f)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(1,1,0)<CR>'
|
|||
|
" F
|
|||
|
Expect maparg('<Plug>(easymotion-F)', 'n') ==# ':<C-U>call EasyMotion#S(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-F)', 'o') ==# ':<C-U>call EasyMotion#S(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-F)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(1,1,1)<CR>'
|
|||
|
" t
|
|||
|
Expect maparg('<Plug>(easymotion-t)', 'n') ==# ':<C-U>call EasyMotion#T(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-t)', 'o') ==# ':<C-U>call EasyMotion#T(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-t)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(1,1,0)<CR>'
|
|||
|
" T
|
|||
|
Expect maparg('<Plug>(easymotion-T)', 'n') ==# ':<C-U>call EasyMotion#T(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-T)', 'o') ==# ':<C-U>call EasyMotion#T(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-T)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(1,1,1)<CR>'
|
|||
|
" sl
|
|||
|
Expect maparg('<Plug>(easymotion-sl)', 'n') ==# ':<C-U>call EasyMotion#SL(1,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sl)', 'o') ==# ':<C-U>call EasyMotion#SL(1,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(1,1,2)<CR>'
|
|||
|
" fl
|
|||
|
Expect maparg('<Plug>(easymotion-fl)', 'n') ==# ':<C-U>call EasyMotion#SL(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fl)', 'o') ==# ':<C-U>call EasyMotion#SL(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(1,1,0)<CR>'
|
|||
|
" Fl
|
|||
|
Expect maparg('<Plug>(easymotion-Fl)', 'n') ==# ':<C-U>call EasyMotion#SL(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fl)', 'o') ==# ':<C-U>call EasyMotion#SL(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(1,1,1)<CR>'
|
|||
|
" tl
|
|||
|
Expect maparg('<Plug>(easymotion-tl)', 'n') ==# ':<C-U>call EasyMotion#TL(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tl)', 'o') ==# ':<C-U>call EasyMotion#TL(1,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(1,1,0)<CR>'
|
|||
|
" Tl
|
|||
|
Expect maparg('<Plug>(easymotion-Tl)', 'n') ==# ':<C-U>call EasyMotion#TL(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tl)', 'o') ==# ':<C-U>call EasyMotion#TL(1,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(1,1,1)<CR>'
|
|||
|
"}}}
|
|||
|
|
|||
|
" Two Char Find Motion: {{{
|
|||
|
" s2
|
|||
|
Expect maparg('<Plug>(easymotion-s2)', 'n') ==# ':<C-U>call EasyMotion#S(2,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-s2)', 'o') ==# ':<C-U>call EasyMotion#S(2,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-s2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(2,1,2)<CR>'
|
|||
|
" f2
|
|||
|
Expect maparg('<Plug>(easymotion-f2)', 'n') ==# ':<C-U>call EasyMotion#S(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-f2)', 'o') ==# ':<C-U>call EasyMotion#S(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-f2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(2,1,0)<CR>'
|
|||
|
" F2
|
|||
|
Expect maparg('<Plug>(easymotion-F2)', 'n') ==# ':<C-U>call EasyMotion#S(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-F2)', 'o') ==# ':<C-U>call EasyMotion#S(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-F2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(2,1,1)<CR>'
|
|||
|
" t2
|
|||
|
Expect maparg('<Plug>(easymotion-t2)', 'n') ==# ':<C-U>call EasyMotion#T(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-t2)', 'o') ==# ':<C-U>call EasyMotion#T(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-t2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(2,1,0)<CR>'
|
|||
|
" T2
|
|||
|
Expect maparg('<Plug>(easymotion-T2)', 'n') ==# ':<C-U>call EasyMotion#T(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-T2)', 'o') ==# ':<C-U>call EasyMotion#T(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-T2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(2,1,1)<CR>'
|
|||
|
" sl2
|
|||
|
Expect maparg('<Plug>(easymotion-sl2)', 'n') ==# ':<C-U>call EasyMotion#SL(2,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sl2)', 'o') ==# ':<C-U>call EasyMotion#SL(2,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sl2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(2,1,2)<CR>'
|
|||
|
" fl2
|
|||
|
Expect maparg('<Plug>(easymotion-fl2)', 'n') ==# ':<C-U>call EasyMotion#SL(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fl2)', 'o') ==# ':<C-U>call EasyMotion#SL(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fl2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(2,1,0)<CR>'
|
|||
|
" Fl2
|
|||
|
Expect maparg('<Plug>(easymotion-Fl2)', 'n') ==# ':<C-U>call EasyMotion#SL(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fl2)', 'o') ==# ':<C-U>call EasyMotion#SL(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fl2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(2,1,1)<CR>'
|
|||
|
" tl2
|
|||
|
Expect maparg('<Plug>(easymotion-tl2)', 'n') ==# ':<C-U>call EasyMotion#TL(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tl2)', 'o') ==# ':<C-U>call EasyMotion#TL(2,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tl2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(2,1,0)<CR>'
|
|||
|
" Tl2
|
|||
|
Expect maparg('<Plug>(easymotion-Tl2)', 'n') ==# ':<C-U>call EasyMotion#TL(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tl2)', 'o') ==# ':<C-U>call EasyMotion#TL(2,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tl2)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(2,1,1)<CR>'
|
|||
|
"}}}
|
|||
|
|
|||
|
" Multi Char Find Motion: {{{
|
|||
|
" sn
|
|||
|
Expect maparg('<Plug>(easymotion-sn)', 'n') ==# ':<C-U>call EasyMotion#S(50,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sn)', 'o') ==# ':<C-U>call EasyMotion#S(50,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(50,1,2)<CR>'
|
|||
|
" fn
|
|||
|
Expect maparg('<Plug>(easymotion-fn)', 'n') ==# ':<C-U>call EasyMotion#S(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fn)', 'o') ==# ':<C-U>call EasyMotion#S(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(50,1,0)<CR>'
|
|||
|
" Fn
|
|||
|
Expect maparg('<Plug>(easymotion-Fn)', 'n') ==# ':<C-U>call EasyMotion#S(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fn)', 'o') ==# ':<C-U>call EasyMotion#S(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(50,1,1)<CR>'
|
|||
|
" tn
|
|||
|
Expect maparg('<Plug>(easymotion-tn)', 'n') ==# ':<C-U>call EasyMotion#T(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tn)', 'o') ==# ':<C-U>call EasyMotion#T(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(50,1,0)<CR>'
|
|||
|
" Tn
|
|||
|
Expect maparg('<Plug>(easymotion-Tn)', 'n') ==# ':<C-U>call EasyMotion#T(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tn)', 'o') ==# ':<C-U>call EasyMotion#T(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(50,1,1)<CR>'
|
|||
|
" sln
|
|||
|
Expect maparg('<Plug>(easymotion-sln)', 'n') ==# ':<C-U>call EasyMotion#SL(50,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sln)', 'o') ==# ':<C-U>call EasyMotion#SL(50,0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(50,1,2)<CR>'
|
|||
|
" fln
|
|||
|
Expect maparg('<Plug>(easymotion-fln)', 'n') ==# ':<C-U>call EasyMotion#SL(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fln)', 'o') ==# ':<C-U>call EasyMotion#SL(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-fln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(50,1,0)<CR>'
|
|||
|
" Fln
|
|||
|
Expect maparg('<Plug>(easymotion-Fln)', 'n') ==# ':<C-U>call EasyMotion#SL(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fln)', 'o') ==# ':<C-U>call EasyMotion#SL(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Fln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(50,1,1)<CR>'
|
|||
|
" tln
|
|||
|
Expect maparg('<Plug>(easymotion-tln)', 'n') ==# ':<C-U>call EasyMotion#TL(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tln)', 'o') ==# ':<C-U>call EasyMotion#TL(50,0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-tln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(50,1,0)<CR>'
|
|||
|
" Tln
|
|||
|
Expect maparg('<Plug>(easymotion-Tln)', 'n') ==# ':<C-U>call EasyMotion#TL(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tln)', 'o') ==# ':<C-U>call EasyMotion#TL(50,0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-Tln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(50,1,1)<CR>'
|
|||
|
"}}}
|
|||
|
end
|
|||
|
|
|||
|
it 'provide default <Plug> mappings for regrex motion'
|
|||
|
"(is_visual, direction)
|
|||
|
" direction:
|
|||
|
" - 0: forward
|
|||
|
" - 1: backward
|
|||
|
" - 2: bi-direction
|
|||
|
" Word Motion: {{{
|
|||
|
Expect maparg('<Plug>(easymotion-w)', 'n') ==# ':<C-U>call EasyMotion#WB(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-w)', 'o') ==# ':<C-U>call EasyMotion#WB(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-w)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WB(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-b)', 'n') ==# ':<C-U>call EasyMotion#WB(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-b)', 'o') ==# ':<C-U>call EasyMotion#WB(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-b)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WB(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-w)', 'n') ==# ':<C-U>call EasyMotion#WB(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-w)', 'o') ==# ':<C-U>call EasyMotion#WB(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-w)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WB(1,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-S)', 'n') ==# ':<C-U>call EasyMotion#WB(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-S)', 'o') ==# ':<C-U>call EasyMotion#WB(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-S)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WB(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" WORD Motion: {{{
|
|||
|
Expect maparg('<Plug>(easymotion-W)', 'n') ==# ':<C-U>call EasyMotion#WBW(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-W)', 'o') ==# ':<C-U>call EasyMotion#WBW(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-W)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBW(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-B)', 'n') ==# ':<C-U>call EasyMotion#WBW(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-B)', 'o') ==# ':<C-U>call EasyMotion#WBW(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-B)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBW(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-W)', 'n') ==# ':<C-U>call EasyMotion#WBW(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-W)', 'o') ==# ':<C-U>call EasyMotion#WBW(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-W)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBW(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" End Of Word Motion: {{{
|
|||
|
Expect maparg('<Plug>(easymotion-e)', 'n') ==# ':<C-U>call EasyMotion#E(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-e)', 'o') ==# ':<C-U>call EasyMotion#E(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-e)', 'v') ==# '<Esc>:<C-U>call EasyMotion#E(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-ge)', 'n') ==# ':<C-U>call EasyMotion#E(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-ge)', 'o') ==# ':<C-U>call EasyMotion#E(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-ge)', 'v') ==# '<Esc>:<C-U>call EasyMotion#E(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-e)', 'n') ==# ':<C-U>call EasyMotion#E(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-e)', 'o') ==# ':<C-U>call EasyMotion#E(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-e)', 'v') ==# '<Esc>:<C-U>call EasyMotion#E(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" END OF WORD Motion: {{{
|
|||
|
Expect maparg('<Plug>(easymotion-E)', 'n') ==# ':<C-U>call EasyMotion#EW(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-E)', 'o') ==# ':<C-U>call EasyMotion#EW(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-E)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EW(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-gE)', 'n') ==# ':<C-U>call EasyMotion#EW(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-gE)', 'o') ==# ':<C-U>call EasyMotion#EW(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-gE)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EW(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-E)', 'n') ==# ':<C-U>call EasyMotion#EW(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-E)', 'o') ==# ':<C-U>call EasyMotion#EW(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-E)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EW(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" JK Motion: {{{
|
|||
|
" default
|
|||
|
Expect maparg('<Plug>(easymotion-j)', 'n') ==# ':<C-U>call EasyMotion#JK(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-j)', 'o') ==# ':<C-U>call EasyMotion#JK(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-j)', 'v') ==# '<Esc>:<C-U>call EasyMotion#JK(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-k)', 'n') ==# ':<C-U>call EasyMotion#JK(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-k)', 'o') ==# ':<C-U>call EasyMotion#JK(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-k)', 'v') ==# '<Esc>:<C-U>call EasyMotion#JK(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-jk)', 'n') ==# ':<C-U>call EasyMotion#JK(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-jk)', 'o') ==# ':<C-U>call EasyMotion#JK(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-jk)', 'v') ==# '<Esc>:<C-U>call EasyMotion#JK(1,2)<CR>'
|
|||
|
" start of line
|
|||
|
Expect maparg('<Plug>(easymotion-sol-j)', 'n') ==# ':<C-U>call EasyMotion#Sol(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-j)', 'o') ==# ':<C-U>call EasyMotion#Sol(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-j)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Sol(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-k)', 'n') ==# ':<C-U>call EasyMotion#Sol(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-k)', 'o') ==# ':<C-U>call EasyMotion#Sol(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-k)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Sol(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-bd-jk)', 'n') ==# ':<C-U>call EasyMotion#Sol(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-bd-jk)', 'o') ==# ':<C-U>call EasyMotion#Sol(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-sol-bd-jk)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Sol(1,2)<CR>'
|
|||
|
" end of line
|
|||
|
Expect maparg('<Plug>(easymotion-eol-j)', 'n') ==# ':<C-U>call EasyMotion#Eol(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-j)', 'o') ==# ':<C-U>call EasyMotion#Eol(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-j)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Eol(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-k)', 'n') ==# ':<C-U>call EasyMotion#Eol(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-k)', 'o') ==# ':<C-U>call EasyMotion#Eol(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-k)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Eol(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-bd-jk)', 'n') ==# ':<C-U>call EasyMotion#Eol(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-bd-jk)', 'o') ==# ':<C-U>call EasyMotion#Eol(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-eol-bd-jk)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Eol(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" Search Motion: {{{
|
|||
|
Expect maparg('<Plug>(easymotion-n)', 'n') ==# ':<C-U>call EasyMotion#Search(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-n)', 'o') ==# ':<C-U>call EasyMotion#Search(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-n)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Search(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-N)', 'n') ==# ':<C-U>call EasyMotion#Search(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-N)', 'o') ==# ':<C-U>call EasyMotion#Search(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-N)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Search(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-n)', 'n') ==# ':<C-U>call EasyMotion#Search(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-n)', 'o') ==# ':<C-U>call EasyMotion#Search(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-n)', 'v') ==# '<Esc>:<C-U>call EasyMotion#Search(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" JumpToAnywhere Motion: {{{
|
|||
|
Expect maparg('<Plug>(easymotion-jumptoanywhere)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#JumpToAnywhere(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-jumptoanywhere)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#JumpToAnywhere(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-jumptoanywhere)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#JumpToAnywhere(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" Repeat Motion: {{{
|
|||
|
" (is_visual)
|
|||
|
Expect maparg('<Plug>(easymotion-repeat)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#Repeat(0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-repeat)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#Repeat(0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-repeat)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#Repeat(1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-dotrepeat)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#DotRepeat(0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-dotrepeat)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#DotRepeat(0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-dotrepeat)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#DotRepeat(1)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" Line Motion: {{{
|
|||
|
" word
|
|||
|
Expect maparg('<Plug>(easymotion-wl)', 'n') ==# ':<C-U>call EasyMotion#WBL(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-wl)', 'o') ==# ':<C-U>call EasyMotion#WBL(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-wl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBL(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bl)', 'n') ==# ':<C-U>call EasyMotion#WBL(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bl)', 'o') ==# ':<C-U>call EasyMotion#WBL(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBL(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-wl)', 'n') ==# ':<C-U>call EasyMotion#WBL(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-wl)', 'o') ==# ':<C-U>call EasyMotion#WBL(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-wl)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBL(1,2)<CR>'
|
|||
|
" end of word
|
|||
|
Expect maparg('<Plug>(easymotion-el)', 'n') ==# ':<C-U>call EasyMotion#EL(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-el)', 'o') ==# ':<C-U>call EasyMotion#EL(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-el)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EL(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-gel)', 'n') ==# ':<C-U>call EasyMotion#EL(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-gel)', 'o') ==# ':<C-U>call EasyMotion#EL(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-gel)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EL(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-el)', 'n') ==# ':<C-U>call EasyMotion#EL(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-el)', 'o') ==# ':<C-U>call EasyMotion#EL(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-bd-el)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EL(1,2)<CR>'
|
|||
|
" LineAnywhere
|
|||
|
Expect maparg('<Plug>(easymotion-lineforward)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#LineAnywhere(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-lineforward)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#LineAnywhere(0,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-lineforward)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#LineAnywhere(1,0)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-linebackward)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#LineAnywhere(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-linebackward)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#LineAnywhere(0,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-linebackward)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#LineAnywhere(1,1)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-lineanywhere)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#LineAnywhere(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-lineanywhere)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#LineAnywhere(0,2)<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-lineanywhere)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#LineAnywhere(1,2)<CR>'
|
|||
|
" }}}
|
|||
|
|
|||
|
" Special Motion: {{{
|
|||
|
" SelectLines
|
|||
|
Expect maparg('<Plug>(easymotion-special-l)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#SelectLines()<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-special-l)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#SelectLines()<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-special-ly)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#SelectLinesYank()<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-special-ld)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#SelectLinesDelete()<CR>'
|
|||
|
" SelectPhrase
|
|||
|
Expect maparg('<Plug>(easymotion-special-p)', 'o')
|
|||
|
\ ==# ':<C-U>call EasyMotion#SelectPhrase()<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-special-p)', 'v')
|
|||
|
\ ==# '<Esc>:<C-U>call EasyMotion#SelectPhrase()<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-special-py)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#SelectPhraseYank()<CR>'
|
|||
|
Expect maparg('<Plug>(easymotion-special-pd)', 'n')
|
|||
|
\ ==# ':<C-U>call EasyMotion#SelectPhraseDelete()<CR>'
|
|||
|
" }}}
|
|||
|
end
|
|||
|
|
|||
|
it 'provide autoload functions'
|
|||
|
try
|
|||
|
" load autoload functions
|
|||
|
runtime autoload/EasyMotion.vim
|
|||
|
runtime autoload/EasyMotion/helper.vim
|
|||
|
runtime autoload/EasyMotion/cmigemo.vim
|
|||
|
runtime autoload/EasyMotion/init.vim
|
|||
|
runtime autoload/EasyMotion/sticky_table.vim
|
|||
|
catch
|
|||
|
endtry
|
|||
|
" autoload/EasyMotion.vim {{{
|
|||
|
Expect exists('*EasyMotion#hoge') ==# 0
|
|||
|
Expect exists('*EasyMotion#S') ==# 1
|
|||
|
Expect exists('*EasyMotion#T') ==# 1
|
|||
|
Expect exists('*EasyMotion#WB') ==# 1
|
|||
|
Expect exists('*EasyMotion#WBW') ==# 1
|
|||
|
Expect exists('*EasyMotion#E') ==# 1
|
|||
|
Expect exists('*EasyMotion#EW') ==# 1
|
|||
|
Expect exists('*EasyMotion#JK') ==# 1
|
|||
|
Expect exists('*EasyMotion#Sol') ==# 1
|
|||
|
Expect exists('*EasyMotion#Eol') ==# 1
|
|||
|
Expect exists('*EasyMotion#Search') ==# 1
|
|||
|
Expect exists('*EasyMotion#JumpToAnywhere') ==# 1
|
|||
|
Expect exists('*EasyMotion#SL') ==# 1
|
|||
|
Expect exists('*EasyMotion#TL') ==# 1
|
|||
|
Expect exists('*EasyMotion#WBL') ==# 1
|
|||
|
Expect exists('*EasyMotion#EL') ==# 1
|
|||
|
Expect exists('*EasyMotion#LineAnywhere') ==# 1
|
|||
|
Expect exists('*EasyMotion#SelectLines') ==# 1
|
|||
|
Expect exists('*EasyMotion#SelectLinesYank') ==# 1
|
|||
|
Expect exists('*EasyMotion#SelectLinesDelete') ==# 1
|
|||
|
Expect exists('*EasyMotion#SelectPhrase') ==# 1
|
|||
|
Expect exists('*EasyMotion#SelectPhraseYank') ==# 1
|
|||
|
Expect exists('*EasyMotion#SelectPhraseDelete') ==# 1
|
|||
|
Expect exists('*EasyMotion#Repeat') ==# 1
|
|||
|
Expect exists('*EasyMotion#DotRepeat') ==# 1
|
|||
|
"}}}
|
|||
|
end
|
|||
|
|
|||
|
it 'provide variables to customize EasyMotion'
|
|||
|
" Option {{{
|
|||
|
Expect g:EasyMotion_keys ==# 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
Expect g:EasyMotion_do_mapping ==# 1
|
|||
|
Expect g:EasyMotion_do_special_mapping ==# 0
|
|||
|
Expect g:EasyMotion_do_shade ==# 1
|
|||
|
Expect g:EasyMotion_grouping ==# 1
|
|||
|
Expect g:EasyMotion_startofline ==# 1
|
|||
|
Expect g:EasyMotion_smartcase ==# 0
|
|||
|
Expect g:EasyMotion_skipfoldedline ==# 1
|
|||
|
Expect g:EasyMotion_use_migemo ==# 0
|
|||
|
Expect g:EasyMotion_use_upper ==# 0
|
|||
|
Expect g:EasyMotion_enter_jump_first ==# 0
|
|||
|
Expect g:EasyMotion_show_prompt ==# 1
|
|||
|
Expect g:EasyMotion_prompt ==# '> '
|
|||
|
Expect g:EasyMotion_command_line_key_mappings ==# {}
|
|||
|
" }}}
|
|||
|
|
|||
|
" highlight {{{
|
|||
|
Expect g:EasyMotion_hl_group_target ==# 'EasyMotionTarget'
|
|||
|
Expect g:EasyMotion_hl2_first_group_target ==# 'EasyMotionTarget2First'
|
|||
|
Expect g:EasyMotion_hl2_second_group_target ==# 'EasyMotionTarget2Second'
|
|||
|
Expect g:EasyMotion_hl_group_shade ==# 'EasyMotionShade'
|
|||
|
Expect g:EasyMotion_hl_line_group_shade ==# 'EasyMotionShadeLine'
|
|||
|
" }}}
|
|||
|
end
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
function! AddLine(str)
|
|||
|
put! =a:str
|
|||
|
endfunction
|
|||
|
|
|||
|
function! CursorPos()
|
|||
|
return [line('.'), col('.'), getline('.')[col('.')-1]]
|
|||
|
endfunction
|
|||
|
|
|||
|
" s, f, F, t and T mappings {{{
|
|||
|
describe 's, f, F, t and T mappings'
|
|||
|
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('poge huga hiyo poyo')
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
end
|
|||
|
|
|||
|
" s {{{
|
|||
|
it 'provide improved forward search like builtin f & F'
|
|||
|
normal! 0
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
normal sha
|
|||
|
Expect CursorPos() == [l,6,'h']
|
|||
|
Expect CursorPos() != [l,1,'h']
|
|||
|
|
|||
|
normal! 0
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
normal shb
|
|||
|
Expect CursorPos() == [l,11,'h']
|
|||
|
|
|||
|
normal sh
|
|||
|
Expect CursorPos() == [l,6,'h']
|
|||
|
|
|||
|
normal! $
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,19,'o']
|
|||
|
|
|||
|
normal spc
|
|||
|
Expect CursorPos() == [l,19,'o']
|
|||
|
|
|||
|
normal spb
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
end
|
|||
|
"}}}
|
|||
|
" f {{{
|
|||
|
it 'provide improved backward search like builtin f'
|
|||
|
normal! 0
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
|
|||
|
normal fha
|
|||
|
Expect CursorPos() == [l,6,'h']
|
|||
|
Expect CursorPos() != [l,1,'h']
|
|||
|
|
|||
|
normal! 0
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
normal fhb
|
|||
|
Expect CursorPos() == [l,11,'h']
|
|||
|
|
|||
|
normal fh
|
|||
|
Expect CursorPos() == [l,11,'h']
|
|||
|
|
|||
|
end
|
|||
|
" "}}}
|
|||
|
" F {{{
|
|||
|
it 'provide improved backward search like builtin F'
|
|||
|
normal! $
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,19,'o']
|
|||
|
|
|||
|
normal Fpa
|
|||
|
Expect CursorPos() == [l,16,'p']
|
|||
|
|
|||
|
normal! $
|
|||
|
normal Fpc
|
|||
|
Expect CursorPos() == [l,19,'o']
|
|||
|
|
|||
|
normal Fpb
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
end
|
|||
|
" "}}}
|
|||
|
" t {{{
|
|||
|
it 'provide t mapping like builtin t'
|
|||
|
normal! 0
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
Expect CursorPos() != [l,10,'a']
|
|||
|
|
|||
|
normal tha
|
|||
|
Expect CursorPos() == [l,5,' ']
|
|||
|
|
|||
|
normal! 0
|
|||
|
normal thb
|
|||
|
Expect CursorPos() == [l,10,' ']
|
|||
|
|
|||
|
normal! 0
|
|||
|
normal thc
|
|||
|
Expect CursorPos() == [l,1,'p']
|
|||
|
end
|
|||
|
" }}}
|
|||
|
" T {{{
|
|||
|
it 'provide T mapping like builtin T'
|
|||
|
normal! $
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l,19,'o']
|
|||
|
Expect CursorPos() != [l,18,'a']
|
|||
|
|
|||
|
normal Toa
|
|||
|
Expect CursorPos() == [l,18,'y']
|
|||
|
|
|||
|
normal! $
|
|||
|
normal Tob
|
|||
|
Expect CursorPos() == [l,15,' ']
|
|||
|
|
|||
|
normal Toa
|
|||
|
Expect CursorPos() == [l,3,'g']
|
|||
|
|
|||
|
normal! $
|
|||
|
normal Tod
|
|||
|
Expect CursorPos() == [l,19,'o']
|
|||
|
|
|||
|
normal Toc
|
|||
|
Expect CursorPos() == [l,3,'g']
|
|||
|
end
|
|||
|
"}}}
|
|||
|
" visual
|
|||
|
it 'have different context in normal mode and visual mode'
|
|||
|
let l = line('.')
|
|||
|
Expect CursorPos() == [l, 1, 'p']
|
|||
|
|
|||
|
normal foa
|
|||
|
Expect CursorPos() == [l, 2, 'o']
|
|||
|
|
|||
|
normal vfha
|
|||
|
Expect CursorPos() == [l, 6, 'h']
|
|||
|
|
|||
|
normal fha
|
|||
|
Expect CursorPos() == [l, 11, 'h']
|
|||
|
|
|||
|
normal! d
|
|||
|
Expect getline('.') == "piyo poyo"
|
|||
|
Expect CursorPos() == [l, 2, 'i']
|
|||
|
|
|||
|
normal! dfpa
|
|||
|
Expect getline('.') == "poyo"
|
|||
|
Expect CursorPos() == [l, 2, 'o']
|
|||
|
end
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" a non-existent char {{{
|
|||
|
describe 'a non-existent char'
|
|||
|
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('poge huga hiyo poyo')
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
end
|
|||
|
|
|||
|
" makes no change {{{
|
|||
|
it 'makes no change'
|
|||
|
normal! 0
|
|||
|
let origin = CursorPos()
|
|||
|
|
|||
|
normal fd
|
|||
|
Expect CursorPos() == origin
|
|||
|
normal f1
|
|||
|
Expect CursorPos() == origin
|
|||
|
normal f)
|
|||
|
Expect CursorPos() == origin
|
|||
|
normal f^
|
|||
|
Expect CursorPos() == origin
|
|||
|
normal fm
|
|||
|
Expect CursorPos() == origin
|
|||
|
end
|
|||
|
"}}}
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" when target is in other line, s, f and F mappings {{{
|
|||
|
describe 'when target is in other line, s, f and F mappings'
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('foo bar baz') " L2
|
|||
|
call AddLine('poge huga hiyo poyo') " L1
|
|||
|
" '1234567890123456789'
|
|||
|
normal! gg0
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
end
|
|||
|
|
|||
|
" move cursor forward across lines {{{
|
|||
|
it 'move cursor forward & backward across lines'
|
|||
|
normal! 0
|
|||
|
let l = line('.')
|
|||
|
Expect col('.') == 1
|
|||
|
|
|||
|
normal saa
|
|||
|
Expect CursorPos() == [l, 9, 'a']
|
|||
|
|
|||
|
normal saa
|
|||
|
Expect CursorPos() == [l+1, 6, 'a']
|
|||
|
|
|||
|
normal sob
|
|||
|
Expect CursorPos() == [l+1, 2, 'o']
|
|||
|
|
|||
|
normal! gg0
|
|||
|
let l = line('.')
|
|||
|
Expect col('.') == 1
|
|||
|
|
|||
|
normal faa
|
|||
|
Expect CursorPos() == [l, 9, 'a']
|
|||
|
|
|||
|
normal faa
|
|||
|
Expect CursorPos() == [l+1, 6, 'a']
|
|||
|
|
|||
|
normal faa
|
|||
|
Expect CursorPos() == [l+1, 10, 'a']
|
|||
|
|
|||
|
normal Faa
|
|||
|
Expect CursorPos() == [l+1, 6, 'a']
|
|||
|
|
|||
|
normal Faa
|
|||
|
Expect CursorPos() == [l, 9, 'a']
|
|||
|
end
|
|||
|
" }}}
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" Multibyte characters {{{
|
|||
|
describe 'Multibyte characters'
|
|||
|
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('ビムかわいいよzビムx')
|
|||
|
call AddLine('foo bar baz')
|
|||
|
normal! gg
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
end
|
|||
|
|
|||
|
" is supported "{{{
|
|||
|
it 'is supported'
|
|||
|
normal! gg0
|
|||
|
let l = line('.')
|
|||
|
|
|||
|
normal fza
|
|||
|
Expect CursorPos() == [l, 11, 'z']
|
|||
|
Expect CursorPos() != [l, 1, '2']
|
|||
|
|
|||
|
normal fz
|
|||
|
Expect CursorPos() == [l+1, 22, 'z']
|
|||
|
|
|||
|
normal! h
|
|||
|
normal fxa
|
|||
|
Expect CursorPos() == [l+1, 29, 'x']
|
|||
|
end
|
|||
|
" }}}
|
|||
|
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" EasyMotion#helper#include_multibyte_char {{{
|
|||
|
describe 'EasyMotion#helper#include_multibyte_char'
|
|||
|
|
|||
|
it 'return true when the argument includes multibyte char'
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("あいうえお") to_be_true
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("aiueoあ") to_be_true
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("123ABC45") to_be_true
|
|||
|
end
|
|||
|
|
|||
|
it 'return false when the argument does not include multibyte char'
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("aiueo") to_be_false
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("this_is_a_pen.") to_be_false
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("!#$%&'()'") to_be_false
|
|||
|
Expect EasyMotion#helper#include_multibyte_char("") to_be_false
|
|||
|
end
|
|||
|
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" migemo support {{{
|
|||
|
describe 'migemo support'
|
|||
|
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
let g:EasyMotion_use_migemo = 1
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('はー,ビムかわいいよビム')
|
|||
|
normal! gg0
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
let g:clever_f_use_migemo = 0
|
|||
|
end
|
|||
|
|
|||
|
" makes f and F mapping match multibyte characters {{{
|
|||
|
it 'makes f and F mapping match multibyte characters'
|
|||
|
normal fba
|
|||
|
Expect col('.') == 10
|
|||
|
normal fb
|
|||
|
Expect col('.') == 31
|
|||
|
normal Fb
|
|||
|
Expect col('.') == 10
|
|||
|
normal $
|
|||
|
normal Fba
|
|||
|
Expect col('.') == 31
|
|||
|
normal Fb
|
|||
|
Expect col('.') == 10
|
|||
|
end
|
|||
|
" }}}
|
|||
|
|
|||
|
" makes t and T mapping match multibyte characters {{{
|
|||
|
it 'makes t and T mapping match multibyte characters'
|
|||
|
normal tba
|
|||
|
Expect col('.') == 7
|
|||
|
normal tb
|
|||
|
Expect col('.') == 28
|
|||
|
normal Tb
|
|||
|
Expect col('.') == 13
|
|||
|
normal $
|
|||
|
normal Tba
|
|||
|
Expect col('.') == 13
|
|||
|
normal tb
|
|||
|
Expect col('.') == 28
|
|||
|
end
|
|||
|
" }}}
|
|||
|
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" g:EasyMotion_smartcase {{{
|
|||
|
describe 'g:EasyMotion_smartcase'
|
|||
|
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('poHe huga Hiyo hoyo: poyo();')
|
|||
|
1234567890123456789012345678
|
|||
|
normal! gg0
|
|||
|
let g:EasyMotion_smartcase = 1
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
let g:EasyMotion_smartcase = 0
|
|||
|
end
|
|||
|
|
|||
|
" makes f smart case {{{
|
|||
|
it 'makes f smart case'
|
|||
|
normal fha
|
|||
|
Expect col('.') == 3
|
|||
|
normal fha
|
|||
|
Expect col('.') == 6
|
|||
|
normal fha
|
|||
|
Expect col('.') == 11
|
|||
|
normal fh
|
|||
|
Expect col('.') == 16
|
|||
|
normal Fha
|
|||
|
Expect col('.') == 11
|
|||
|
|
|||
|
normal! 0
|
|||
|
normal fHa
|
|||
|
Expect col('.') == 3
|
|||
|
normal fH
|
|||
|
Expect col('.') == 11
|
|||
|
normal fHa
|
|||
|
Expect col('.') == 11
|
|||
|
normal FH
|
|||
|
Expect col('.') == 3
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" makes t smart case {{{
|
|||
|
it 'makes t smart case'
|
|||
|
normal! $
|
|||
|
normal Tha
|
|||
|
Expect col('.') == 17
|
|||
|
normal Tha
|
|||
|
Expect col('.') == 12
|
|||
|
normal Tha
|
|||
|
Expect col('.') == 7
|
|||
|
normal Th
|
|||
|
Expect col('.') == 4
|
|||
|
normal tha
|
|||
|
Expect col('.') == 5
|
|||
|
|
|||
|
normal! $
|
|||
|
normal THa
|
|||
|
Expect col('.') == 12
|
|||
|
normal TH
|
|||
|
Expect col('.') == 4
|
|||
|
normal tH
|
|||
|
Expect col('.') == 10
|
|||
|
end
|
|||
|
" }}}
|
|||
|
|
|||
|
" makes no effect on searching signs {{{
|
|||
|
it 'makes no effect on searching signs'
|
|||
|
normal! 0
|
|||
|
normal f;
|
|||
|
Expect col('.') == 28
|
|||
|
normal! 0
|
|||
|
normal f:
|
|||
|
Expect col('.') == 20
|
|||
|
normal f:
|
|||
|
Expect col('.') == 20
|
|||
|
end
|
|||
|
" }}}
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" g:EasyMotion_smartsign {{{
|
|||
|
describe 'g:EasyMotion_smartsign'
|
|||
|
|
|||
|
before
|
|||
|
new
|
|||
|
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
|
map s <Plug>(easymotion-s)
|
|||
|
map f <Plug>(easymotion-f)
|
|||
|
map F <Plug>(easymotion-F)
|
|||
|
map t <Plug>(easymotion-t)
|
|||
|
map T <Plug>(easymotion-T)
|
|||
|
call EasyMotion#init()
|
|||
|
call AddLine('poHe huga Hiyo hoyo: poyo();')
|
|||
|
1234567890123456789012345678
|
|||
|
normal! gg0
|
|||
|
let g:EasyMotion_smartcase = 1
|
|||
|
let g:EasyMotion_use_smartsign_us = 1
|
|||
|
end
|
|||
|
|
|||
|
after
|
|||
|
close!
|
|||
|
let g:EasyMotion_smartcase = 0
|
|||
|
let g:EasyMotion_use_smartsign_us = 0
|
|||
|
end
|
|||
|
|
|||
|
" makes f smart sign {{{
|
|||
|
it 'makes f smart case'
|
|||
|
normal! 0
|
|||
|
normal f;
|
|||
|
Expect col('.') == 1
|
|||
|
normal f;a
|
|||
|
Expect col('.') == 20
|
|||
|
normal f;
|
|||
|
Expect col('.') == 28
|
|||
|
|
|||
|
normal! 0
|
|||
|
normal f:
|
|||
|
Expect col('.') == 20
|
|||
|
normal f:
|
|||
|
Expect col('.') == 20
|
|||
|
end
|
|||
|
"}}}
|
|||
|
|
|||
|
" makes no effect on searching signs {{{
|
|||
|
" it 'makes no effect on searching signs'
|
|||
|
" normal! 0
|
|||
|
" normal f;
|
|||
|
" Expect col('.') == 28
|
|||
|
" normal! 0
|
|||
|
" normal f:
|
|||
|
" Expect col('.') == 20
|
|||
|
" normal f:
|
|||
|
" Expect col('.') == 20
|
|||
|
" end
|
|||
|
" }}}
|
|||
|
end
|
|||
|
"}}}
|