Implement activate function
For clever motion & highlight
This commit is contained in:
parent
fdfdfd06f1
commit
33bf1de0f8
@ -761,6 +761,15 @@ endfunction "}}}
|
|||||||
function! EasyMotion#is_active() "{{{
|
function! EasyMotion#is_active() "{{{
|
||||||
return s:EasyMotion_is_active
|
return s:EasyMotion_is_active
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
function! EasyMotion#activate(is_visual) "{{{
|
||||||
|
let s:EasyMotion_is_active = 1
|
||||||
|
call EasyMotion#attach_active_autocmd()
|
||||||
|
call EasyMotion#highlight#add_highlight(s:previous.regexp, 'EasyMotionMoveHL')
|
||||||
|
call EasyMotion#highlight#attach_autocmd()
|
||||||
|
if a:is_visual == 1
|
||||||
|
normal! gv
|
||||||
|
endif
|
||||||
|
endfunction "}}}
|
||||||
"}}}
|
"}}}
|
||||||
" Grouping Algorithms: {{{
|
" Grouping Algorithms: {{{
|
||||||
let s:grouping_algorithms = {
|
let s:grouping_algorithms = {
|
||||||
|
@ -367,6 +367,9 @@ map <silent><expr><Plug>(easymotion-clever-s2)
|
|||||||
map <silent><expr><Plug>(easymotion-clever-sn)
|
map <silent><expr><Plug>(easymotion-clever-sn)
|
||||||
\ EasyMotion#is_active() ? '<Plug>(easymotion-next)' : '<Plug>(easymotion-sn)'
|
\ EasyMotion#is_active() ? '<Plug>(easymotion-next)' : '<Plug>(easymotion-sn)'
|
||||||
|
|
||||||
|
noremap <silent><Plug>(easymotion-activate) :<C-u>call EasyMotion#activate(0)<CR>
|
||||||
|
xnoremap <silent><Plug>(easymotion-activate) :<C-u>call EasyMotion#activate(1)<CR>
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" == Default key mapping {{{
|
" == Default key mapping {{{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: t/easymotion_spec.vim
|
" FILE: t/easymotion_spec.vim
|
||||||
" AUTHOR: haya14busa
|
" AUTHOR: haya14busa
|
||||||
" Last Change: 22 Jan 2014.
|
" Last Change: 23 Jan 2014.
|
||||||
" Test: https://github.com/kana/vim-vspec
|
" Test: https://github.com/kana/vim-vspec
|
||||||
" Refer: https://github.com/rhysd/clever-f.vim
|
" Refer: https://github.com/rhysd/clever-f.vim
|
||||||
" Description: EasyMotion test with vim-vspec
|
" Description: EasyMotion test with vim-vspec
|
||||||
@ -393,6 +393,15 @@ describe 'Default settings'
|
|||||||
Expect maparg('<Plug>(easymotion-special-pd)', 'n')
|
Expect maparg('<Plug>(easymotion-special-pd)', 'n')
|
||||||
\ ==# ':<C-U>call EasyMotion#SelectPhraseDelete()<CR>'
|
\ ==# ':<C-U>call EasyMotion#SelectPhraseDelete()<CR>'
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
" Activate {{{
|
||||||
|
Expect maparg('<Plug>(easymotion-activate)', 'n')
|
||||||
|
\ ==# ':<C-U>call EasyMotion#activate(0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-activate)', 'o')
|
||||||
|
\ ==# ':<C-U>call EasyMotion#activate(0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-activate)', 'v')
|
||||||
|
\ ==# ':<C-U>call EasyMotion#activate(1)<CR>'
|
||||||
|
" }}}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'provide autoload functions'
|
it 'provide autoload functions'
|
||||||
|
Loading…
Reference in New Issue
Block a user