support migemo but it'll take too long time
This commit is contained in:
parent
e55df4c7ed
commit
bafa29fee7
@ -10,6 +10,8 @@
|
|||||||
exec 'let g:EasyMotion_' . key . ' = ' . string(value)
|
exec 'let g:EasyMotion_' . key . ' = ' . string(value)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
" Reset Migemo Dictionary
|
||||||
|
let s:migemo_dicts = {}
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
function! EasyMotion#InitHL(group, colors) " {{{
|
function! EasyMotion#InitHL(group, colors) " {{{
|
||||||
let group_default = a:group . 'Default'
|
let group_default = a:group . 'Default'
|
||||||
@ -194,13 +196,22 @@
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:EasyMotion_smartcase && char =~# '\v\U'
|
let re = escape(char, '.$^~')
|
||||||
let re = '\c'
|
|
||||||
else
|
if g:EasyMotion_use_migemo
|
||||||
let re = '\C'
|
if ! has_key(s:migemo_dicts, &l:encoding)
|
||||||
|
let s:migemo_dicts[&l:encoding] = s:load_migemo_dict()
|
||||||
|
endif
|
||||||
|
if re =~# '^\a$'
|
||||||
|
let re = s:migemo_dicts[&l:encoding][re]
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let re = re . escape(char, '.$^~')
|
if g:EasyMotion_smartcase && char =~# '\v\U'
|
||||||
|
let re = '\c' . re
|
||||||
|
else
|
||||||
|
let re = '\C' . re
|
||||||
|
endif
|
||||||
|
|
||||||
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
@ -326,8 +337,6 @@
|
|||||||
|
|
||||||
return chars
|
return chars
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
|
|
||||||
function! s:GetSearchChar(visualmode) " {{{
|
function! s:GetSearchChar(visualmode) " {{{
|
||||||
call s:Prompt('Search for character')
|
call s:Prompt('Search for character')
|
||||||
|
|
||||||
@ -345,6 +354,20 @@
|
|||||||
|
|
||||||
return char
|
return char
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
|
function! s:load_migemo_dict() "{{{
|
||||||
|
let enc = &l:encoding
|
||||||
|
if enc ==# 'utf-8'
|
||||||
|
return EasyMotion#migemo#utf8#load_dict()
|
||||||
|
elseif enc ==# 'cp932'
|
||||||
|
return EasyMotion#migemo#cp932#load_dict()
|
||||||
|
elseif enc ==# 'euc-jp'
|
||||||
|
return EasyMotion#migemo#eucjp#load_dict()
|
||||||
|
else
|
||||||
|
let g:EasyMotion_use_migemo = 0
|
||||||
|
throw "Error: ".enc." is not supported. Migemo is made disabled."
|
||||||
|
endif
|
||||||
|
endfunction "}}}
|
||||||
" }}}
|
" }}}
|
||||||
" Grouping algorithms {{{
|
" Grouping algorithms {{{
|
||||||
let s:grouping_algorithms = {
|
let s:grouping_algorithms = {
|
||||||
|
29
autoload/EasyMotion/helper.vim
Normal file
29
autoload/EasyMotion/helper.vim
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
function! s:has_vimproc()
|
||||||
|
if !exists('s:exists_vimproc')
|
||||||
|
try
|
||||||
|
silent call vimproc#version()
|
||||||
|
let s:exists_vimproc = 1
|
||||||
|
catch
|
||||||
|
let s:exists_vimproc = 0
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
return s:exists_vimproc
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! EasyMotion#helper#system(...)
|
||||||
|
return call(s:has_vimproc() ? 'vimproc#system' : 'system', a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if exists('*strchars')
|
||||||
|
function! EasyMotion#helper#strchars(str)
|
||||||
|
return strchars(a:str)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! EasyMotion#helper#strchars(str)
|
||||||
|
return strlen(substitute(str, ".", "x", "g"))
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! EasyMotion#helper#include_multibyte_char(str)
|
||||||
|
return strlen(a:str) != EasyMotion#helper#strchars(a:str)
|
||||||
|
endfunction
|
56
autoload/EasyMotion/migemo/cp932.vim
Normal file
56
autoload/EasyMotion/migemo/cp932.vim
Normal file
File diff suppressed because one or more lines are too long
56
autoload/EasyMotion/migemo/eucjp.vim
Normal file
56
autoload/EasyMotion/migemo/eucjp.vim
Normal file
File diff suppressed because one or more lines are too long
56
autoload/EasyMotion/migemo/utf8.vim
Normal file
56
autoload/EasyMotion/migemo/utf8.vim
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user