Improve iskeyword word motions
- Make within line word motion compatible with iskeyword by default - Add test - Update doc - Thanks @yuex: #101
This commit is contained in:
parent
23bb024632
commit
3f423c28c9
@ -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: 16 Feb 2014.
|
" Last Change: 18 Feb 2014.
|
||||||
"=============================================================================
|
"=============================================================================
|
||||||
" Saving 'cpoptions' {{{
|
" Saving 'cpoptions' {{{
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
@ -232,12 +232,12 @@ function! EasyMotion#TL(num_strokes, visualmode, direction) " {{{
|
|||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
function! EasyMotion#WBL(visualmode, direction) " {{{
|
function! EasyMotion#WBL(visualmode, direction) " {{{
|
||||||
let s:flag.within_line = 1
|
let s:flag.within_line = 1
|
||||||
call EasyMotion#WB(a:visualmode, a:direction)
|
call EasyMotion#WBK(a:visualmode, a:direction)
|
||||||
return s:EasyMotion_is_cancelled
|
return s:EasyMotion_is_cancelled
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
function! EasyMotion#EL(visualmode, direction) " {{{
|
function! EasyMotion#EL(visualmode, direction) " {{{
|
||||||
let s:flag.within_line = 1
|
let s:flag.within_line = 1
|
||||||
call EasyMotion#E(a:visualmode, a:direction)
|
call EasyMotion#EK(a:visualmode, a:direction)
|
||||||
return s:EasyMotion_is_cancelled
|
return s:EasyMotion_is_cancelled
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
function! EasyMotion#LineAnywhere(visualmode, direction) " {{{
|
function! EasyMotion#LineAnywhere(visualmode, direction) " {{{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*easymotion.txt* Version 2.0 Last change:14 Feb 2014.
|
*easymotion.txt* Version 2.0 Last change:18 Feb 2014.
|
||||||
|
|
||||||
|
|
||||||
______ __ ___ __ _
|
______ __ ___ __ _
|
||||||
@ -152,7 +152,15 @@ EasyMotion <Plug> table *easymotion-plug-table*
|
|||||||
<Plug>(easymotion-next) | See |<Plug>(easymotion-next)|
|
<Plug>(easymotion-next) | See |<Plug>(easymotion-next)|
|
||||||
<Plug>(easymotion-previous) | See |<Plug>(easymotion-previous)|
|
<Plug>(easymotion-previous) | See |<Plug>(easymotion-previous)|
|
||||||
<Plug>(easymotion-sol-j) | See |<Plug>(easymotion-sol-j)|
|
<Plug>(easymotion-sol-j) | See |<Plug>(easymotion-sol-j)|
|
||||||
|
<Plug>(easymotion-sol-k) | See |<Plug>(easymotion-sol-k)|
|
||||||
<Plug>(easymotion-eol-j) | See |<Plug>(easymotion-eol-j)|
|
<Plug>(easymotion-eol-j) | See |<Plug>(easymotion-eol-j)|
|
||||||
|
<Plug>(easymotion-eol-k) | See |<Plug>(easymotion-eol-k)|
|
||||||
|
<Plug>(easymotion-iskeyword-w) | See |<Plug>(easymotion-iskeyword-w)|
|
||||||
|
<Plug>(easymotion-iskeyword-b) | See |<Plug>(easymotion-iskeyword-b)|
|
||||||
|
<Plug>(easymotion-iskeyword-bd-w) | See |<Plug>(easymotion-iskeyword-bd-w)|
|
||||||
|
<Plug>(easymotion-iskeyword-e) | See |<Plug>(easymotion-iskeyword-e)|
|
||||||
|
<Plug>(easymotion-iskeyword-ge) | See |<Plug>(easymotion-iskeyword-ge)|
|
||||||
|
<Plug>(easymotion-iskeyword-bd-e) | See |<Plug>(easymotion-iskeyword-bd-e)|
|
||||||
|
|
|
|
||||||
Within Line Motion | See |easymotion-within-line|
|
Within Line Motion | See |easymotion-within-line|
|
||||||
----------------------------------|---------------------------------
|
----------------------------------|---------------------------------
|
||||||
@ -360,6 +368,26 @@ End of Line JK motion *<Plug>(easymotion-eol-j)* *<Plug>(easymotion-eol-k)
|
|||||||
>
|
>
|
||||||
map <Leader>J <Plug>(easymotion-eol-j)
|
map <Leader>J <Plug>(easymotion-eol-j)
|
||||||
map <Leader>K <Plug>(easymotion-eol-K)
|
map <Leader>K <Plug>(easymotion-eol-K)
|
||||||
|
<
|
||||||
|
|
||||||
|
iskeyword compatible word motions *<Plug>(easymotion-iskeyword-w)*
|
||||||
|
*<Plug>(easymotion-iskeyword-b)*
|
||||||
|
*<Plug>(easymotion-iskeyword-bd-w)*
|
||||||
|
*<Plug>(easymotion-iskeyword-e)*
|
||||||
|
*<Plug>(easymotion-iskeyword-ge)*
|
||||||
|
*<Plug>(easymotion-iskeyword-bd-e)*
|
||||||
|
Default word motions which EasyMotion provide is not completely
|
||||||
|
compatible with |iskeyword| options. But if you make default word
|
||||||
|
motion completely compatible with it, there will be so many targets
|
||||||
|
that they maybe annoy you, so provide |iskeyword| compatible word
|
||||||
|
motions with another |<Plug>| mappings.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
>
|
||||||
|
map <Leader>w <Plug>(easymotion-iskeyword-w)
|
||||||
|
map <Leader>b <Plug>(easymotion-iskeyword-b)
|
||||||
|
<
|
||||||
|
NOTE: Within line motions are compatible with |iskeyword| by default.
|
||||||
|
|
||||||
Within line motion ~
|
Within line motion ~
|
||||||
*easymotion-within-line*
|
*easymotion-within-line*
|
||||||
@ -390,28 +418,28 @@ Within line motion ~
|
|||||||
range is limited to the current cursor line.
|
range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-wl) *<Plug>(easymotion-wl)*
|
<Plug>(easymotion-wl) *<Plug>(easymotion-wl)*
|
||||||
This function is same as |<Plug>(easymotion-w)|, except the
|
This function is same as |<Plug>(easymotion-iskeyword-w)|,
|
||||||
range is limited to the current cursor line.
|
except the range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-bl) *<Plug>(easymotion-bl)*
|
<Plug>(easymotion-bl) *<Plug>(easymotion-bl)*
|
||||||
This function is same as |<Plug>(easymotion-b)|, except the
|
This function is same as |<Plug>(easymotion-iskeyword-b)|,
|
||||||
range is limited to the current cursor line.
|
except the range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-bd-wl) *<Plug>(easymotion-bd-wl)*
|
<Plug>(easymotion-bd-wl) *<Plug>(easymotion-bd-wl)*
|
||||||
This function is same as |<Plug>(easymotion-bd-w)|, except the
|
This function is same as |<Plug>(easymotion-iskeyword-bd-w)|,
|
||||||
range is limited to the current cursor line.
|
except the range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-el) *<Plug>(easymotion-el)*
|
<Plug>(easymotion-el) *<Plug>(easymotion-el)*
|
||||||
This function is same as |<Plug>(easymotion-e)|, except the
|
This function is same as |<Plug>(easymotion-iskeyword-e)|,
|
||||||
range is limited to the current cursor line.
|
except the range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-gel) *<Plug>(easymotion-gel)*
|
<Plug>(easymotion-gel) *<Plug>(easymotion-gel)*
|
||||||
This function is same as |<Plug>(easymotion-ge)|, except the
|
This function is same as |<Plug>(easymotion-iskeyword-ge)|,
|
||||||
range is limited to the current cursor line.
|
except the range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-bd-el) *<Plug>(easymotion-bd-el)*
|
<Plug>(easymotion-bd-el) *<Plug>(easymotion-bd-el)*
|
||||||
This function is same as |<Plug>(easymotion-bd-e)|, except the
|
This function is same as |<Plug>(easymotion-iskeyword-bd-e)|,
|
||||||
range is limited to the current cursor line.
|
except the range is limited to the current cursor line.
|
||||||
|
|
||||||
<Plug>(easymotion-lineforward) *<Plug>(easymotion-lineforward)*
|
<Plug>(easymotion-lineforward) *<Plug>(easymotion-lineforward)*
|
||||||
This function is similar to
|
This function is similar to
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: t/easymotion_spec.vim
|
" FILE: t/easymotion_spec.vim
|
||||||
" AUTHOR: haya14busa
|
" AUTHOR: haya14busa
|
||||||
" Last Change: 12 Feb 2014.
|
" Last Change: 18 Feb 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
|
||||||
@ -242,6 +242,18 @@ describe 'Default settings'
|
|||||||
Expect maparg('<Plug>(easymotion-bd-W)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBW(1,2)<CR>'
|
Expect maparg('<Plug>(easymotion-bd-W)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBW(1,2)<CR>'
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
" Word Motion IsKeyWord: {{{
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-w)', 'n') ==# ':<C-U>call EasyMotion#WBK(0,0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-w)', 'o') ==# ':<C-U>call EasyMotion#WBK(0,0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-w)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBK(1,0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-b)', 'n') ==# ':<C-U>call EasyMotion#WBK(0,1)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-b)', 'o') ==# ':<C-U>call EasyMotion#WBK(0,1)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-b)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBK(1,1)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-bd-w)', 'n') ==# ':<C-U>call EasyMotion#WBK(0,2)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-bd-w)', 'o') ==# ':<C-U>call EasyMotion#WBK(0,2)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-bd-w)', 'v') ==# '<Esc>:<C-U>call EasyMotion#WBK(1,2)<CR>'
|
||||||
|
" }}}
|
||||||
|
|
||||||
" End Of Word Motion: {{{
|
" End Of Word Motion: {{{
|
||||||
Expect maparg('<Plug>(easymotion-e)', 'n') ==# ':<C-U>call EasyMotion#E(0,0)<CR>'
|
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)', 'o') ==# ':<C-U>call EasyMotion#E(0,0)<CR>'
|
||||||
@ -266,6 +278,18 @@ describe 'Default settings'
|
|||||||
Expect maparg('<Plug>(easymotion-bd-E)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EW(1,2)<CR>'
|
Expect maparg('<Plug>(easymotion-bd-E)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EW(1,2)<CR>'
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
" End Of Word Motion IsKeyWord: {{{
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-e)', 'n') ==# ':<C-U>call EasyMotion#EK(0,0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-e)', 'o') ==# ':<C-U>call EasyMotion#EK(0,0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-e)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EK(1,0)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-ge)', 'n') ==# ':<C-U>call EasyMotion#EK(0,1)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-ge)', 'o') ==# ':<C-U>call EasyMotion#EK(0,1)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-ge)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EK(1,1)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-bd-e)', 'n') ==# ':<C-U>call EasyMotion#EK(0,2)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-bd-e)', 'o') ==# ':<C-U>call EasyMotion#EK(0,2)<CR>'
|
||||||
|
Expect maparg('<Plug>(easymotion-iskeyword-bd-e)', 'v') ==# '<Esc>:<C-U>call EasyMotion#EK(1,2)<CR>'
|
||||||
|
" }}}
|
||||||
|
|
||||||
" JK Motion: {{{
|
" JK Motion: {{{
|
||||||
" default
|
" default
|
||||||
Expect maparg('<Plug>(easymotion-j)', 'n') ==# ':<C-U>call EasyMotion#JK(0,0)<CR>'
|
Expect maparg('<Plug>(easymotion-j)', 'n') ==# ':<C-U>call EasyMotion#JK(0,0)<CR>'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user