Skip to content

spell source for nvim-cmp based on vim's spellsuggest.

Notifications You must be signed in to change notification settings

f3fora/cmp-spell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

cmp-spell

spell source for nvim-cmp based on vim's spellsuggest.

Setup

require("cmp").setup({
    sources = {
        {
            name = "spell",
            option = {
                keep_all_entries = false,
                enable_in_context = function()
                    return true
                end,
                preselect_correct_word = true,
            },
        },
    },
})

Setting spell (and spelllang) is mandatory to use spellsuggest.

vim.opt.spell = true
vim.opt.spelllang = { "en_us" }

Options

keep_all_entries

If true, all vim.fn.spellsuggest results are displayed in nvim-cmp menu. Otherwise, they are being filtered to only include fuzzy matches.

Type: boolean
Default: false

enable_in_context

'nvim-cmp' menu is populated only when the function returns true.

For example, one can enable this source only when in a @spell treesitter capture. See :help treesitter-highlight-spell.

enable_in_context = function(params)
    return require('cmp.config.context').in_treesitter_capture('spell')
end,

Type: function
Return: boolean
Default:

enable_in_context = function(params)
    return true
end,

Note: this option will be removed when hrsh7th/nvim-cmp#632 is implemented.

preselect_correct_word

If true and the spelling of a word is correct, the word is displayed as the first entry and preselected.

Type: boolean
Default: true

Credit

About

spell source for nvim-cmp based on vim's spellsuggest.

Topics

Resources

Stars

Watchers

Forks

Languages