uga-rosa / cmp-dictionary

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

Multi-word entries & a dictionary separated by newlines. #47

Closed RobinTruax closed 1 year ago

RobinTruax commented 1 year ago

Hi, lovely plugin. I am configuring Neovim into an editor for prose mathematics. I am creating a dictionary of math terminology, and I'd like to use multi-word phrases in said dictionary. For example, the phrase 'finite-dimensional vector space' occurs with high frequency. I have a dictionary of such entries, possibly multi-word, separated by newlines. Right now, the plugin separates all of these into their own entries ('finite-dimensional', 'vector', 'space'). Is there a way to use such a dictionary with your plugin? I poked around for a bit and didn't see a quick way to enable such an option, though I'm not familiar with the codebase.

uga-rosa commented 1 year ago

The plugin is designed to be compatible with vim's built-in dictionary completion function (:h i_CTRL-X_CTRL-K), and the format of the dictionary is also similar. Also, It is a common dictionary format in linux to recognize words in a file separated by whitespace characters. (/usr/share/dict/words). I would like to protect compatibility in this plugin, but nvim-cmp itself can fulfill your wishes. Why don't you add candidates directly yourself with this issue or use cmp-dynamic? In cmp-dynamic, there is no obligation to use a function, so it can also be used as a way to pass arbitrary CompletionItem directly.

RobinTruax commented 1 year ago

This makes sense, thank you for the recommendations.