Merge branch 'feature/custom-prompt' into master
This commit is contained in:
commit
f37b60e3be
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: autoload/EasyMotion/command_line.vim
|
" FILE: autoload/EasyMotion/command_line.vim
|
||||||
" AUTHOR: haya14busa
|
" AUTHOR: haya14busa
|
||||||
" Last Change: 14 Jan 2014.
|
" Last Change: 17 Jan 2014.
|
||||||
" License: MIT license {{{
|
" License: MIT license {{{
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining
|
" Permission is hereby granted, free of charge, to any person obtaining
|
||||||
" a copy of this software and associated documentation files (the
|
" a copy of this software and associated documentation files (the
|
||||||
@ -40,14 +40,30 @@ function! s:Cancell() " {{{
|
|||||||
return ''
|
return ''
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
|
function! s:getPromptMessage(num_strokes)
|
||||||
|
if a:num_strokes == 1
|
||||||
|
let prompt = substitute(
|
||||||
|
\ substitute(g:EasyMotion_prompt,'{n}', a:num_strokes, 'g'),
|
||||||
|
\ '(s)', '', 'g')
|
||||||
|
elseif a:num_strokes == -1
|
||||||
|
let prompt = substitute(
|
||||||
|
\ substitute(g:EasyMotion_prompt, '{n}\s\{0,1}', '', 'g'),
|
||||||
|
\ '(s)', 's', 'g')
|
||||||
|
else
|
||||||
|
let prompt = substitute(
|
||||||
|
\ substitute(g:EasyMotion_prompt,'{n}', a:num_strokes, 'g'),
|
||||||
|
\ '(s)', 's', 'g')
|
||||||
|
endif
|
||||||
|
return prompt
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! EasyMotion#command_line#GetInput(num_strokes, ...) "{{{
|
function! EasyMotion#command_line#GetInput(num_strokes, ...) "{{{
|
||||||
let previous_input = a:0 == 1 ? a:1 : ''
|
let previous_input = a:0 == 1 ? a:1 : ''
|
||||||
|
|
||||||
let input = ''
|
let input = ''
|
||||||
" repeat a:num_strokes times
|
let prompt = s:getPromptMessage(a:num_strokes)
|
||||||
let prompt_num = a:num_strokes < 50 ? a:num_strokes : ''
|
|
||||||
let prompt = prompt_num . g:EasyMotion_prompt
|
while EasyMotion#helper#strchars(input) < a:num_strokes ||
|
||||||
while EasyMotion#helper#strchars(input) < a:num_strokes
|
\ a:num_strokes == -1
|
||||||
if g:EasyMotion_show_prompt
|
if g:EasyMotion_show_prompt
|
||||||
call s:InputPrompt(prompt, input)
|
call s:InputPrompt(prompt, input)
|
||||||
endif
|
endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*easymotion.txt* Version 2.0 Last change:16 Jan 2014.
|
*easymotion.txt* Version 2.0 Last change:17 Jan 2014.
|
||||||
|
|
||||||
|
|
||||||
______ __ ___ __ _
|
______ __ ___ __ _
|
||||||
@ -36,6 +36,7 @@ CONTENTS *easymotion-contents*
|
|||||||
4.11.1 Select Line ............. |easymotion-select-line|
|
4.11.1 Select Line ............. |easymotion-select-line|
|
||||||
4.11.2 Select Phrase ........... |easymotion-select-phrase|
|
4.11.2 Select Phrase ........... |easymotion-select-phrase|
|
||||||
4.12 EasyMotion_enter_jump_first ... |EasyMotion_enter_jump_first|
|
4.12 EasyMotion_enter_jump_first ... |EasyMotion_enter_jump_first|
|
||||||
|
4.13 EasyMotion_prompt ............. |EasyMotion_prompt|
|
||||||
5. License ............................ |easymotion-license|
|
5. License ............................ |easymotion-license|
|
||||||
6. Known bugs ......................... |easymotion-known-bugs|
|
6. Known bugs ......................... |easymotion-known-bugs|
|
||||||
7. Contributing ....................... |easymotion-contributing|
|
7. Contributing ....................... |easymotion-contributing|
|
||||||
@ -854,6 +855,26 @@ Example:
|
|||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
|
|
||||||
|
4.13 Customize command line prompt *EasyMotion_prompt*
|
||||||
|
*g:EasyMotion_prompt*
|
||||||
|
|
||||||
|
You can customize command line prompt message in find motion.
|
||||||
|
`{n}` is how many characters you type, and if {n} == 1 `(s)` will be
|
||||||
|
ignored.
|
||||||
|
|
||||||
|
Sample:
|
||||||
|
>
|
||||||
|
let g:EasyMotion_prompt = '{n}>>> '
|
||||||
|
<
|
||||||
|
Default:
|
||||||
|
>
|
||||||
|
let g:EasyMotion_prompt = 'Search for {n} character(s): '
|
||||||
|
<
|
||||||
|
This message will be:
|
||||||
|
|<Plug>(easymotion-s)| -> 'Search for 1 character: '
|
||||||
|
|<Plug>(easymotion-s2)| -> 'Search for 2 characters: '
|
||||||
|
|<Plug>(easymotion-sn)| -> 'Search for characters: '
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
5. License *easymotion-license*
|
5. License *easymotion-license*
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@ let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' ,
|
|||||||
let g:EasyMotion_use_upper = get(g: , 'EasyMotion_use_upper' , 0)
|
let g:EasyMotion_use_upper = get(g: , 'EasyMotion_use_upper' , 0)
|
||||||
let g:EasyMotion_enter_jump_first = get(g: , 'EasyMotion_enter_jump_first' , 0)
|
let g:EasyMotion_enter_jump_first = get(g: , 'EasyMotion_enter_jump_first' , 0)
|
||||||
let g:EasyMotion_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1)
|
let g:EasyMotion_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1)
|
||||||
let g:EasyMotion_prompt = get(g: , 'EasyMotion_prompt' , '> ')
|
let g:EasyMotion_prompt =
|
||||||
|
\ get(g: , 'EasyMotion_prompt' , 'Search for {n} character(s): ')
|
||||||
let g:EasyMotion_command_line_key_mappings =
|
let g:EasyMotion_command_line_key_mappings =
|
||||||
\ get(g: , 'EasyMotion_command_line_key_mappings' , {})
|
\ get(g: , 'EasyMotion_command_line_key_mappings' , {})
|
||||||
|
|
||||||
@ -139,16 +140,16 @@ call s:find_motion_map_helper({
|
|||||||
\ 'tl2' : {'fnc': 'TL', 'cnt': 2, 'direction': 0},
|
\ 'tl2' : {'fnc': 'TL', 'cnt': 2, 'direction': 0},
|
||||||
\ 'Tl2' : {'fnc': 'TL', 'cnt': 2, 'direction': 1},
|
\ 'Tl2' : {'fnc': 'TL', 'cnt': 2, 'direction': 1},
|
||||||
\
|
\
|
||||||
\ 'fn' : {'fnc': 'S' , 'cnt': 50, 'direction': 0},
|
\ 'fn' : {'fnc': 'S' , 'cnt': -1, 'direction': 0},
|
||||||
\ 'Fn' : {'fnc': 'S' , 'cnt': 50, 'direction': 1},
|
\ 'Fn' : {'fnc': 'S' , 'cnt': -1, 'direction': 1},
|
||||||
\ 'sn' : {'fnc': 'S' , 'cnt': 50, 'direction': 2},
|
\ 'sn' : {'fnc': 'S' , 'cnt': -1, 'direction': 2},
|
||||||
\ 'tn' : {'fnc': 'T' , 'cnt': 50, 'direction': 0},
|
\ 'tn' : {'fnc': 'T' , 'cnt': -1, 'direction': 0},
|
||||||
\ 'Tn' : {'fnc': 'T' , 'cnt': 50, 'direction': 1},
|
\ 'Tn' : {'fnc': 'T' , 'cnt': -1, 'direction': 1},
|
||||||
\ 'fln' : {'fnc': 'SL', 'cnt': 50, 'direction': 0},
|
\ 'fln' : {'fnc': 'SL', 'cnt': -1, 'direction': 0},
|
||||||
\ 'Fln' : {'fnc': 'SL', 'cnt': 50, 'direction': 1},
|
\ 'Fln' : {'fnc': 'SL', 'cnt': -1, 'direction': 1},
|
||||||
\ 'sln' : {'fnc': 'SL', 'cnt': 50, 'direction': 2},
|
\ 'sln' : {'fnc': 'SL', 'cnt': -1, 'direction': 2},
|
||||||
\ 'tln' : {'fnc': 'TL', 'cnt': 50, 'direction': 0},
|
\ 'tln' : {'fnc': 'TL', 'cnt': -1, 'direction': 0},
|
||||||
\ 'Tln' : {'fnc': 'TL', 'cnt': 50, 'direction': 1},
|
\ 'Tln' : {'fnc': 'TL', 'cnt': -1, 'direction': 1},
|
||||||
\ })
|
\ })
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
@ -122,45 +122,45 @@ describe 'Default settings'
|
|||||||
|
|
||||||
" Multi Char Find Motion: {{{
|
" Multi Char Find Motion: {{{
|
||||||
" sn
|
" sn
|
||||||
Expect maparg('<Plug>(easymotion-sn)', 'n') ==# ':<C-U>call EasyMotion#S(50,0,2)<CR>'
|
Expect maparg('<Plug>(easymotion-sn)', 'n') ==# ':<C-U>call EasyMotion#S(-1,0,2)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-sn)', 'o') ==# ':<C-U>call EasyMotion#S(50,0,2)<CR>'
|
Expect maparg('<Plug>(easymotion-sn)', 'o') ==# ':<C-U>call EasyMotion#S(-1,0,2)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-sn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(50,1,2)<CR>'
|
Expect maparg('<Plug>(easymotion-sn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(-1,1,2)<CR>'
|
||||||
" fn
|
" fn
|
||||||
Expect maparg('<Plug>(easymotion-fn)', 'n') ==# ':<C-U>call EasyMotion#S(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-fn)', 'n') ==# ':<C-U>call EasyMotion#S(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-fn)', 'o') ==# ':<C-U>call EasyMotion#S(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-fn)', 'o') ==# ':<C-U>call EasyMotion#S(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-fn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(50,1,0)<CR>'
|
Expect maparg('<Plug>(easymotion-fn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(-1,1,0)<CR>'
|
||||||
" Fn
|
" Fn
|
||||||
Expect maparg('<Plug>(easymotion-Fn)', 'n') ==# ':<C-U>call EasyMotion#S(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Fn)', 'n') ==# ':<C-U>call EasyMotion#S(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Fn)', 'o') ==# ':<C-U>call EasyMotion#S(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Fn)', 'o') ==# ':<C-U>call EasyMotion#S(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Fn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(50,1,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Fn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#S(-1,1,1)<CR>'
|
||||||
" tn
|
" tn
|
||||||
Expect maparg('<Plug>(easymotion-tn)', 'n') ==# ':<C-U>call EasyMotion#T(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-tn)', 'n') ==# ':<C-U>call EasyMotion#T(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-tn)', 'o') ==# ':<C-U>call EasyMotion#T(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-tn)', 'o') ==# ':<C-U>call EasyMotion#T(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-tn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(50,1,0)<CR>'
|
Expect maparg('<Plug>(easymotion-tn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(-1,1,0)<CR>'
|
||||||
" Tn
|
" Tn
|
||||||
Expect maparg('<Plug>(easymotion-Tn)', 'n') ==# ':<C-U>call EasyMotion#T(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Tn)', 'n') ==# ':<C-U>call EasyMotion#T(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Tn)', 'o') ==# ':<C-U>call EasyMotion#T(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Tn)', 'o') ==# ':<C-U>call EasyMotion#T(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Tn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(50,1,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Tn)', 'v') ==# '<Esc>:<C-U>call EasyMotion#T(-1,1,1)<CR>'
|
||||||
" sln
|
" sln
|
||||||
Expect maparg('<Plug>(easymotion-sln)', 'n') ==# ':<C-U>call EasyMotion#SL(50,0,2)<CR>'
|
Expect maparg('<Plug>(easymotion-sln)', 'n') ==# ':<C-U>call EasyMotion#SL(-1,0,2)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-sln)', 'o') ==# ':<C-U>call EasyMotion#SL(50,0,2)<CR>'
|
Expect maparg('<Plug>(easymotion-sln)', 'o') ==# ':<C-U>call EasyMotion#SL(-1,0,2)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-sln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(50,1,2)<CR>'
|
Expect maparg('<Plug>(easymotion-sln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(-1,1,2)<CR>'
|
||||||
" fln
|
" fln
|
||||||
Expect maparg('<Plug>(easymotion-fln)', 'n') ==# ':<C-U>call EasyMotion#SL(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-fln)', 'n') ==# ':<C-U>call EasyMotion#SL(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-fln)', 'o') ==# ':<C-U>call EasyMotion#SL(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-fln)', 'o') ==# ':<C-U>call EasyMotion#SL(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-fln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(50,1,0)<CR>'
|
Expect maparg('<Plug>(easymotion-fln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(-1,1,0)<CR>'
|
||||||
" Fln
|
" Fln
|
||||||
Expect maparg('<Plug>(easymotion-Fln)', 'n') ==# ':<C-U>call EasyMotion#SL(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Fln)', 'n') ==# ':<C-U>call EasyMotion#SL(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Fln)', 'o') ==# ':<C-U>call EasyMotion#SL(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Fln)', 'o') ==# ':<C-U>call EasyMotion#SL(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Fln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(50,1,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Fln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#SL(-1,1,1)<CR>'
|
||||||
" tln
|
" tln
|
||||||
Expect maparg('<Plug>(easymotion-tln)', 'n') ==# ':<C-U>call EasyMotion#TL(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-tln)', 'n') ==# ':<C-U>call EasyMotion#TL(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-tln)', 'o') ==# ':<C-U>call EasyMotion#TL(50,0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-tln)', 'o') ==# ':<C-U>call EasyMotion#TL(-1,0,0)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-tln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(50,1,0)<CR>'
|
Expect maparg('<Plug>(easymotion-tln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(-1,1,0)<CR>'
|
||||||
" Tln
|
" Tln
|
||||||
Expect maparg('<Plug>(easymotion-Tln)', 'n') ==# ':<C-U>call EasyMotion#TL(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Tln)', 'n') ==# ':<C-U>call EasyMotion#TL(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Tln)', 'o') ==# ':<C-U>call EasyMotion#TL(50,0,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Tln)', 'o') ==# ':<C-U>call EasyMotion#TL(-1,0,1)<CR>'
|
||||||
Expect maparg('<Plug>(easymotion-Tln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(50,1,1)<CR>'
|
Expect maparg('<Plug>(easymotion-Tln)', 'v') ==# '<Esc>:<C-U>call EasyMotion#TL(-1,1,1)<CR>'
|
||||||
"}}}
|
"}}}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ describe 'Default settings'
|
|||||||
Expect g:EasyMotion_use_upper ==# 0
|
Expect g:EasyMotion_use_upper ==# 0
|
||||||
Expect g:EasyMotion_enter_jump_first ==# 0
|
Expect g:EasyMotion_enter_jump_first ==# 0
|
||||||
Expect g:EasyMotion_show_prompt ==# 1
|
Expect g:EasyMotion_show_prompt ==# 1
|
||||||
Expect g:EasyMotion_prompt ==# '> '
|
Expect g:EasyMotion_prompt ==# 'Search for {n} character(s): '
|
||||||
Expect g:EasyMotion_command_line_key_mappings ==# {}
|
Expect g:EasyMotion_command_line_key_mappings ==# {}
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user