No.Name.-.NVIM.2021-10-10.01-06-53.mp4
Fuzzy matching filters for ddc.vim.
The de facto standard filters, match_head and sorter_rank, behave like the other completion such as VSCode. They suggest terms containing an input as a substring. However, they omit words with a typo. It means that we cannot obtain a suggestion word from wrd. Moreover, it is hard to select a long word with a short input.
Our filters fix this problem with the fuzzy filter that behaves like CtrlP.
To install our filters,
Plug 'tani/ddc-fuzzy'
To use our filters,
call ddc#custom#patch_global('ui', 'pum')
call ddc#custom#patch_global('sourceOptions', {
\ '_': {
\ 'matchers': ['matcher_fuzzy'],
\ 'sorters': ['sorter_fuzzy'],
\ 'converters': ['converter_fuzzy']
\ }
\ })
matcher_fuzzy
filter provides an option splitMode
. For the default mode,
{ 'splitMode': 'character' }
, each input character matches any characters of a
candidate. For example, abc
matches axbxc
. On the other hand, for the option
{'splitMode': 'word'}
, each input character matches the beginning of a word of
a candidate. For example, abc
does not match axbxc
but abc
matches a_bc
and a_b_c
.
call ddc#custom#patch_global('filterParams', {
\ 'matcher_fuzzy': {
\ 'splitMode': 'word'
\ }
\ })
converter_fuzzy
filter provides an option hlGroup
to change the highlight
group in vim. This filter applies the highlight group to characters matched by
the input pattern.
call ddc#custom#patch_global('filterParams', {
\ 'converter_fuzzy': {
\ 'hlGroup': 'SpellBad'
\ }
\ })
- tani/ddc-git, git commit/file/branch completion
- tani/ddc-oldfiles, oldfiles completion
- tani/ddc-path, path namescompletion in current working directory
- tani/ddc-onp, yet another fuzzy matcher with O(NP) algorithm
This work is licensed under the MIT License. Copyright © 2021 TANIGUCHI Masaya. All rights reserved.