Merge branch 'feature/enter_repeat' into master
This commit is contained in:
commit
348e381d23
@ -12,6 +12,7 @@ set cpo&vim
|
||||
" == Init {{{
|
||||
function! EasyMotion#init()
|
||||
" Init Migemo Dictionary
|
||||
let s:old = {}
|
||||
let s:migemo_dicts = {}
|
||||
let s:line_flag = 0
|
||||
" Anywhere regular expression: {{{
|
||||
@ -49,7 +50,9 @@ endfunction "}}}
|
||||
" == Motion functions {{{
|
||||
" -- Find Motion -------------------------
|
||||
function! EasyMotion#S(num_strokes, visualmode, direction) " {{{
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes)
|
||||
let s:old['input'] = get(s:old, 'input', '')
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:old.input)
|
||||
let s:old['input'] = input
|
||||
|
||||
" Check that we have an input char
|
||||
if empty(input)
|
||||
@ -57,6 +60,8 @@ function! EasyMotion#S(num_strokes, visualmode, direction) " {{{
|
||||
if ! empty(a:visualmode)
|
||||
silent exec 'normal! gv'
|
||||
endif
|
||||
redraw
|
||||
echo ''
|
||||
return
|
||||
endif
|
||||
|
||||
@ -65,7 +70,9 @@ function! EasyMotion#S(num_strokes, visualmode, direction) " {{{
|
||||
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
||||
endfunction " }}}
|
||||
function! EasyMotion#T(num_strokes, visualmode, direction) " {{{
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes)
|
||||
let s:old['input'] = get(s:old, 'input', '')
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:old.input)
|
||||
let s:old['input'] = input
|
||||
|
||||
" Check that we have an input char
|
||||
if empty(input)
|
||||
@ -73,6 +80,8 @@ function! EasyMotion#T(num_strokes, visualmode, direction) " {{{
|
||||
if ! empty(a:visualmode)
|
||||
silent exec 'normal! gv'
|
||||
endif
|
||||
redraw
|
||||
echo ''
|
||||
return
|
||||
endif
|
||||
|
||||
@ -120,7 +129,9 @@ function! EasyMotion#JumpToAnywhere(visualmode, direction) " {{{
|
||||
endfunction " }}}
|
||||
" -- Line Motion -------------------------
|
||||
function! EasyMotion#SL(num_strokes, visualmode, direction) " {{{
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes)
|
||||
let s:old['input'] = get(s:old, 'input', '')
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:old.input)
|
||||
let s:old['input'] = input
|
||||
|
||||
" Check that we have an input char
|
||||
if empty(input)
|
||||
@ -128,6 +139,8 @@ function! EasyMotion#SL(num_strokes, visualmode, direction) " {{{
|
||||
if ! empty(a:visualmode)
|
||||
silent exec 'normal! gv'
|
||||
endif
|
||||
redraw
|
||||
echo ''
|
||||
return
|
||||
endif
|
||||
|
||||
@ -137,7 +150,9 @@ function! EasyMotion#SL(num_strokes, visualmode, direction) " {{{
|
||||
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
||||
endfunction " }}}
|
||||
function! EasyMotion#TL(num_strokes, visualmode, direction) " {{{
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes)
|
||||
let s:old['input'] = get(s:old, 'input', '')
|
||||
let input = EasyMotion#command_line#GetInput(a:num_strokes, s:old.input)
|
||||
let s:old['input'] = input
|
||||
|
||||
" Check that we have an input char
|
||||
if empty(input)
|
||||
@ -145,6 +160,8 @@ function! EasyMotion#TL(num_strokes, visualmode, direction) " {{{
|
||||
if ! empty(a:visualmode)
|
||||
silent exec 'normal! gv'
|
||||
endif
|
||||
redraw
|
||||
echo ''
|
||||
return
|
||||
endif
|
||||
|
||||
@ -326,7 +343,7 @@ endfunction " }}}
|
||||
" -- Repeat Motion -----------------------
|
||||
function! EasyMotion#Repeat(visualmode) " {{{
|
||||
" Repeat previous motion with previous targets
|
||||
if ! exists('s:old')
|
||||
if s:old ==# {}
|
||||
call s:Message("Previous targets doesn't exist")
|
||||
return
|
||||
endif
|
||||
@ -1013,10 +1030,8 @@ function! s:EasyMotion(regexp, direction, visualmode, mode, ...) " {{{
|
||||
let targets = []
|
||||
|
||||
" Store Regular Expression
|
||||
let s:old = {
|
||||
\ 'regexp': a:regexp,
|
||||
\ 'direction': a:direction,
|
||||
\ }
|
||||
let s:old['regexp'] = a:regexp
|
||||
let s:old['direction'] = a:direction
|
||||
let s:old['line_flag'] = s:line_flag == 1 ? 1 : 0
|
||||
|
||||
try
|
||||
|
@ -40,7 +40,9 @@ function! s:Cancell() " {{{
|
||||
return ''
|
||||
endfunction " }}}
|
||||
|
||||
function! EasyMotion#command_line#GetInput(num_strokes) "{{{
|
||||
function! EasyMotion#command_line#GetInput(num_strokes, ...) "{{{
|
||||
let previous_input = a:0 == 1 ? a:1 : ''
|
||||
|
||||
let input = ''
|
||||
" repeat a:num_strokes times
|
||||
let prompt_num = a:num_strokes < 50 ? a:num_strokes : ''
|
||||
@ -72,7 +74,14 @@ function! EasyMotion#command_line#GetInput(num_strokes) "{{{
|
||||
elseif EasyMotion#command_line#is_input("\<C-w>")
|
||||
" Delete word
|
||||
let input = matchstr(input, '^\zs.\{-}\ze\(\(\w*\)\|\(.\)\)$')
|
||||
elseif EasyMotion#command_line#is_input("\<C-p>")
|
||||
let input = previous_input
|
||||
elseif EasyMotion#command_line#is_input("\<C-n>")
|
||||
let input = ''
|
||||
elseif EasyMotion#command_line#is_input("\<CR>")
|
||||
if len(input) == 0
|
||||
return previous_input
|
||||
endif
|
||||
" Return input charcters
|
||||
return input
|
||||
elseif EasyMotion#command_line#is_input("\<C-j>")
|
||||
|
@ -248,6 +248,13 @@ Repeat ~
|
||||
Repeat last motion type including input target character.
|
||||
Nothing will happen when previous motion doesn't exist.
|
||||
|
||||
Last Find Motion~
|
||||
In Find motion (e.g. |<Plug>(easymoion-s)| ), to type `<CR>`
|
||||
without input characters invoke last find motion. This
|
||||
does not repeat motion type (e.g. othrer word motion,
|
||||
<Plug>(easymotion-j) etc...) but only repeat input
|
||||
characters.
|
||||
|
||||
|
||||
Within line motion ~
|
||||
*easymotion-within-line*
|
||||
|
Loading…
x
Reference in New Issue
Block a user