Merge branch 'improve/search-sn' into master

This commit is contained in:
haya14busa 2014-02-13 11:30:51 +09:00
commit 0f1ac79503
2 changed files with 27 additions and 2 deletions

View File

@ -3,7 +3,7 @@
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
" haya14busa <hayabusa1419@gmail.com>
" Source: https://github.com/Lokaltog/vim-easymotion
" Last Change: 11 Feb 2014.
" Last Change: 13 Feb 2014.
"=============================================================================
" Saving 'cpoptions' {{{
scriptencoding utf-8
@ -1368,6 +1368,17 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive) " {{{
silent! call repeat#set("\<Plug>(easymotion-dotrepeat)")
endif "}}}
" Highlight all the matches by n-key find motions {{{
if s:current.is_search == 1 && mode(1) !=# 'ce'
" FIXME: mode(1) !=# 'ce' exists only for the test
" It seems let &hlsearch=&hlsearch doesn't work when called
" in script.
call EasyMotion#helper#silent_feedkeys(
\ ":let &hlsearch=&hlsearch\<CR>",
\ 'hlsearch', 'n')
" Ref: :h v:hlsearch
endif "}}}
call s:Message('Jumping to [' . coords[0] . ', ' . coords[1] . ']')
let s:EasyMotion_is_cancelled = 0 " Success
"}}}

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: autoload/EasyMotion/helper.vim
" AUTHOR: haya14busa
" Last Change: 06 Feb 2014.
" Last Change: 13 Feb 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -79,6 +79,20 @@ function! EasyMotion#helper#should_case_sensitive(input, is_search) "{{{
endif
return 0
endfunction "}}}
function! EasyMotion#helper#silent_feedkeys(expr, name, ...) "{{{
" Ref:
" https://github.com/osyo-manga/vim-over/blob/d51b028c29661d4a5f5b79438ad6d69266753711/autoload/over.vim#L6
let mode = get(a:, 1, "m")
let name = "easymotion-" . a:name
let map = printf("<Plug>(%s)", name)
if mode == "n"
let command = "nnoremap"
else
let command = "nmap"
endif
execute command "<silent>" map printf("%s:nunmap %s<CR>", a:expr, map)
call feedkeys(printf("\<Plug>(%s)", name))
endfunction "}}}
" Migemo {{{
function! EasyMotion#helper#load_migemo_dict() "{{{