Implement g:EasyMotion_space_jump_first

Description: If you set this value 1, you can jump to first match by
             pressing space when prompt target label. <Space> key
             version of g:EasyMotion_enter_jump_first
Default: 0
This commit is contained in:
haya14busa 2014-02-06 21:22:25 +09:00
parent 112f4375d4
commit 9ad2b5b986
4 changed files with 12 additions and 5 deletions

View File

@ -3,7 +3,7 @@
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com> " Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
" haya14busa <hayabusa1419@gmail.com> " haya14busa <hayabusa1419@gmail.com>
" Source: https://github.com/Lokaltog/vim-easymotion " Source: https://github.com/Lokaltog/vim-easymotion
" Last Change: 05 Feb 2014. " Last Change: 06 Feb 2014.
"============================================================================= "=============================================================================
" Saving 'cpoptions' {{{ " Saving 'cpoptions' {{{
scriptencoding utf-8 scriptencoding utf-8
@ -918,8 +918,9 @@ function! s:PromptUser(groups) "{{{
let char = toupper(char) let char = toupper(char)
endif "}}} endif "}}}
" Jump first target when Enter key is pressed "{{{ " Jump first target when Enter or Space key is pressed "{{{
if char ==# "\<CR>" && g:EasyMotion_enter_jump_first == 1 if (char ==# "\<CR>" && g:EasyMotion_enter_jump_first == 1) ||
\ (char ==# " " && g:EasyMotion_space_jump_first == 1)
let char = g:EasyMotion_keys[0] let char = g:EasyMotion_keys[0]
endif "}}} endif "}}}

View File

@ -793,16 +793,20 @@ This feature is inspired by t9md's vim-smalls, which can be downloaded here:
https://github.com/t9md/vim-smalls https://github.com/t9md/vim-smalls
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Jump to first match by Enter *EasyMotion_enter_jump_first* Jump to first match by Enter or Space *EasyMotion_enter_jump_first*
*g:EasyMotion_enter_jump_first* *g:EasyMotion_enter_jump_first*
*EasyMotion_space_jump_first*
*g:EasyMotion_space_jump_first*
Type Enter key and jump to first match (first letter of |g:EasyMotion_keys| ). Type Enter or Space key and jump to first match (first letter of
|g:EasyMotion_keys| ).
Set this option to 1 if you want to enable this feature. Set this option to 1 if you want to enable this feature.
Example: Example:
> >
let g:EasyMotion_enter_jump_first = 1 let g:EasyMotion_enter_jump_first = 1
let g:EasyMotion_space_jump_first = 1
< <
Default: 0 Default: 0

View File

@ -34,6 +34,7 @@ let g:EasyMotion_skipfoldedline = get(g: , 'EasyMotion_skipfoldedline' ,
let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' , 0) let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' , 0)
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_space_jump_first = get(g: , 'EasyMotion_space_jump_first' , 0)
let g:EasyMotion_inc_highlight = get(g: , 'EasyMotion_inc_highlight' , 1) let g:EasyMotion_inc_highlight = get(g: , 'EasyMotion_inc_highlight' , 1)
let g:EasyMotion_move_highlight = get(g: , 'EasyMotion_move_highlight' , 1) let g:EasyMotion_move_highlight = get(g: , 'EasyMotion_move_highlight' , 1)
let g:EasyMotion_landing_highlight = get(g: , 'EasyMotion_landing_highlight' , 0) let g:EasyMotion_landing_highlight = get(g: , 'EasyMotion_landing_highlight' , 0)

View File

@ -451,6 +451,7 @@ describe 'Default settings'
Expect g:EasyMotion_use_migemo ==# 0 Expect g:EasyMotion_use_migemo ==# 0
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_space_jump_first ==# 0
Expect g:EasyMotion_show_prompt ==# 1 Expect g:EasyMotion_show_prompt ==# 1
Expect g:EasyMotion_inc_highlight ==# 1 Expect g:EasyMotion_inc_highlight ==# 1
Expect g:EasyMotion_move_highlight ==# 1 Expect g:EasyMotion_move_highlight ==# 1