Code Monkey home page Code Monkey logo

ddc-fuzzy's Introduction

ddc-fuzzy filters

Introduction

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.

Installation

To install our filters,

Plug 'tani/ddc-fuzzy'

To use our filters,

call ddc#custom#patch_global('completionMenu', 'pum.vim')
call ddc#custom#patch_global('sourceOptions', {
  \   '_': {
  \     'matchers': ['matcher_fuzzy'],
  \     'sorters': ['sorter_fuzzy'],
  \     'converters': ['converter_fuzzy']
  \   }
  \ })

Configuration

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'
  \   }
  \ })

Related Projects

This work is licensed under the MIT License. Copyright © 2021 TANIGUCHI Masaya. All rights reserved.

ddc-fuzzy's People

Contributors

tani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.