Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f3fora/cmp-spell
spell source for nvim-cmp based on vim's spellsuggest.
https://github.com/f3fora/cmp-spell
nvim-cmp
Last synced: 1 day ago
JSON representation
spell source for nvim-cmp based on vim's spellsuggest.
- Host: GitHub
- URL: https://github.com/f3fora/cmp-spell
- Owner: f3fora
- Created: 2021-08-25T22:07:07.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T12:29:03.000Z (8 months ago)
- Last Synced: 2024-10-30T08:19:04.298Z (2 months ago)
- Topics: nvim-cmp
- Language: Lua
- Homepage:
- Size: 7.81 KB
- Stars: 194
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cmp-spell
`spell` source for [`nvim-cmp`](https://github.com/hrsh7th/nvim-cmp) based on vim's `spellsuggest`.
## Setup
```lua
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`.
```lua
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`.
```lua
enable_in_context = function(params)
return require('cmp.config.context').in_treesitter_capture('spell')
end,
```Type: function
Return: boolean
Default:```lua
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
- [compe-spell](https://github.com/hrsh7th/nvim-compe/blob/master/lua/compe_spell/init.lua)
- [nvim-cmp request](https://github.com/hrsh7th/nvim-cmp/issues/69)