Merge branch 'feature/dotrepeat' into master

This commit is contained in:
haya14busa 2014-01-16 20:53:19 +09:00
commit bde8c9334c
8 changed files with 1162 additions and 41 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
doc/tags
ignore/
tmp*
*.lock
.vim-flavor

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: ruby
rvm:
- 2.0.0
script:
- rake ci
install:
- git clone https://github.com/kana/vim-vspec.git
- git clone https://github.com/tpope/vim-repeat.git

3
Gemfile Normal file
View File

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'vim-flavor', '~> 1.1'

11
Rakefile Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env rake
task :ci => [:dump, :test]
task :dump do
sh 'vim --version'
end
task :test do
sh 'bundle exec vim-flavor test'
end

View File

@ -13,6 +13,12 @@ set cpo&vim
function! EasyMotion#init()
" Init Migemo Dictionary
let s:previous = {}
let s:current = {
\ 'is_operator' : 0,
\ 'dot_repeat_target_cnt' : 0,
\ 'dot_prompt_user_cnt' : 0,
\ }
" dot_ prefix key is especially for dot repeat varibale
call EasyMotion#reset()
let s:migemo_dicts = {}
" Anywhere regular expression: {{{
@ -48,18 +54,22 @@ function! EasyMotion#reset()
\ 'within_line' : 0,
\ 'dot_repeat' : 0,
\ }
" Reset count for dot repeat target chars
let s:current.dot_repeat_target_cnt = 0
let s:current.dot_prompt_user_cnt = 0
return ""
endfunction "}}}
" == Motion functions {{{
" -- Find Motion -------------------------
function! EasyMotion#S(num_strokes, visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
let s:previous['input'] = get(s:previous, 'input', '')
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:previous.input)
let s:previous['input'] = input
let mode = mode(1)
let is_exclusive = mode ==# 'no' ? 1 : 0
" Check that we have an input char
if empty(input)
" Restore selection
@ -76,13 +86,13 @@ function! EasyMotion#S(num_strokes, visualmode, direction) " {{{
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
function! EasyMotion#T(num_strokes, visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
let s:previous['input'] = get(s:previous, 'input', '')
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:previous.input)
let s:previous['input'] = input
let mode = mode(1)
let is_exclusive = mode ==# 'no' ? 1 : 0
" Check that we have an input char
if empty(input)
" Restore selection
@ -108,21 +118,26 @@ function! EasyMotion#T(num_strokes, visualmode, direction) " {{{
endfunction " }}}
" -- Word Motion -------------------------
function! EasyMotion#WB(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion('\(\<.\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0)
endfunction " }}}
function! EasyMotion#WBW(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion('\(\(^\|\s\)\@<=\S\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0)
endfunction " }}}
function! EasyMotion#E(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
call s:EasyMotion('\(.\>\|^$\)', a:direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
function! EasyMotion#EW(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
call s:EasyMotion('\(\S\(\s\|$\)\|^$\)', a:direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
" -- JK Motion ---------------------------
function! EasyMotion#JK(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
"FIXME: support exclusive
if g:EasyMotion_startofline
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', 0)
@ -132,28 +147,32 @@ function! EasyMotion#JK(visualmode, direction) " {{{
endif
endfunction " }}}
function! EasyMotion#Sol(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', '')
endfunction " }}}
function! EasyMotion#Eol(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion('\(\w\|\s*\zs\|.\|^\)$', a:direction, a:visualmode ? visualmode() : '', '')
endfunction " }}}
" -- Search Motion -----------------------
function! EasyMotion#Search(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion(@/, a:direction, a:visualmode ? visualmode() : '', 0)
endfunction " }}}
" -- JumpToAnywhere Motion ---------------
function! EasyMotion#JumpToAnywhere(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion( g:EasyMotion_re_anywhere, a:direction, a:visualmode ? visualmode() : '', 0)
endfunction " }}}
" -- Line Motion -------------------------
function! EasyMotion#SL(num_strokes, visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
let s:previous['input'] = get(s:previous, 'input', '')
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:previous.input)
let s:previous['input'] = input
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
" Check that we have an input char
if empty(input)
" Restore selection
@ -172,12 +191,13 @@ function! EasyMotion#SL(num_strokes, visualmode, direction) " {{{
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
function! EasyMotion#TL(num_strokes, visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
let s:previous['input'] = get(s:previous, 'input', '')
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:previous.input)
let s:previous['input'] = input
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
" Check that we have an input char
if empty(input)
" Restore selection
@ -204,16 +224,20 @@ function! EasyMotion#TL(num_strokes, visualmode, direction) " {{{
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
function! EasyMotion#WBL(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
let s:flag.within_line = 1
call s:EasyMotion('\(\<.\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0)
endfunction " }}}
function! EasyMotion#EL(visualmode, direction) " {{{
let s:flag.within_line = 1
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
call s:EasyMotion('\(.\>\|^$\)', a:direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
function! EasyMotion#LineAnywhere(visualmode, direction) " {{{
let s:flag.within_line = 1
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let re = g:EasyMotion_re_line_anywhere
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', 0)
endfunction " }}}
@ -356,6 +380,7 @@ function! EasyMotion#SelectPhraseDelete() "{{{
endfunction "}}}
" -- User Motion -------------------------
function! EasyMotion#User(pattern, mode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let visualmode = match('\v([Vv])|(C-v)', a:mode) > 0 ? visualmode() : ''
let re = escape(a:pattern, '|')
call s:EasyMotion(re, a:direction, visualmode, 0)
@ -370,11 +395,28 @@ function! EasyMotion#Repeat(visualmode) " {{{
let re = s:previous.regexp
let direction = s:previous.direction
let s:flag.within_line = s:previous.line_flag
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_exclusive = mode(1) ==# 'no' ? 1 : 0
call s:EasyMotion(re, direction, a:visualmode ? visualmode() : '', is_exclusive)
endfunction " }}}
function! EasyMotion#DotRepeat(visualmode) " {{{
" Repeat previous motion with previous targets
if s:previous ==# {}
call s:Message("Previous motion doesn't exist")
return
endif
let re = s:previous.regexp
let direction = s:previous.direction
let is_exclusive = s:previous.is_exclusive
let s:current.is_operator = 1
let s:flag.within_line = s:previous.line_flag
for cnt in range(v:count1)
let s:flag.dot_repeat = 1
silent call s:EasyMotion(re, direction, 0, is_exclusive)
endfor
endfunction " }}}
" }}}
" == Helper functions {{{
" -- Message -----------------------------
@ -966,20 +1008,37 @@ function! s:PromptUser(groups, allows_repeat, fixed_column) "{{{
endif
"}}}
try
" Set lines with markers
" Set lines with markers {{{
call s:SetLines(lines_items, 'marker')
redraw
redraw "}}}
" Get target character {{{
call s:Prompt('Target key')
let char = s:GetChar()
"}}}
" Convert uppercase {{{
if g:EasyMotion_use_upper == 1 && match(g:EasyMotion_keys, '\l') == -1
let char = toupper(char)
endif
endif "}}}
" Jump first target when Enter key is pressed "{{{
if char ==# ' ' && g:EasyMotion_enter_jump_first == 1
let char = g:EasyMotion_keys[0]
endif
" }}}
endif "}}}
" For dot repeat {{{
if mode(1) ==# 'no'
" Store previous target when operator pending mode
if s:current.dot_prompt_user_cnt == 0
" Store
let s:previous['target'] = char
else
" Append target chars
let s:previous['target'] .= char
endif
endif "}}}
finally
" Restore original lines
call s:SetLines(lines_items, 'orig')
@ -1034,6 +1093,23 @@ function! s:PromptUser(groups, allows_repeat, fixed_column) "{{{
let target = a:groups[char]
if type(target) == 3
" Return target coordinates
return target
else
" Prompt for new target character
let s:current.dot_prompt_user_cnt += 1
return s:PromptUser(target, a:allows_repeat, a:fixed_column)
endif
endfunction "}}}
function! s:DotPromptUser(groups) "{{{
" Get char from previous target
let char = s:previous.target[s:current.dot_repeat_target_cnt]
" For dot repeat target chars
let s:current.dot_repeat_target_cnt += 1
let target = a:groups[char]
if type(target) == 3
" Return target coordinates
return target
@ -1063,17 +1139,20 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
let targets = []
" Store Regular Expression
let s:previous['regexp'] = a:regexp
let s:previous['direction'] = a:direction
let s:previous['line_flag'] = s:flag.within_line == 1 ? 1 : 0
if s:flag.dot_repeat != 1
" Store Regular Expression
let s:previous['regexp'] = a:regexp
let s:previous['direction'] = a:direction
let s:previous['line_flag'] = s:flag.within_line == 1 ? 1 : 0
let s:previous['is_exclusive'] = a:is_exclusive
let s:previous['operator'] = v:operator
endif
try
" -- Reset properties -------------------- {{{
" Save original value and set new value
call s:SaveValue()
" }}}
" -- Find motion targets ----------------- {{{
" Setup searchpos args {{{
let search_direction = (a:direction >= 1 ? 'b' : '')
let search_stopline = a:direction >= 1 ? win_first_line : win_last_line
@ -1196,7 +1275,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
let groups = GroupingFn(targets, split(g:EasyMotion_keys, '\zs'))
" -- Shade inactive source --------------- {{{
if g:EasyMotion_do_shade && targets_len != 1
if g:EasyMotion_do_shade && targets_len != 1 && s:flag.dot_repeat != 1
if !empty(a:visualmode)
let shade_hl_pos = '\%' . c_pos[0] . 'l\%'. c_pos[1] .'c'
else
@ -1228,7 +1307,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
" -- Jump back before prompt for visual scroll {{{
" Because searchpos() change current cursor position and
" if you just use cursor([orig_num, orig_pos]) to jump back,
" current line will bebecome center of window
" current line will become center of window
if ! empty(a:visualmode)
keepjumps call cursor(win_first_line,0)
normal! zt
@ -1236,8 +1315,12 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
"}}}
" -- Prompt user for target group/character {{{
let coords = s:PromptUser(groups, allows_repeat, fixed_column)
let s:previous_target_coord = coords
if s:flag.dot_repeat != 1
let coords = s:PromptUser(groups, allows_repeat, fixed_column)
let s:previous_target_coord = coords
else
let coords = s:DotPromptUser(groups)
endif
"}}}
" -- Update selection -------------------- {{{
@ -1249,24 +1332,55 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
" }}}
" -- Update cursor position -------------- {{{
call cursor(orig_pos[0], orig_pos[1])
" Handle operator-pending mode {{{
if a:is_exclusive == 1
" This mode requires that we eat one more
" character to the right if we're using
" a forward motion
if s:flag.dot_repeat == 1
" support dot repeat {{{
" Use visual mode to emulate dot repeat
normal! v
if s:previous.is_exclusive == 0
if s:previous.direction == 0 "Forward
let coords[1] -= 1
elseif s:previous.direction == 1 "Backward
" Shift visual selection to left by making cursor one key
" left.
normal! hoh
endif
endif
keepjumps call cursor(coords[0], coords[1])
let cmd = s:previous.operator
if s:previous.operator ==# 'c'
let cmd .= getreg('.')
endif
exec 'normal! ' . cmd
"}}}
else
" Handle operator-pending mode {{{
if a:is_exclusive == 1
" Exclusive motion requires that we eat one more
" character to the right if we're using
" a forward motion
normal! v
endif " }}}
" Adjuast screen for visual scroll {{{
if ! empty(a:visualmode)
keepjumps call cursor(win_first_line, 0)
normal! zt
endif "}}}
keepjumps call cursor(coords[0], coords[1])
endif
" Set tpope/vim-repeat
if s:current.is_operator == 1
silent! call repeat#set("\<Plug>(easymotion-dotrepeat)")
endif
" }}}
" Adjuast screen for visual scroll {{{
if ! empty(a:visualmode)
keepjumps call cursor(win_first_line, 0)
normal! zt
endif "}}}
keepjumps call cursor(coords[0], coords[1])
call s:Message('Jumping to [' . coords[0] . ', ' . coords[1] . ']')
let s:EasyMotion_cancelled = 0
"}}}
catch
redraw

View File

@ -1,4 +1,4 @@
*easymotion.txt* Version 2.0 Last change:15 Jan 2014.
*easymotion.txt* Version 2.0 Last change:16 Jan 2014.
______ __ ___ __ _
@ -255,6 +255,35 @@ Repeat ~
does not repeat motion type (e.g. othrer word motion,
<Plug>(easymotion-j) etc...) but only repeat input
characters.
EasyMotion dot repeat~
*easymotion-dotrepeat* *easymotion-textobjct*
This feature requires tpope/vim-repeat
https://github.com/tpope/vim-repeat
All motion type support '.' repeat.
Example:
>
" vimrc:
omap z <Plug>(easymotion-t)
let g:EasyMotion_keys='hklyuiopnm,qwertzxcvbasdgjf;'
<
Text sample:
>
{cursor}Lorem ipsum dolor sit ame*t*, consectetur adipisicing eli*t*,
sed do eiusmod tempor
<
type `dzt` and type first target marker(in this case, `h`)
>
{cursor}*t*, consectetur adipisicing eli*t,* sed do eiusmod tempor
<
just type '`.`'
>
*t,* sed do eiusmod tempor
<
JK Motion ~
*easymotion-jk-motion*

View File

@ -111,7 +111,7 @@ function! s:find_motion_map_helper(motions) "{{{
silent exec 'xnoremap <silent><Plug>(easymotion-'.name.')' .
\ ' <Esc>:<C-u>call EasyMotion#'. dict.fnc .'('. dict.cnt .',1,'. dict.direction .')<CR>'
" Example:
" noremap <silent><Plug>(easymotion-f2) <Esc>:<C-u>call EasyMotion#S(2,1,0)<CR>
" noremap <silent><Plug>(easymotion-f2) :<C-u>call EasyMotion#S(2,1,0)<CR>
" xnoremap <silent><Plug>(easymotion-f2) <Esc>:<C-u>call EasyMotion#S(2,1,0)<CR>
endfor
endfunction "}}}
@ -209,6 +209,8 @@ noremap <silent><Plug>(easymotion-sol-k) :<C-u>call EasyMotion#Sol(0,1
xnoremap <silent><Plug>(easymotion-sol-k) <Esc>:<C-u>call EasyMotion#Sol(1,1)<CR>
noremap <silent><Plug>(easymotion-sol-bd-jk) :<C-u>call EasyMotion#Sol(0,2)<CR>
xnoremap <silent><Plug>(easymotion-sol-bd-jk) <Esc>:<C-u>call EasyMotion#Sol(1,2)<CR>
"}}}
" End of Line JK {{{
noremap <silent><Plug>(easymotion-eol-j) :<C-u>call EasyMotion#Eol(0,0)<CR>
xnoremap <silent><Plug>(easymotion-eol-j) <Esc>:<C-u>call EasyMotion#Eol(1,0)<CR>
@ -241,6 +243,11 @@ noremap <silent><Plug>(easymotion-repeat)
\ :<C-u>call EasyMotion#Repeat(0)<CR>
xnoremap <silent><Plug>(easymotion-repeat)
\ <Esc>:<C-u>call EasyMotion#Repeat(1)<CR>
noremap <silent><Plug>(easymotion-dotrepeat)
\ :<C-u>call EasyMotion#DotRepeat(0)<CR>
xnoremap <silent><Plug>(easymotion-dotrepeat)
\ <Esc>:<C-u>call EasyMotion#DotRepeat(1)<CR>
"}}}
" -- Line Motion {{{

948
t/easymotion_spec.vim Normal file
View File

@ -0,0 +1,948 @@
"=============================================================================
" 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("3ABC5") 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
"}}}