Skip to content

Instantly share code, notes, and snippets.

@mattn
Created November 14, 2019 03:30
Show Gist options
  • Save mattn/d909c93784aa81d97b82c0896ef38ca8 to your computer and use it in GitHub Desktop.
Save mattn/d909c93784aa81d97b82c0896ef38ca8 to your computer and use it in GitHub Desktop.
function! s:fuzzy(lhs, rhs) abort
return a:lhs =~ join(map(split(a:rhs, '\zs'), "printf('[\\x%02x].*', char2nr(v:val))"), '')
endfunction
let g:asyncomplete_preprocessor =
\ [function('asyncomplete#preprocessor#ezfilter#filter')]
let g:asyncomplete#preprocessor#ezfilter#config = {}
let g:asyncomplete#preprocessor#ezfilter#config['*'] =
\ {ctx, items -> filter(items, 's:fuzzy(v:val.word, ctx.base) != 0')}
@machakann
Copy link

I wish vim script gained lshift() function which accelerated osa_filter. The algorithms are different in python and vim script versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment