uga-rosa / cmp-dictionary

A dictionary completion source for nvim-cmp
MIT License
236 stars 16 forks source link

[Feature]Auto detect/change case based on input #22

Closed tzws closed 2 years ago

tzws commented 2 years ago

Is it possible to auto detect and change based on input, just like this plugin did: https://github.com/skywind3000/vim-auto-popmenu

for example, the dictionary contains the word "example", if I type "exa", it will prompt a match in the dropdown list. However, if I type "Exam", there's none matched.

this is my config: ` use 'skywind3000/vim-dict' use { 'uga-rosa/cmp-dictionary', after='nvim-cmp',

config = function()
  require('cmp_dictionary').setup ({
    dic = {
      ["text"] =  string.format('%s/site/pack/packer/start/vim-dict/dict/text.dict',vim.fn.stdpath('data')),
      ["javascript,typescript"] = { string.format('%s/site/pack/packer/start/vim-dict/dict/javascript.dict',vim.fn.stdpath('data')) },
      ["lua"] = { string.format('%s/site/pack/packer/start/vim-dict/dict/lua.dict',vim.fn.stdpath('data')) },
      ["vim"] = { string.format('%s/site/pack/packer/start/vim-dict/dict/vim.dict',vim.fn.stdpath('data')) },
    },
    exact = 2,
    async = false,
    capacity = 5,
    debug = false,
  })
end

} `

uga-rosa commented 2 years ago

I haven't used that plugin before, so please let me know your request more clearly. Do you mean you want the first letter to be case-insensitive?

uga-rosa commented 2 years ago

When you type "Exam", do you want to see "example" or "Example"? I think "Example" is more convenient.

uga-rosa commented 2 years ago

110a80699c845eed65eed9867bbf65d9e428da09 I implemented it in a direction that I think is useful. If I do this for all characters except the first, it may affect performance.

tzws commented 2 years ago

110a806 I implemented it in a direction that I think is useful. If I do this for all characters except the first, it may affect performance.

@uga-rosa Thanks a lot. That's will be very useful when writing documents.

uga-rosa commented 2 years ago

That's good to know. I'll close now that you seem to be satisfied.

tzws commented 2 years ago

When you type "Exam", do you want to see "example" or "Example"? I think "Example" is more convenient.

for example, a dict is like this, all in lower case

...
example
child
entry
...

When I type "exam" in insert mode, it will prompt "example", when I type "Exam" it will prompt "Example", we don't have to put both "example" and "Example" in dict to increase the dict size and processing time. 2

this is the effect of https://github.com/skywind3000/vim-auto-popmenu

uga-rosa commented 2 years ago

It looks like the current implementation is correct. Thanks for the explanation.