Skip to content

Commit 450f145

Browse files
committed
Support all ASCII characters in migemo, without whitespace.
1. Ignore whitespace because migemo doesn't generate any useful regexp for whitespace. 2. Fix not to escape any ASCII characters (e.g. `*`, `.`) if migemo is enabled, because `s:convertMigemo()` will replace them with migemo-regexps. 3. Remove verifying `re` in `s:convertMigemo()`, because `s:should_use_migemo()` already verified it.
1 parent 19d00af commit 450f145

File tree

4 files changed

+285
-164
lines changed

4 files changed

+285
-164
lines changed

autoload/EasyMotion.vim

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,15 @@ function! s:convertRegep(input) "{{{
561561
" 2. migemo
562562
" 3. smartsign
563563
" 4. smartcase
564-
let re = s:should_use_regexp() ? a:input : s:escape_regexp_char(a:input)
564+
let use_migemo = s:should_use_migemo(a:input)
565+
let re = use_migemo || s:should_use_regexp() ? a:input : s:escape_regexp_char(a:input)
565566

566567
" Convert space to match only start of spaces
567568
if re ==# ' '
568569
let re = '\s\+'
569570
endif
570571

571-
if s:should_use_migemo(a:input)
572+
if use_migemo
572573
let re = s:convertMigemo(re)
573574
endif
574575

@@ -593,10 +594,7 @@ function! s:convertMigemo(re) "{{{
593594
if ! has_key(s:migemo_dicts, &l:encoding)
594595
let s:migemo_dicts[&l:encoding] = EasyMotion#helper#load_migemo_dict()
595596
endif
596-
if re =~# '^\a$'
597-
let re = get(s:migemo_dicts[&l:encoding], re, a:re)
598-
endif
599-
return re
597+
return get(s:migemo_dicts[&l:encoding], re, a:re)
600598
endfunction "}}}
601599
function! s:convertSmartsign(chars) "{{{
602600
" Convert given chars to smartsign string
@@ -641,7 +639,7 @@ function! s:should_use_regexp() "{{{
641639
return g:EasyMotion_use_regexp == 1 && s:flag.regexp == 1
642640
endfunction "}}}
643641
function! s:should_use_migemo(char) "{{{
644-
if ! g:EasyMotion_use_migemo || match(a:char, '\A') != -1
642+
if ! g:EasyMotion_use_migemo || match(a:char, '[^!-~]') != -1
645643
return 0
646644
endif
647645

0 commit comments

Comments
 (0)