"============================================================================= " FILE: t/easymotion_spec.vim " AUTHOR: haya14busa " Last Change: 23 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 mappings for find motion' " Find Motion: {{{ " s Expect maparg('(easymotion-s)', 'n') ==# ':call EasyMotion#S(1,0,2)' Expect maparg('(easymotion-s)', 'o') ==# ':call EasyMotion#S(1,0,2)' Expect maparg('(easymotion-s)', 'v') ==# ':call EasyMotion#S(1,1,2)' " f Expect maparg('(easymotion-f)', 'n') ==# ':call EasyMotion#S(1,0,0)' Expect maparg('(easymotion-f)', 'o') ==# ':call EasyMotion#S(1,0,0)' Expect maparg('(easymotion-f)', 'v') ==# ':call EasyMotion#S(1,1,0)' " F Expect maparg('(easymotion-F)', 'n') ==# ':call EasyMotion#S(1,0,1)' Expect maparg('(easymotion-F)', 'o') ==# ':call EasyMotion#S(1,0,1)' Expect maparg('(easymotion-F)', 'v') ==# ':call EasyMotion#S(1,1,1)' " t Expect maparg('(easymotion-t)', 'n') ==# ':call EasyMotion#T(1,0,0)' Expect maparg('(easymotion-t)', 'o') ==# ':call EasyMotion#T(1,0,0)' Expect maparg('(easymotion-t)', 'v') ==# ':call EasyMotion#T(1,1,0)' " T Expect maparg('(easymotion-T)', 'n') ==# ':call EasyMotion#T(1,0,1)' Expect maparg('(easymotion-T)', 'o') ==# ':call EasyMotion#T(1,0,1)' Expect maparg('(easymotion-T)', 'v') ==# ':call EasyMotion#T(1,1,1)' " bd-t Expect maparg('(easymotion-bd-t)', 'n') ==# ':call EasyMotion#T(1,0,2)' Expect maparg('(easymotion-bd-t)', 'o') ==# ':call EasyMotion#T(1,0,2)' Expect maparg('(easymotion-bd-t)', 'v') ==# ':call EasyMotion#T(1,1,2)' " sl Expect maparg('(easymotion-sl)', 'n') ==# ':call EasyMotion#SL(1,0,2)' Expect maparg('(easymotion-sl)', 'o') ==# ':call EasyMotion#SL(1,0,2)' Expect maparg('(easymotion-sl)', 'v') ==# ':call EasyMotion#SL(1,1,2)' " fl Expect maparg('(easymotion-fl)', 'n') ==# ':call EasyMotion#SL(1,0,0)' Expect maparg('(easymotion-fl)', 'o') ==# ':call EasyMotion#SL(1,0,0)' Expect maparg('(easymotion-fl)', 'v') ==# ':call EasyMotion#SL(1,1,0)' " Fl Expect maparg('(easymotion-Fl)', 'n') ==# ':call EasyMotion#SL(1,0,1)' Expect maparg('(easymotion-Fl)', 'o') ==# ':call EasyMotion#SL(1,0,1)' Expect maparg('(easymotion-Fl)', 'v') ==# ':call EasyMotion#SL(1,1,1)' " tl Expect maparg('(easymotion-tl)', 'n') ==# ':call EasyMotion#TL(1,0,0)' Expect maparg('(easymotion-tl)', 'o') ==# ':call EasyMotion#TL(1,0,0)' Expect maparg('(easymotion-tl)', 'v') ==# ':call EasyMotion#TL(1,1,0)' " Tl Expect maparg('(easymotion-Tl)', 'n') ==# ':call EasyMotion#TL(1,0,1)' Expect maparg('(easymotion-Tl)', 'o') ==# ':call EasyMotion#TL(1,0,1)' Expect maparg('(easymotion-Tl)', 'v') ==# ':call EasyMotion#TL(1,1,1)' " bd-tl Expect maparg('(easymotion-bd-tl)', 'n') ==# ':call EasyMotion#TL(1,0,2)' Expect maparg('(easymotion-bd-tl)', 'o') ==# ':call EasyMotion#TL(1,0,2)' Expect maparg('(easymotion-bd-tl)', 'v') ==# ':call EasyMotion#TL(1,1,2)' "}}} " Two Char Find Motion: {{{ " s2 Expect maparg('(easymotion-s2)', 'n') ==# ':call EasyMotion#S(2,0,2)' Expect maparg('(easymotion-s2)', 'o') ==# ':call EasyMotion#S(2,0,2)' Expect maparg('(easymotion-s2)', 'v') ==# ':call EasyMotion#S(2,1,2)' " f2 Expect maparg('(easymotion-f2)', 'n') ==# ':call EasyMotion#S(2,0,0)' Expect maparg('(easymotion-f2)', 'o') ==# ':call EasyMotion#S(2,0,0)' Expect maparg('(easymotion-f2)', 'v') ==# ':call EasyMotion#S(2,1,0)' " F2 Expect maparg('(easymotion-F2)', 'n') ==# ':call EasyMotion#S(2,0,1)' Expect maparg('(easymotion-F2)', 'o') ==# ':call EasyMotion#S(2,0,1)' Expect maparg('(easymotion-F2)', 'v') ==# ':call EasyMotion#S(2,1,1)' " t2 Expect maparg('(easymotion-t2)', 'n') ==# ':call EasyMotion#T(2,0,0)' Expect maparg('(easymotion-t2)', 'o') ==# ':call EasyMotion#T(2,0,0)' Expect maparg('(easymotion-t2)', 'v') ==# ':call EasyMotion#T(2,1,0)' " T2 Expect maparg('(easymotion-T2)', 'n') ==# ':call EasyMotion#T(2,0,1)' Expect maparg('(easymotion-T2)', 'o') ==# ':call EasyMotion#T(2,0,1)' Expect maparg('(easymotion-T2)', 'v') ==# ':call EasyMotion#T(2,1,1)' " sl2 Expect maparg('(easymotion-sl2)', 'n') ==# ':call EasyMotion#SL(2,0,2)' Expect maparg('(easymotion-sl2)', 'o') ==# ':call EasyMotion#SL(2,0,2)' Expect maparg('(easymotion-sl2)', 'v') ==# ':call EasyMotion#SL(2,1,2)' " bd-t2 Expect maparg('(easymotion-bd-t2)', 'n') ==# ':call EasyMotion#T(2,0,2)' Expect maparg('(easymotion-bd-t2)', 'o') ==# ':call EasyMotion#T(2,0,2)' Expect maparg('(easymotion-bd-t2)', 'v') ==# ':call EasyMotion#T(2,1,2)' " fl2 Expect maparg('(easymotion-fl2)', 'n') ==# ':call EasyMotion#SL(2,0,0)' Expect maparg('(easymotion-fl2)', 'o') ==# ':call EasyMotion#SL(2,0,0)' Expect maparg('(easymotion-fl2)', 'v') ==# ':call EasyMotion#SL(2,1,0)' " Fl2 Expect maparg('(easymotion-Fl2)', 'n') ==# ':call EasyMotion#SL(2,0,1)' Expect maparg('(easymotion-Fl2)', 'o') ==# ':call EasyMotion#SL(2,0,1)' Expect maparg('(easymotion-Fl2)', 'v') ==# ':call EasyMotion#SL(2,1,1)' " tl2 Expect maparg('(easymotion-tl2)', 'n') ==# ':call EasyMotion#TL(2,0,0)' Expect maparg('(easymotion-tl2)', 'o') ==# ':call EasyMotion#TL(2,0,0)' Expect maparg('(easymotion-tl2)', 'v') ==# ':call EasyMotion#TL(2,1,0)' " Tl2 Expect maparg('(easymotion-Tl2)', 'n') ==# ':call EasyMotion#TL(2,0,1)' Expect maparg('(easymotion-Tl2)', 'o') ==# ':call EasyMotion#TL(2,0,1)' Expect maparg('(easymotion-Tl2)', 'v') ==# ':call EasyMotion#TL(2,1,1)' " bd-tl2 Expect maparg('(easymotion-bd-tl2)', 'n') ==# ':call EasyMotion#TL(2,0,2)' Expect maparg('(easymotion-bd-tl2)', 'o') ==# ':call EasyMotion#TL(2,0,2)' Expect maparg('(easymotion-bd-tl2)', 'v') ==# ':call EasyMotion#TL(2,1,2)' "}}} " Multi Char Find Motion: {{{ " sn Expect maparg('(easymotion-sn)', 'n') ==# ':call EasyMotion#S(-1,0,2)' Expect maparg('(easymotion-sn)', 'o') ==# ':call EasyMotion#S(-1,0,2)' Expect maparg('(easymotion-sn)', 'v') ==# ':call EasyMotion#S(-1,1,2)' " fn Expect maparg('(easymotion-fn)', 'n') ==# ':call EasyMotion#S(-1,0,0)' Expect maparg('(easymotion-fn)', 'o') ==# ':call EasyMotion#S(-1,0,0)' Expect maparg('(easymotion-fn)', 'v') ==# ':call EasyMotion#S(-1,1,0)' " Fn Expect maparg('(easymotion-Fn)', 'n') ==# ':call EasyMotion#S(-1,0,1)' Expect maparg('(easymotion-Fn)', 'o') ==# ':call EasyMotion#S(-1,0,1)' Expect maparg('(easymotion-Fn)', 'v') ==# ':call EasyMotion#S(-1,1,1)' " tn Expect maparg('(easymotion-tn)', 'n') ==# ':call EasyMotion#T(-1,0,0)' Expect maparg('(easymotion-tn)', 'o') ==# ':call EasyMotion#T(-1,0,0)' Expect maparg('(easymotion-tn)', 'v') ==# ':call EasyMotion#T(-1,1,0)' " Tn Expect maparg('(easymotion-Tn)', 'n') ==# ':call EasyMotion#T(-1,0,1)' Expect maparg('(easymotion-Tn)', 'o') ==# ':call EasyMotion#T(-1,0,1)' Expect maparg('(easymotion-Tn)', 'v') ==# ':call EasyMotion#T(-1,1,1)' " bd-tn Expect maparg('(easymotion-bd-tn)', 'n') ==# ':call EasyMotion#T(-1,0,2)' Expect maparg('(easymotion-bd-tn)', 'o') ==# ':call EasyMotion#T(-1,0,2)' Expect maparg('(easymotion-bd-tn)', 'v') ==# ':call EasyMotion#T(-1,1,2)' " sln Expect maparg('(easymotion-sln)', 'n') ==# ':call EasyMotion#SL(-1,0,2)' Expect maparg('(easymotion-sln)', 'o') ==# ':call EasyMotion#SL(-1,0,2)' Expect maparg('(easymotion-sln)', 'v') ==# ':call EasyMotion#SL(-1,1,2)' " fln Expect maparg('(easymotion-fln)', 'n') ==# ':call EasyMotion#SL(-1,0,0)' Expect maparg('(easymotion-fln)', 'o') ==# ':call EasyMotion#SL(-1,0,0)' Expect maparg('(easymotion-fln)', 'v') ==# ':call EasyMotion#SL(-1,1,0)' " Fln Expect maparg('(easymotion-Fln)', 'n') ==# ':call EasyMotion#SL(-1,0,1)' Expect maparg('(easymotion-Fln)', 'o') ==# ':call EasyMotion#SL(-1,0,1)' Expect maparg('(easymotion-Fln)', 'v') ==# ':call EasyMotion#SL(-1,1,1)' " tln Expect maparg('(easymotion-tln)', 'n') ==# ':call EasyMotion#TL(-1,0,0)' Expect maparg('(easymotion-tln)', 'o') ==# ':call EasyMotion#TL(-1,0,0)' Expect maparg('(easymotion-tln)', 'v') ==# ':call EasyMotion#TL(-1,1,0)' " Tln Expect maparg('(easymotion-Tln)', 'n') ==# ':call EasyMotion#TL(-1,0,1)' Expect maparg('(easymotion-Tln)', 'o') ==# ':call EasyMotion#TL(-1,0,1)' Expect maparg('(easymotion-Tln)', 'v') ==# ':call EasyMotion#TL(-1,1,1)' " bd-tln Expect maparg('(easymotion-bd-tln)', 'n') ==# ':call EasyMotion#TL(-1,0,2)' Expect maparg('(easymotion-bd-tln)', 'o') ==# ':call EasyMotion#TL(-1,0,2)' Expect maparg('(easymotion-bd-tln)', 'v') ==# ':call EasyMotion#TL(-1,1,2)' "}}} end it 'provide default mappings for regrex motion' "(is_visual, direction) " direction: " - 0: forward " - 1: backward " - 2: bi-direction " Word Motion: {{{ Expect maparg('(easymotion-w)', 'n') ==# ':call EasyMotion#WB(0,0)' Expect maparg('(easymotion-w)', 'o') ==# ':call EasyMotion#WB(0,0)' Expect maparg('(easymotion-w)', 'v') ==# ':call EasyMotion#WB(1,0)' Expect maparg('(easymotion-b)', 'n') ==# ':call EasyMotion#WB(0,1)' Expect maparg('(easymotion-b)', 'o') ==# ':call EasyMotion#WB(0,1)' Expect maparg('(easymotion-b)', 'v') ==# ':call EasyMotion#WB(1,1)' Expect maparg('(easymotion-bd-w)', 'n') ==# ':call EasyMotion#WB(0,2)' Expect maparg('(easymotion-bd-w)', 'o') ==# ':call EasyMotion#WB(0,2)' Expect maparg('(easymotion-bd-w)', 'v') ==# ':call EasyMotion#WB(1,2)' Expect maparg('(easymotion-S)', 'n') ==# ':call EasyMotion#WB(0,2)' Expect maparg('(easymotion-S)', 'o') ==# ':call EasyMotion#WB(0,2)' Expect maparg('(easymotion-S)', 'v') ==# ':call EasyMotion#WB(1,2)' " }}} " WORD Motion: {{{ Expect maparg('(easymotion-W)', 'n') ==# ':call EasyMotion#WBW(0,0)' Expect maparg('(easymotion-W)', 'o') ==# ':call EasyMotion#WBW(0,0)' Expect maparg('(easymotion-W)', 'v') ==# ':call EasyMotion#WBW(1,0)' Expect maparg('(easymotion-B)', 'n') ==# ':call EasyMotion#WBW(0,1)' Expect maparg('(easymotion-B)', 'o') ==# ':call EasyMotion#WBW(0,1)' Expect maparg('(easymotion-B)', 'v') ==# ':call EasyMotion#WBW(1,1)' Expect maparg('(easymotion-bd-W)', 'n') ==# ':call EasyMotion#WBW(0,2)' Expect maparg('(easymotion-bd-W)', 'o') ==# ':call EasyMotion#WBW(0,2)' Expect maparg('(easymotion-bd-W)', 'v') ==# ':call EasyMotion#WBW(1,2)' " }}} " End Of Word Motion: {{{ Expect maparg('(easymotion-e)', 'n') ==# ':call EasyMotion#E(0,0)' Expect maparg('(easymotion-e)', 'o') ==# ':call EasyMotion#E(0,0)' Expect maparg('(easymotion-e)', 'v') ==# ':call EasyMotion#E(1,0)' Expect maparg('(easymotion-ge)', 'n') ==# ':call EasyMotion#E(0,1)' Expect maparg('(easymotion-ge)', 'o') ==# ':call EasyMotion#E(0,1)' Expect maparg('(easymotion-ge)', 'v') ==# ':call EasyMotion#E(1,1)' Expect maparg('(easymotion-bd-e)', 'n') ==# ':call EasyMotion#E(0,2)' Expect maparg('(easymotion-bd-e)', 'o') ==# ':call EasyMotion#E(0,2)' Expect maparg('(easymotion-bd-e)', 'v') ==# ':call EasyMotion#E(1,2)' " }}} " END OF WORD Motion: {{{ Expect maparg('(easymotion-E)', 'n') ==# ':call EasyMotion#EW(0,0)' Expect maparg('(easymotion-E)', 'o') ==# ':call EasyMotion#EW(0,0)' Expect maparg('(easymotion-E)', 'v') ==# ':call EasyMotion#EW(1,0)' Expect maparg('(easymotion-gE)', 'n') ==# ':call EasyMotion#EW(0,1)' Expect maparg('(easymotion-gE)', 'o') ==# ':call EasyMotion#EW(0,1)' Expect maparg('(easymotion-gE)', 'v') ==# ':call EasyMotion#EW(1,1)' Expect maparg('(easymotion-bd-E)', 'n') ==# ':call EasyMotion#EW(0,2)' Expect maparg('(easymotion-bd-E)', 'o') ==# ':call EasyMotion#EW(0,2)' Expect maparg('(easymotion-bd-E)', 'v') ==# ':call EasyMotion#EW(1,2)' " }}} " JK Motion: {{{ " default Expect maparg('(easymotion-j)', 'n') ==# ':call EasyMotion#JK(0,0)' Expect maparg('(easymotion-j)', 'o') ==# ':call EasyMotion#JK(0,0)' Expect maparg('(easymotion-j)', 'v') ==# ':call EasyMotion#JK(1,0)' Expect maparg('(easymotion-k)', 'n') ==# ':call EasyMotion#JK(0,1)' Expect maparg('(easymotion-k)', 'o') ==# ':call EasyMotion#JK(0,1)' Expect maparg('(easymotion-k)', 'v') ==# ':call EasyMotion#JK(1,1)' Expect maparg('(easymotion-bd-jk)', 'n') ==# ':call EasyMotion#JK(0,2)' Expect maparg('(easymotion-bd-jk)', 'o') ==# ':call EasyMotion#JK(0,2)' Expect maparg('(easymotion-bd-jk)', 'v') ==# ':call EasyMotion#JK(1,2)' " start of line Expect maparg('(easymotion-sol-j)', 'n') ==# ':call EasyMotion#Sol(0,0)' Expect maparg('(easymotion-sol-j)', 'o') ==# ':call EasyMotion#Sol(0,0)' Expect maparg('(easymotion-sol-j)', 'v') ==# ':call EasyMotion#Sol(1,0)' Expect maparg('(easymotion-sol-k)', 'n') ==# ':call EasyMotion#Sol(0,1)' Expect maparg('(easymotion-sol-k)', 'o') ==# ':call EasyMotion#Sol(0,1)' Expect maparg('(easymotion-sol-k)', 'v') ==# ':call EasyMotion#Sol(1,1)' Expect maparg('(easymotion-sol-bd-jk)', 'n') ==# ':call EasyMotion#Sol(0,2)' Expect maparg('(easymotion-sol-bd-jk)', 'o') ==# ':call EasyMotion#Sol(0,2)' Expect maparg('(easymotion-sol-bd-jk)', 'v') ==# ':call EasyMotion#Sol(1,2)' " end of line Expect maparg('(easymotion-eol-j)', 'n') ==# ':call EasyMotion#Eol(0,0)' Expect maparg('(easymotion-eol-j)', 'o') ==# ':call EasyMotion#Eol(0,0)' Expect maparg('(easymotion-eol-j)', 'v') ==# ':call EasyMotion#Eol(1,0)' Expect maparg('(easymotion-eol-k)', 'n') ==# ':call EasyMotion#Eol(0,1)' Expect maparg('(easymotion-eol-k)', 'o') ==# ':call EasyMotion#Eol(0,1)' Expect maparg('(easymotion-eol-k)', 'v') ==# ':call EasyMotion#Eol(1,1)' Expect maparg('(easymotion-eol-bd-jk)', 'n') ==# ':call EasyMotion#Eol(0,2)' Expect maparg('(easymotion-eol-bd-jk)', 'o') ==# ':call EasyMotion#Eol(0,2)' Expect maparg('(easymotion-eol-bd-jk)', 'v') ==# ':call EasyMotion#Eol(1,2)' " }}} " Search Motion: {{{ Expect maparg('(easymotion-n)', 'n') ==# ':call EasyMotion#Search(0,0)' Expect maparg('(easymotion-n)', 'o') ==# ':call EasyMotion#Search(0,0)' Expect maparg('(easymotion-n)', 'v') ==# ':call EasyMotion#Search(1,0)' Expect maparg('(easymotion-N)', 'n') ==# ':call EasyMotion#Search(0,1)' Expect maparg('(easymotion-N)', 'o') ==# ':call EasyMotion#Search(0,1)' Expect maparg('(easymotion-N)', 'v') ==# ':call EasyMotion#Search(1,1)' Expect maparg('(easymotion-bd-n)', 'n') ==# ':call EasyMotion#Search(0,2)' Expect maparg('(easymotion-bd-n)', 'o') ==# ':call EasyMotion#Search(0,2)' Expect maparg('(easymotion-bd-n)', 'v') ==# ':call EasyMotion#Search(1,2)' " }}} " JumpToAnywhere Motion: {{{ Expect maparg('(easymotion-jumptoanywhere)', 'n') \ ==# ':call EasyMotion#JumpToAnywhere(0,2)' Expect maparg('(easymotion-jumptoanywhere)', 'o') \ ==# ':call EasyMotion#JumpToAnywhere(0,2)' Expect maparg('(easymotion-jumptoanywhere)', 'v') \ ==# ':call EasyMotion#JumpToAnywhere(1,2)' " }}} " Repeat Motion: {{{ " (is_visual) Expect maparg('(easymotion-repeat)', 'n') \ ==# ':call EasyMotion#Repeat(0)' Expect maparg('(easymotion-repeat)', 'o') \ ==# ':call EasyMotion#Repeat(0)' Expect maparg('(easymotion-repeat)', 'v') \ ==# ':call EasyMotion#Repeat(1)' Expect maparg('(easymotion-dotrepeat)', 'n') \ ==# ':call EasyMotion#DotRepeat(0)' Expect maparg('(easymotion-dotrepeat)', 'o') \ ==# ':call EasyMotion#DotRepeat(0)' Expect maparg('(easymotion-dotrepeat)', 'v') \ ==# ':call EasyMotion#DotRepeat(1)' " }}} " Next, Previous motion {{{ Expect maparg('(easymotion-next)', 'n') \ ==# ':call EasyMotion#NextPrevious(0,0)' Expect maparg('(easymotion-next)', 'o') \ ==# ':call EasyMotion#NextPrevious(0,0)' Expect maparg('(easymotion-next)', 'v') \ ==# ':call EasyMotion#NextPrevious(1,0)' Expect maparg('(easymotion-prev)', 'n') \ ==# ':call EasyMotion#NextPrevious(0,1)' Expect maparg('(easymotion-prev)', 'o') \ ==# ':call EasyMotion#NextPrevious(0,1)' Expect maparg('(easymotion-prev)', 'v') \ ==# ':call EasyMotion#NextPrevious(1,1)' " }}} " Line Motion: {{{ " word Expect maparg('(easymotion-wl)', 'n') ==# ':call EasyMotion#WBL(0,0)' Expect maparg('(easymotion-wl)', 'o') ==# ':call EasyMotion#WBL(0,0)' Expect maparg('(easymotion-wl)', 'v') ==# ':call EasyMotion#WBL(1,0)' Expect maparg('(easymotion-bl)', 'n') ==# ':call EasyMotion#WBL(0,1)' Expect maparg('(easymotion-bl)', 'o') ==# ':call EasyMotion#WBL(0,1)' Expect maparg('(easymotion-bl)', 'v') ==# ':call EasyMotion#WBL(1,1)' Expect maparg('(easymotion-bd-wl)', 'n') ==# ':call EasyMotion#WBL(0,2)' Expect maparg('(easymotion-bd-wl)', 'o') ==# ':call EasyMotion#WBL(0,2)' Expect maparg('(easymotion-bd-wl)', 'v') ==# ':call EasyMotion#WBL(1,2)' " end of word Expect maparg('(easymotion-el)', 'n') ==# ':call EasyMotion#EL(0,0)' Expect maparg('(easymotion-el)', 'o') ==# ':call EasyMotion#EL(0,0)' Expect maparg('(easymotion-el)', 'v') ==# ':call EasyMotion#EL(1,0)' Expect maparg('(easymotion-gel)', 'n') ==# ':call EasyMotion#EL(0,1)' Expect maparg('(easymotion-gel)', 'o') ==# ':call EasyMotion#EL(0,1)' Expect maparg('(easymotion-gel)', 'v') ==# ':call EasyMotion#EL(1,1)' Expect maparg('(easymotion-bd-el)', 'n') ==# ':call EasyMotion#EL(0,2)' Expect maparg('(easymotion-bd-el)', 'o') ==# ':call EasyMotion#EL(0,2)' Expect maparg('(easymotion-bd-el)', 'v') ==# ':call EasyMotion#EL(1,2)' " LineAnywhere Expect maparg('(easymotion-lineforward)', 'n') \ ==# ':call EasyMotion#LineAnywhere(0,0)' Expect maparg('(easymotion-lineforward)', 'o') \ ==# ':call EasyMotion#LineAnywhere(0,0)' Expect maparg('(easymotion-lineforward)', 'v') \ ==# ':call EasyMotion#LineAnywhere(1,0)' Expect maparg('(easymotion-linebackward)', 'n') \ ==# ':call EasyMotion#LineAnywhere(0,1)' Expect maparg('(easymotion-linebackward)', 'o') \ ==# ':call EasyMotion#LineAnywhere(0,1)' Expect maparg('(easymotion-linebackward)', 'v') \ ==# ':call EasyMotion#LineAnywhere(1,1)' Expect maparg('(easymotion-lineanywhere)', 'n') \ ==# ':call EasyMotion#LineAnywhere(0,2)' Expect maparg('(easymotion-lineanywhere)', 'o') \ ==# ':call EasyMotion#LineAnywhere(0,2)' Expect maparg('(easymotion-lineanywhere)', 'v') \ ==# ':call EasyMotion#LineAnywhere(1,2)' " }}} " Special Motion: {{{ " SelectLines Expect maparg('(easymotion-special-l)', 'o') \ ==# ':call EasyMotion#SelectLines()' Expect maparg('(easymotion-special-l)', 'v') \ ==# ':call EasyMotion#SelectLines()' Expect maparg('(easymotion-special-ly)', 'n') \ ==# ':call EasyMotion#SelectLinesYank()' Expect maparg('(easymotion-special-ld)', 'n') \ ==# ':call EasyMotion#SelectLinesDelete()' " SelectPhrase Expect maparg('(easymotion-special-p)', 'o') \ ==# ':call EasyMotion#SelectPhrase()' Expect maparg('(easymotion-special-p)', 'v') \ ==# ':call EasyMotion#SelectPhrase()' Expect maparg('(easymotion-special-py)', 'n') \ ==# ':call EasyMotion#SelectPhraseYank()' Expect maparg('(easymotion-special-pd)', 'n') \ ==# ':call EasyMotion#SelectPhraseDelete()' " }}} " Activate {{{ Expect maparg('(easymotion-activate)', 'n') \ ==# ':call EasyMotion#activate(0)' Expect maparg('(easymotion-activate)', 'o') \ ==# ':call EasyMotion#activate(0)' Expect maparg('(easymotion-activate)', 'v') \ ==# ':call EasyMotion#activate(1)' " }}} 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#NextPrevious') ==# 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_inc_highlight ==# 1 Expect g:EasyMotion_move_highlight ==# 1 Expect g:EasyMotion_landing_highlight ==# 0 Expect g:EasyMotion_cursor_highlight ==# 0 Expect g:EasyMotion_prompt ==# 'Search for {n} character(s): ' 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 (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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 (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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 (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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 (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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("あいうえお") ==# 1 Expect EasyMotion#helper#include_multibyte_char("aiueoあ") ==# 1 Expect EasyMotion#helper#include_multibyte_char("123ABC45") ==# 1 end it 'return false when the argument does not include multibyte char' Expect EasyMotion#helper#include_multibyte_char("aiueo") ==# 0 Expect EasyMotion#helper#include_multibyte_char("this_is_a_pen.") ==# 0 Expect EasyMotion#helper#include_multibyte_char("!#$%&'()'") ==# 0 Expect EasyMotion#helper#include_multibyte_char("") ==# 0 end end "}}} " migemo support {{{ describe 'migemo support' before new let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' let g:EasyMotion_use_migemo = 1 map s (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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 (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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 (easymotion-s) map f (easymotion-f) map F (easymotion-F) map t (easymotion-t) map T (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 t,T smart sign {{{ it 'makes t,T smart case' normal! 0 normal t; Expect col('.') == 1 normal t;a Expect col('.') == 19 normal t; Expect col('.') == 27 normal! $ Expect col('.') == 28 normal T; Expect col('.') == 21 end "}}} end "}}} " Next & Previous {{{ describe '(easymotion-next) & (easymotion-prev)' before new let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' map s (easymotion-s) map ; (easymotion-next) map , (easymotion-prev) set wrapscan call EasyMotion#init() call AddLine('poge huga hiyo poyo') " 1234567890123456789 end after close! end " provide next & previous motion to replace `;`, `,` {{{ it 'provide next & previous motion to replace `;`, `,`' normal! 0 let l = line('.') Expect CursorPos() == [l,1,'p'] normal sha Expect CursorPos() == [l,6,'h'] normal ; Expect CursorPos() == [l,11,'h'] normal , Expect CursorPos() == [l,6,'h'] " wrapscan normal , Expect CursorPos() == [l,11,'h'] normal ; Expect CursorPos() == [l,6,'h'] normal! $ let l = line('.') Expect CursorPos() == [l,19,'o'] normal , Expect CursorPos() == [l,11,'h'] end "}}} " next & previous motion count {{{ it 'next & previous motion count' normal! 0 let l = line('.') Expect CursorPos() == [l,1,'p'] normal sha Expect CursorPos() == [l,6,'h'] normal ; Expect CursorPos() == [l,11,'h'] normal 2, Expect CursorPos() == [l,11,'h'] " wrapscan normal 4, Expect CursorPos() == [l,11,'h'] normal 3; Expect CursorPos() == [l,6,'h'] normal! $ let l = line('.') Expect CursorPos() == [l,19,'o'] normal , Expect CursorPos() == [l,11,'h'] end "}}} end "}}} " Jumplist {{{ describe 'EasyMotion is jump motion' before new let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' map s (easymotion-s) call EasyMotion#init() call AddLine('poge huga hiyo poyo') " 1234567890123456789 end after close! end " could jump back to previous location {{{ it ' could jump back to previous location' normal! 0 let l = line('.') Expect CursorPos() == [l,1,'p'] normal sha Expect CursorPos() == [l,6,'h'] exec "normal! \" Expect CursorPos() == [l,1,'p'] normal! `` Expect CursorPos() == [l,6,'h'] normal! `` Expect CursorPos() == [l,1,'p'] normal! `` Expect CursorPos() == [l,6,'h'] normal! $ Expect CursorPos() == [l,19,'o'] normal spa Expect CursorPos() == [l,16,'p'] exec "normal! \" Expect CursorPos() == [l,19,'o'] end "}}} end "}}} " Regexp {{{ describe 'EasyMotion regexp' before new let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' let g:EasyMotion_use_regexp = 1 map s (easymotion-sn) call EasyMotion#init() call AddLine('poge1 2huga 3hiyo 4poyo') " 12345678901234567890123 end after let g:EasyMotion_use_regexp = 0 close! end " could jump back to previous location {{{ it 'provide regexp motion' normal! 0 let l = line('.') Expect CursorPos() == [l,1,'p'] exe "normal s\\d\a" Expect CursorPos() == [l,5,'1'] normal! 0 Expect CursorPos() == [l,1,'p'] exe "normal s\\d\c" Expect CursorPos() == [l,13,'3'] exe "normal s\$\a" Expect CursorPos() == [l,23,'o'] exe "normal s\^\b" Expect CursorPos() == [l,1,'p'] end "}}} end "}}} " bi-directional t motion {{{ describe 'bi-directional t motion' before new let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' let g:EasyMotion_use_regexp = 1 map t (easymotion-bd-t) call EasyMotion#init() call AddLine('poge1 2huga 3hiyo 4poyo') " 12345678901234567890123 end after let g:EasyMotion_use_regexp = 0 close! end " provide bidirectional motion with one key mapping {{{ it 'provide bidirectional motion with one key mapping' normal! 0 let l = line('.') Expect CursorPos() == [l,1,'p'] normal thb Expect CursorPos() == [l,13,'3'] normal! h Expect CursorPos() == [l,12,' '] normal thb Expect CursorPos() == [l,9,'u'] end "}}} end "}}} " vim: fdm=marker:et:ts=4:sw=4:sts=4