Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Iskeyword option #450

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions autoload/EasyMotion.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,14 @@ function! s:DotPromptUser(groups) "{{{
endfunction "}}}

function! s:EasyMotion(regexp, direction, visualmode, is_inclusive, ...) " {{{
" Set local iskeyword for EasyMotion
if exists('g:EasyMotion_is_not_keyword')
let s:initial_keyword = &iskeyword
let s:exclude_keyword = split(g:EasyMotion_is_not_keyword, ',')
for item in s:exclude_keyword
execute 'set iskeyword-='.item
endfor
endif
let config = extend(s:default_config(), get(a:, 1, {}))
" Store s:current original_position & cursor_position {{{
" current cursor pos.
Expand Down Expand Up @@ -1598,6 +1606,10 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive, ...) " {{{
call EasyMotion#attach_active_autocmd() "}}}
endif
endtry
" Turn iskeyword back to normal setting
if exists('g:EasyMotion_is_not_keyword')
execute 'set iskeyword='.s:initial_keyword
endif
endfunction " }}}
"}}}
" }}}
Expand Down
8 changes: 8 additions & 0 deletions doc/easymotion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ iskeyword compatible word motions *<Plug>(easymotion-iskeyword-w)*
map <Leader>b <Plug>(easymotion-iskeyword-b)
<
NOTE: Within line motions are compatible with |iskeyword| by default.
If you want separated |iskeyword| for EasyMotion, you can use default
|iskeyword| option separated by comma.

Example:
>
" Exclude - and _ (dash and underscore)
let g:EasyMotion_is_not_keyword = "-,_"
<

Search motion respect previous direction

Expand Down